general/other Sylve does not restart a VM that is attempting to reboot itself

I have been trying Sylve as a unified manager for my VMs and jails. Hats off to the authors of this fantastic software. It has tons of potential and is progressing very rapidly. The issue I am having is that Sylve does not seem to restart my OPNsense (FreeBSD 15.1) VM when the VM tries to reboot itself. The VM simply powers off and requires a manual reboot from the Sylve user interface. When looking at the running processes, it appears the bhyve process is exiting completely and is not hanging.

In reading up on the issue, it is unclear to me if Sylve actually includes rebooting a VM at the VM 's request as one of its current features. It appears that when a reboot is requested, bhyve exits with a return code 0 which signals the VM wants to be rebooted. It is then up to the management software, Sylve in this case, to recognize the return code and restart the VM. Does anyone know if Sylve in its current state will restart a VM that wants to reboot itself? The problem could also be with the VM not returning the proper exit code.
 
I don't know Sylve, but bhyve simply quits when it receives reboot or poweroff signal. So, if the bhyve command line is not in an infinite loop, that's you're going to get.

This is a simplified snippet of the script I use:
Code:
while true; do
    (...snip...)
    bcmd="bhyve "$VMoptions" -c "$Cores" -m "$Mem" -s 0,hostbridge "$disk" "$iso" -s 31,lpc "$comB" "$vnc" "$Devices" "$VMrom" "$VMname" > /dev/null"
    echo "$bcmd"
    eval "$bcmd"

    # Reason of VM exit
    rex=$?
    DestroyVM $VMname
    case "$rex" in
        0) LogHard "Reboot $VMname.";;
        1 | 2) LogHard "Poweroff $VMname.";;
        3) LogHard "${VMname}: crash due to triple fault.";;
        4) LogHard "${VMname}: crash due to an error.";;
        *) LogHard "${VMname}: exit for unknown reason.";;
    esac

    if [ "$rex" -ne 0 ]; then
        return 0
    fi
done
 
Thank you for your response Emrion. I understand that bhyve exits and the return code is what signals a restart. In vm-bhyve there is a while loop that does essentially the same thing as your code. It monitors the exit code and restarts bhyve if necessary, otherwise it breaks out of the loop. Has Sylve implemented something similar in their code or does that feature not exist yet?
 
Back
Top