[Pkg-virtualbox-devel] VBoxSuspend suggestion

Marshall Flax marshall.flax at gmail.com
Sun May 20 14:19:04 UTC 2012


(My apologies if this is an inappropriate way to suggest an enhancement to
the packaging of Virtualbox, but it's got to be more appropriate than
directly writing to debfx-pkg before I saw that this list existed!)

Currently, I'm experiencing a security problem with VirtualBox in
FullScreen mode: since it does a XGrabKeyboard, the xscreensaver's attempt
to a XGrabKeyboard fails with an "AlreadyGrabbed" and I end up coming back
from suspend mode without any screen locking at all. Since I usually lock
my screen by shutting my Thinkpad's lid and thereby forcing suspend mode,
I've created the following two scripts. I think this makes some sense since
it's not unreasonable for VMs to be suspended when the host itself is
suspended.  And pausing a VM always does an XUngrabKeyboard, solving my
original problem.  What do you think ... would this be generally useful?

Many thanks!

Marshall Flax

$ cat /usr/local/bin/VBoxSuspend
#! /bin/sh
VBoxManage list runningvms | perl -ne '(my $vm) = ($_ =~ m/{(.+)}/);
system("VBoxManage controlvm $vm pause")'

$ cat /etc/pm/sleep.d/virtualbox_suspend
#! /bin/sh
case $1 in
   suspend|suspend_hybrid|hibernate)
      for i in `ps h -o user -C VirtualBox | sort | uniq`
        do sudo -u $i /usr/local/bin/VBoxSuspend ;
      done;
      ;;
   resume|thaw)
      # No need to do anything here, we'll manuall unpause VMs as necessary
      ;;
esac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-virtualbox-devel/attachments/20120520/aa4d4e09/attachment.html>


More information about the Pkg-virtualbox-devel mailing list