Ensure VM Auto-Start on SCALE

I’m running a server on TrueNAS SCALE 25.10.5 - Goldeye.
There is one virtual machine on the system, and its Start on boot option is enabled.
The host powers up via Wake‑On‑LAN once a week, and it shuts down through a scheduled cron job.
Sometimes, when the server starts, the VM does not come up automatically. I then log in to the web interface and toggle the Running button manually; the VM starts without any problems.
What can I do to ensure that the VM always starts automatically?

I’d check the startup order and whether the VM service is fully ready before the autostart trigger runs. SCALE updates or delayed storage/network initialization can sometimes cause this. You could also check the VM logs after a failed boot and consider a scheduled post-boot script as a fallback to start the VM if it isn’t running.

You could run some scheduled script, that starts a vm if it is set to autostart but is not currently running.

#!/usr/bin/bash
PATH=/bin:/usr/bin:/usr/local/bin
if [ $# -eq 0 ]; then
    echo "Syntax: `basename $0` vmname"
    exit 0
fi
VMNAME=$1

VMID=`midclt call vm.query | jq --arg vmname $VMNAME '.[] | select(.name == $vmname) | .id'`
VMS=`midclt call vm.query | jq --arg vmname $VMNAME '.[] | select(.name == $vmname) | .status.state'`
VMA=`midclt call vm.query | jq --arg vmname $VMNAME '.[] | select(.name == $vmname) | .autostart'`
if [[ "$VMA" != "true" ]]
then
     echo "VM is not on autostart."
     exit 0
fi
if [[ "$VMS" == '"STOPPED"' ]]
then
    midclt call vm.start $VMID
    echo "Watchdog starting '$VMNAME': id=$VMID"
    exit 1
else
   echo "VM is already running."
   exit 0
fi