This is an easy way to sleep and wake Windows VM's from sleep:


craigr

11 posts in this topic Last Reply

Recommended Posts

I know many people scoff at sleeping a VM, but I really want to put my Windows 10 VM's to sleep because they are constantly doing things in the background and utilizing a lot of CPU.  It costs me about 50 watts to not sleep the VM and to me that is just a waste.  The trouble has been how to wake them up easily without using another device.

 

All you have to do to make the mouse and keyboard wake Windows from sleep is use evdev to pass them through instead of the Windows template.  The easiest way to learn how to do this is to watch and mostly follow Spaceinvader's new tutorial on evdev:

 

 

I'm sure he will fix it, but please note that Spaceinvader doesn't quite have the syntax correct in the qemu.conf.  The correct syntax is in my post just below his in the linked thread.  Once you get it right, your mouse and keyboard will be able to wake your Windows VM from sleep 🤩  Also, don't forget to turn "Link State Power Management" back on in the Advanced settings of the Windows 10 Power Options, otherwise your computer may just hard shutdown instead of sleep.

 

I am finally happy!

 

Best regards,

craigr

Edited by craigr
Link to post
18 minutes ago, jonathanm said:

Quick question. What happens when the array is cleanly powered off, like for instance if your UPS commands a powerdown, if the VM is asleep?

No idea.  I just did this today.

 

I will have to test this though.  I've got my UPS set to shutdown unRAID if I lose power for 10 seconds (it's not a big UPS and I have 22 drives).  I don't know if unRAID would give Windows the default 60 seconds to shutdown gracefully or not.  My guess is that it would try and shutdown windows gracefully, but I think that could be a problem because I don't want my UPS to have to work for an extra 60 seconds shutting down Windows.  I also doubt Windows could wake from sleep and then shutdown in less than 60 seconds... than again, unRAID may not even know to wake a sleeping VM to shut it down gracefully 😬

 

I'd actually rather unRAID just yank Windows with a hard shutdown. 

 

The next time I have to power down the server I will pull the power on the UPS with Windows asleep and see what happens under controlled conditions.  I'll report back with results.  I know I am going to be doing some hardware changes next Tuesday or Wednesday so I'll find out then or before.

 

Kind regards,

craigr

Link to post
  • 3 months later...
On 12/17/2020 at 5:09 AM, methanoid said:

Nice info OP.   Not running unRAID right now (various reasons) but if you sleep your unRAID server, what happens to VMs that may be running or sleeping when you Resume your unRAID server? I know, not 100% related but it is related sorta.... 

I don’t ever sleep the server, only the Windows 10 VM running on it.

 

craigr

Link to post
  • 1 month later...

I can answer this as I use a Windows 10 and BigSur VM :

 

I can put to sleep the Windows Vm and put to sleep  Unraid with no problem : I wake Unraid, then the W10 wm, and all work fine. Everytime. All bueno.

 

For my Bigsur VM (and for Catalina before it), it's another story and it's the ONLY thing that I can't solve on my Unraid system (well beside network troubles under BigSur..). Meaning the same operation as with the W10 VM works... sometimes. And I can't figure out why as the problem is not happening everytime. But that would be the subject of another thread 🤫

Edited by bjornatic
Link to post
1 minute ago, bjornatic said:

I can answer this as I use a Windows 10 and BigSur VM :

 

I can put to sleep the Windows Vm and put to sleep  Unraid with no problem : I wake Unraid, then the W10 wm, and all work fine. Everytime. All bueno.

 

For my Bigsur VM (and for Catalina before it), it's another story and it's the ONLY thing that I can't solve on my Unraid system (well beside network troubles under BigSur..). Meaning the same operation as with the W10 VM works... sometimes. And I can't figure out why as the problem is not happening everytime. But that would be the subject of another thread 🤫

 

So Sleeping unRAID does NOT sleep the VM first ?   Seems to me that would be cleanest way to do it....

Link to post

I do not now. I think it would be possible by adding the correct command in the sleep plugin (as sleep is not officially supported by Unraid).

 

And it may be a clean way, but not the logical way in my opinion. The VM has to decide by itself (or by manual command) to be put to sleep. And THEN, the Unraid server, "seeing" that everyone is sleeping, puts himself to sleep. And that's how I have it working.

 

The problem I have is on wake up ^^ (for MacOS only, though).

 

EDIT : and by "sleep" I mean hibernate... just to be clear. And It this state I can even restart the server and the W10 VM will resume OK.

 

EDIT again :  I looked around and noticed the option "Enable Virtual BMC :" in the VM manager. And I think that could enable what you suggested.

Edited by bjornatic
Link to post

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.