qemu/kvm and linux suspend anger


i’ve been trying to make sure that the VM running XP on this laptop survives the system going into suspend.

first problem – virt-manager (i think) has set things up so that XP got installed without ACPI and without APM. so XP can’t shutdown or reboot the VM. advice here sorted that, but the advice says it’s for Windows 2000 and i’ve not found the same information elsewhere.

second problem – so now XP is on APM and i don’t think it supports sleep modes. so i want to add suspend/resume scripts to linux to stop and start the VM. where are the scripts? lots of googling and everyone seems to agree that they’re in /etc/pm. are they? nope. there’s empty folders there but something’s up. and anyway, i’ve no idea what to put in those folders. tripped over the answer here – now how on earth was i supposed to know about that?! grrr.

still plenty of tricks to sort out there – can we actually get XP on qemu to suspend? if so then can we get it to realise the sleep event has occurred, either automatically or via another linux script? and resume when the system wakes? also, if we do have to just shutdown and restart the VM from the pm scripts then i need to solve the shutdown thing because at the moment virsh shutdown just powers off. could be a simple VM config option.

had to get this off my chest.

how not to reboot in ten easy steps

following on from the ‘give it a name’ post, here’s a priority list for the desktop:

  1. get suspend working all the time on all laptops
  2. get suspend and/or hibernate working on everything
  3. get apps working so you can stay logged in forever
    • you shouldn’t ever need to kill or restart an app.
  4. extend rpm/yum so you can do all software installs/updates without logging out or rebooting
    • make sure it can start/restart anything that needs it for the new/updated software to happen
    • make sure it installs new stuff without you having to know that software/driver/firmware has appeared
  5. get kernel module minor version revisions working properly so that you only ever have to reboot if you’ve updated the actual kernel.
  6. split more kernel functionality into modules so that this happens less often
  7. look into applying some/all kernel updates with a suspend/resume to ram or disk.
  8. make all apps save state properly so that if you do have to reboot everything picks up from exactly where it left off.
  9. see if you can run an efficient system with a host kernel with two guest VMs running on it as a HA cluster so that each VM can get a transparent kernel update. then you only have to reboot if the host kernel has to be updated.
    • obviously you then do something to make sure that the host kernel is excessively simplified so that it hardly ever needs any updates.
  10. do that update to grub so that you can do a warm-ish reboot and not have to go back through the BIOS.

there! job done.

Phew! KVM+nvidia success

well, i followed the instructions here and restored my old XP vm image.  and 3D stuff still works.  i guess maybe the two weren’t connected when it went wrong on the other computer.

of vague interest to some: first i installed the VM as an x86_64 system (yes, running 32bit XP) with two cores.  it ran fine but used one of my cores flat out permanently (qemu-kvm).  re-installing as an i686 system with one core sorted that out.  not sure which of those two things caused/fixed it though.

hooray!  right, back to the 3D programming then.  just as soon as i’ve eaten something 🙂