Temporarily disable "Start at boot" for all vms for service reasons

grl

Renowned Member
Oct 20, 2011
24
1
68
Hi!

Is there a way to disable the "start at boot" option for all vms temporarily without changing the config of each vm?

When doing maintenance on the host it would be convenient to reboot the host without all the vms running on it. As far as I can see I have to change the config of each vm, remembering which one was on autostart and which was not.

Then doing the maintenance, then resetting the Boot at start option for each vm.

It would be really nice to have a general option: "Do not autostart vms on this proxmox host" - so you could enable that, do your maintenance work, reboot at will and if everything is fine again just disable the option again...

Or is there a way to do that that I didn't see?

Regards
Luggi
 
Afaik, there is no single button that you can press to do so.
You can create an easy script that does this for you. The pseudo code would be:
if argument startupoff
process "pvesh get /cluster/resources --output-format json" find all VMs with start up ON,
tag them with "startupon"
disable startup
if argument startupon
process "pvesh get /cluster/resources --output-format json" find all VMs with tag=startupon
enable startup on boot

good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Its also possible to:
A.) kill the "Starting all guests" task so it will only try to start the first VM and skip all the other ones
B.) temporarily set something really high for the node-wide start delay at "YourNode -> System -> Options -> Start on boot delay". With delay of 600000 you should get a week to do your maintainance before it tries to start the first guest.
 
Last edited:
  • Like
Reactions: leesteken
The bugzilla reference above points to the right direction.

What you can do as a workaround for now is to override the pve-guests.service (systemctl edit pve-guests.service) ExecStart directive.

Write your own wrapper for the startall command, something like:

Bash:
#!/usr/bin/env sh

if [ -f "/maintenance" ]; then
    echo "Host is in maintenance mode. Skipping startall."
    exit 0
fi

exec /usr/bin/pvesh --nooutput create /nodes/localhost/startall
 
  • Like
Reactions: Kingneutron
I've used this procedure a few times now on single node setups:

- systemctl disable pve-guests.service.
- Reboot and no VM will be started. Do the update or whatever maintenance is needed.
- Reboot if needed (i.e. kernel update).
- systemctl enable pve-guests.service && /usr/bin/pvesh --nooutput create /nodes/localhost/startall.

Disclaimer: haven't tested this procedure much as usually can live migrate and the node is empty for maintenance, so no need to disable VM start.
 
  • Like
Reactions: Kingneutron

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!