Post-Stop Hook Windows 11 VM

matrixx

New Member
May 19, 2023
5
0
1
Current Kernel: 5.15.53-1-pve
VFIO Single GPU Pass Through (Sapphire Pulse rx 6800 xt)
Guest OS: Windows 11

Requirement:

Starting Win11 from proxmox UI that triggers Pre-Start Hookscript that unbinds gpu from host and makes it available to Win11 guest for pci pass through. Use shutdown from within Win11 OS to invoke Post-Stop Hook that unbinds GPU from VM and reattaches it to the host.

Problem:

Shutting down from with the Win11 OS does not trigger the Post-Stop Hookscript. However, shutting down the Win11 VM from the proxmox gui using the shutdown button WILL trigger the Post-Stop Hookscript properly. o

Tested Solutions:
Started with 6.2 kernel and was experiencing vfio pass through issues and eventually landed on 5.15.53-1-pve which works for my pass through setup and scripts. The Pre-Start and Post-Stop scripts will work if each are applied manually before and after VM use.

I attempted to add "Sleep" to the Post-Stop script thinking it wasnt running because more background processes needed to finish before the main content of the script runs. This had no effect and the problem continued.

I tried to ssh from within the Win11 VM to the proxmox host and run "qm shutdown 100" which resulted in the same result of the Post-Stop Hook not running.

I reviewed the logs and found only one difference between shut down from within the Win11 VM and pressing the Shutdown button in the Proxmox GUI.

qmeventd: vm still running
After VM shutdown proxmox seems to be checking if the VM is still running before firing the Post-Stop script. It thinks it is running but it is in fact, Stopped. Pressing the Shutdown button on the Proxmox GUI does not seem to have this check and runs the Post-Stop script correctly, but it seems that is the only scenario where it does.

Any help here from the gurus would be greatly appreciated. I did find this past thread about the situation but there must be a solution.

https://forum.proxmox.com/threads/h...the-vm-was-shutdown-from-the-vm-itself.72802/
 

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!