Sometimes VM refuse to shutdown, I suggest adding a force stop VM function

shodan

Member
Sep 1, 2022
89
33
23
Hello,

I have researched this topic quite a bit and it seems I am not the only one with this issue.
And people have been having it at least since 2013.

Here is a few of them

https://forum.proxmox.com/forums/proxmox-ve-installation-and-configuration.16/post-thread
https://dannyda.com/2020/05/11/how-...imeout-proxmox-cant-shutdown-virtual-machine/
https://bobcares.com/blog/proxmox-cant-stop-vm/
https://kb.vander.host/virtualization/how-unlock-a-vm-in-proxmox/
https://old.reddit.com/r/Proxmox/comments/n3q618/stopshutdown_option_of_vm_doesnt_work/
https://old.reddit.com/r/Proxmox/comments/inbl01/force_vm_to_restart_or_shutdown/
https://old.reddit.com/r/Proxmox/comments/qi7wgw/how_to_kill_a_vm_when_neither_the_gui_nor_qm_stop/
https://forum.proxmox.com/threads/cannot-shutdown-a-vm.77447/
https://forum.proxmox.com/threads/force-kill-a-vm.63590/
https://forum.proxmox.com/threads/stop-vm-impossible.101736/

So I made a thread on reddit

https://old.reddit.com/r/Proxmox/comments/xal3c8/how_can_you_force_a_vm_to_go_down_immediately/

and one person suggested, instead of deleting the lock files, to type this command

qm shutdown <vmid> --forceStop --skiplock

Which makes me think, this could be the command that a "Force stop"

1662834396050.png

So I guess the first step in doing that is finding where the UI has this menu and add one element.

I guess however the proxmox ui does the "stop" is going to be the same way for force stop except with the --forceStop --skiplock arguments ?
 
Hello,

I have researched this topic quite a bit and it seems I am not the only one with this issue.
And people have been having it at least since 2013.

Here is a few of them

https://forum.proxmox.com/forums/proxmox-ve-installation-and-configuration.16/post-thread
https://dannyda.com/2020/05/11/how-...imeout-proxmox-cant-shutdown-virtual-machine/
https://bobcares.com/blog/proxmox-cant-stop-vm/
https://kb.vander.host/virtualization/how-unlock-a-vm-in-proxmox/
https://old.reddit.com/r/Proxmox/comments/n3q618/stopshutdown_option_of_vm_doesnt_work/
https://old.reddit.com/r/Proxmox/comments/inbl01/force_vm_to_restart_or_shutdown/
https://old.reddit.com/r/Proxmox/comments/qi7wgw/how_to_kill_a_vm_when_neither_the_gui_nor_qm_stop/
https://forum.proxmox.com/threads/cannot-shutdown-a-vm.77447/
https://forum.proxmox.com/threads/force-kill-a-vm.63590/
https://forum.proxmox.com/threads/stop-vm-impossible.101736/

So I made a thread on reddit

https://old.reddit.com/r/Proxmox/comments/xal3c8/how_can_you_force_a_vm_to_go_down_immediately/

and one person suggested, instead of deleting the lock files, to type this command

qm shutdown <vmid> --forceStop --skiplock

Which makes me think, this could be the command that a "Force stop"

View attachment 40932

So I guess the first step in doing that is finding where the UI has this menu and add one element.

I guess however the proxmox ui does the "stop" is going to be the same way for force stop except with the --forceStop --skiplock arguments ?
Either that or if the existing "stop" option were to override a (theoretically) ongoing "shutdown"?

Because that's the issue right, that the "shutdown" blocks other actions until it either completes or times out?
So in the scenario where "shutdown" is impossible you either have to wait for it to time out (I don't recall what the timeout is, maybe a minute?) and then hit "stop" instead or you do the command line thing you mentioned.
 
I'm not sure why it does that.
It doesn't happen often, but when it happens it's very annoying.
I think it might be related to the boot state of my OS ?

I've been having that problem a lot with PXE client that fails to boot

I've been doing a LOT of PXE testing stuff so I have to reboot them just a ton, so maybe it's just because of how often I reboot them that I seem to have this problem more often with them ..


Yesterday, this VM was giving me a lot of grief, took 12 minutes before it finally shut down !

1662835976601.png
 
I'm not sure why it does that.
It doesn't happen often, but when it happens it's very annoying.
I think it might be related to the boot state of my OS ?

I've been having that problem a lot with PXE client that fails to boot

I've been doing a LOT of PXE testing stuff so I have to reboot them just a ton, so maybe it's just because of how often I reboot them that I seem to have this problem more often with them ..


Yesterday, this VM was giving me a lot of grief, took 12 minutes before it finally shut down !

View attachment 40933

Yes, it almost certainly depends on the current state of the OS.

I think "shutdown" essentially maps to "tap on power button" on a physical machine, ie would send an ACPI event that requests that the OS (voluntarily) starts to shut itself down. Which will only work if the OS is in a somewhat good state.
("Stop" is more of a "yank the power cord" equivalent.)

And as I understand it, the thing that causes the complaint here is the limitation imposed by Proxmox that only one of these actions can run at the same time. So the "shutdown" action needs to finish (either the machine shuts down out or the "shutdown" action times out after a while) before you can do more of these power state actions on that VM, at which point you can do "stop" instead.
 
When you open (double-click on it) such a "hanging" shutdown-task in the task log at the bottom, you should be able to stop this task (stop-button in the left top corner of the newly opened task-window).
After this, you should be able to hard stop the VM over the normal GUI-menu.
With this, you do not need to wait of any timeout.
 
When you open (double-click on it) such a "hanging" shutdown-task in the task log at the bottom, you should be able to stop this task (stop-button in the left top corner of the newly opened task-window).
After this, you should be able to hard stop the VM over the normal GUI-menu.
With this, you do not need to wait of any timeout.
Great point.

I still agree with OP that it would feel more intuitive to just have "stop" always work.
 
  • Like
Reactions: hlindqvist
@hawk
I think this is exactly what is happenning

There should be a distinction when a command pushes the ACPI button and when it pause/stop/start at the qemu level

1662841649994.png

Ah, now I can reliably reproduce the issue, pressing shutdown at bad moments
And then it hangs waiting, and if you send more commands they time out
1662841764575.png


1662841781100.png


1662841809982.png

And double click on the task
1662841867379.png
then hit stop
1662841834116.png

That seems to work everytime !
 
Last edited:

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!