I wanted one list showing which Proxmox containers and VMs start first, and which ones shut down last. Opening each guest’s options gets old pretty quickly.
This command reads the local node’s guest configs and prints the settings together. Run it in Bash on the Proxmox host as root. It’s read-only.
List the current order
This is the original command I use regularly, split across lines so it’s easier to read and copy:
printf "%-6s %-5s %-32s %-8s %-8s %-8s %-8s\n" "TYPE" "ID" "NAME" "ONBOOT" "ORDER" "UP" "DOWN"printf "%-6s %-5s %-32s %-8s %-8s %-8s %-8s\n" "------" "-----" "--------------------------------" "--------" "--------" "--------" "--------"for f in /etc/pve/lxc/*.conf /etc/pve/qemu-server/*.conf; do [ -f "$f" ] || continue id=$(basename "$f" .conf) case "$f" in */lxc/*) type="LXC" ;; */qemu-server/*) type="VM" ;; esac name=$(awk -F': ' '/^(hostname|name):/{print $2; exit}' "$f") onboot=$(awk -F': ' '/^onboot:/{print $2; exit}' "$f") startup=$(awk -F': ' '/^startup:/{print $2; exit}' "$f") order=$(printf '%s' "$startup" | grep -oE 'order=[0-9]+' | cut -d= -f2) up=$(printf '%s' "$startup" | grep -oE 'up=[0-9]+' | cut -d= -f2) down=$(printf '%s' "$startup" | grep -oE 'down=[0-9]+' | cut -d= -f2) printf "%-6s %-5s %-32s %-8s %-8s %-8s %-8s\n" "$type" "$id" "${name:--}" "${onboot:-0}" "${order:--}" "${up:--}" "${down:--}"done | sort -k5,5nThere’s one catch: numeric sort puts the - entries at the top. Proxmox starts guests with no explicit order after those with an order. Also, ONBOOT=0 means the guest won’t start automatically at host boot. The table includes all local guests, including those excluded from automatic startup.
The output is something like this below:
TYPE ID NAME ONBOOT ORDER UP DOWN------ ----- -------------------------------- -------- -------- -------- --------VM 110 debian13a 0 - - -LXC 104 mqtt 1 2 5 120LXC 103 debian13d 1 3 10 120VM 105 debian13c 1 4 20 180LXC 112 debian13b 1 5 5 120LXC 108 debian13e 1 6 5 120LXC 109 pocketid 1 7 5 120LXC 111 obsidian-livesync 1 9 5 120VM 122 debian13i 1 10 10 180LXC 106 debian13h 1 11 2 120LXC 115 homebox 1 12 2 60LXC 100 wastebin 1 13 2 60LXC 107 bytestash 1 14 2 60LXC 101 debian13g 1 15 2 120LXC 114 debian13f 1 16 5 -For configured orders, lower numbers start first. To display those in reverse, change the final sort to sort -k5,5nr. That’s useful for reading shutdown order, with the same caveat about unset values. Names containing spaces can shift the sort column too. This command suits simple hostnames like mqtt and home-assistant.
Meaning of the column values
| Column | Meaning |
|---|---|
ONBOOT | 1 enables automatic startup when the host boots. |
ORDER | Startup priority. Lower numbers start first; shutdown uses the reverse order. |
UP | Delay in seconds after starting this guest before starting subsequent guests. |
DOWN | Graceful shutdown timeout in seconds before the guest is forcibly stopped. |
So order=2,up=5,down=120 means start at priority 2, wait 5 seconds before moving on, and allow up to 120 seconds for shutdown. DOWN isn’t a separate shutdown priority. A - means the setting wasn’t explicitly saved, not that its effective value is zero.
These rules apply within one host. HA-managed guests follow HA handling instead. A startup delay also doesn’t check whether MQTT, DNS or another application is ready. See the Proxmox startup and shutdown documentation (opens in a new tab).
Set one guest, or a batch
Replace these example IDs with your own. Use pct for containers and qm for VMs:
pct set 104 --onboot 1 --startup order=2,up=5,down=120qm set 105 --onboot 1 --startup order=4,up=20,down=180For a few guests, a small table is easier to adjust. Each row below contains the command, guest ID, order, startup delay and shutdown timeout:
while read -r tool id order up down; do "$tool" set "$id" \ --onboot 1 \ --startup "order=$order,up=$up,down=$down" || breakdone <<'EOF_GUESTS'pct 104 2 5 120pct 103 3 10 120qm 105 4 20 180EOF_GUESTSThese guests will start automatically when the host boots, using the settings above. They won’t start or stop right now. If a command fails, the loop stops. Changes already made stay saved.
Before changing anything, copy the current onboot and startup values from pct config ID or qm config ID. To undo a change, set those previous values again. If startup was originally absent, remove it with pct set ID --delete startup or the equivalent qm command.
Check what was saved
Rerun the listing, or check individual guests:
pct config 104 | grep -E '^(onboot|startup):'qm config 105 | grep -E '^(onboot|startup):'In the batch example, container 104 starts before 103, then VM 105. Shutdown goes the other way: 105, 103, 104. Put a service’s dependencies earlier in the order so they can stay running until that service has shut down.
Comments