(SOLVED) Paused VM is powered off instead of hibernated/shutdown correcly


Go to solution Solved by danielocdh,

Recommended Posts

I have a windows VM on my ssd cache drive, I want to have it paused most of the time, but when it is paused and I shutdown/reboot unraid the windows install inside the VM gets powered incorrectly(instead of hibernated/shutdown correctly).

 

If I hibernate the VM manually it usually takes around 10 seconds for the ssd to stop showing reads/writes, I increased the "VM shutdown time-out" to 90 but problem persists.

 

The VM doesn't have any extra hardware attached to it.

 

Is this normal unraid behavior? any way to workaround it? thanks

vm.png

 

Edit:

Unraid(6.8.3) isn't considering/handling correctly paused VMs (/etc/rc.d/rc.libvirt -> stop_running_machines)

If you have a paused VM you'll run into forced VMs shutdown when shutting down/rebooting Unraid and also issues when trying to stop Unraid array

I made a solution for this (see below)

I tested the solution on versions: 6.8.3, 6.9.1, 6.9.2

Update:

It seems the issue is a bit worst on 6.9.1 as it seems to force a parity check after an unclean shutdown caused by the bug. Luckily the solution still works for 6.9.1

Last Update:

The issue seems fixed and it is marked as fixed on the changelog since unraid Version 6.10.0 2022-05-07

You can still use the solution on older unraid versions

Edited by danielocdh
issue fixed on 6.10.0
Link to comment
11 hours ago, Squid said:

Yes, because you haven't set it in VM Settings

image.png.f14d7b03c7460fad240ad919365cfc59.png

 

And you will also have to install on the VM the Virtio Guest Tools (which is in the virtio iso)

there are only 2 "upon host shutdown" settings, which one would would I have to set to avoid an incorrect shutdown?

I guess I didn't fully explained myself, I tried with "upon host shutdown" on both shutdown or hibernate, the VM still gets powered off incorrectly.

virtio tools are installed, manual hibernate and stop from unraid work correctly(windows is hibernated/shutdown correctly)

Link to comment
  • 3 weeks later...
  • Solution

The issue is fixed since unraid Version 6.10.0 2022-05-07, so you only need to use the script on older versions.

 

So the fix I'm using now (tested on Unraid 6.8.3, 6.9.1, 6.9.2) is to edit /etc/rc.d/rc.libvirt ->stop_running_machines to correctly handle paused VMs on shutdown/reboot or array stop. Basically I just added commands so stop_running_machines tries to resume the paused VMs, after that they will be hibernated/shutdown as usual.

 

rc.libvirt is not persistent so I created a php script to edit it as needed, I'm running the script with CA User Scripts with the scheduling set as "At First Array Start Only" (need to run the script once after creating it). php script file attached

 

script

Edited by danielocdh
fixed on 6.10.0
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.