[vfio-users] Preventing host from going into sleep
Laszlo Ersek
lersek at redhat.com
Wed Jun 22 16:42:10 UTC 2016
On 06/22/16 07:01, Nicolas Roy-Renaud wrote:
> I've had my fair share of lockups because I forgot to turn off my VM
> before putting my host to sleep, and I've started looking into some sort
> of lock to prevent that kind of mistake. Normally, I'd use something
> like `systemd-inhibit
> <https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html>`
> to do that, except the calls libvirt makes to its hook scripts are
> self-contained while sysd-inhibit is completely synchroneous (you use it
> just like `time`). I've looked into using the underlying dbus calls
> instead, and it appears that since Inhibit()
> <https://www.freedesktop.org/wiki/Software/systemd/inhibit/> returns a
> file descriptor which expires as soon as its owner is closed, I can't
> just lock it before the VM starts and close it when it stops.
>
> By the looks of it, I can't write a wrapper script for qemu-system
> either since libvirt doesn't launch it with the same capabilities as a
> regular user, and the dbus calls coming from sysd-inhibit fail.
>
> I can't seem to find a simple solution to that issue, which is a pretty
> big deal considering it's not something that libvirt supports on its own
> (unless I've missed something). What would you all reccomend?
man logind.conf
Locate all settings / actions related to S3 suspend, and disable them in
your logind.conf (possible pathnames are listed in the manual page).
Personally I hate when my laptop suspends as soon as I close the lid (->
another sign of the desktop mentality: "if I'm not looking, nothing can
be happening!"). I disabled it with the following setting in
"/etc/systemd/logind.conf":
HandleLidSwitch=ignore
I trust if you set some more actions to "ignore", they'll do what you want.
HTH
Laszlo
More information about the vfio-users
mailing list