TuxOnIce and Debian hibernate *hell* purgatory

Following on from the pain of hibernate almost bricking my Intel NUC, the fix for that seems to mean I'm no longer able to use the kernel hibernate method (it just hangs and needs power cycling). So I've gone back to good old reliable TuxonIce. Except it seems like nobody else is using it on Debian 8/Jessie as I can't find any guide to getting it setup (even though there is the user interface package tuxoniceui still in the stable repo.). (To be honest, I was amazed TuxOnIce is still a thing, and not part of the kernel years ago. Seems to be a major disagreement stopping it being merged).

So far, after a few hours of false starts and panics (both kernel and mental), I've cobbled together from lots of other people's work something that sometimes hibernates and powers off successfully, and once has resumed, but even then caused a kernel panic, as it seemed to have not enabled all the CPU cores. So not quite there yet... (will update this post as I work on it)

Credits:

  • https://wiki.archlinux.org/index.php/TuxOnIce
  • http://www.ubuntugeek.com/how-to-install-tuxonice-in-ubuntu.html
  • https://moregreyhair.wordpress.com/2012/07/08/tuxonice-the-debian-way/

Firstly I followed the instructions from ... to build a Debian package of the kernel with TuxOnIce patched in. I followed most of the rest of the instrctions as well with the exception of:

  • You no longer need a restore line on the kernel boot if you are using a swap partition, TuxOnIce will find it automatically (and if you pass one it seems to assume it's a file and returns a weird 'sh Device error: Device or resource busy' error message.

I then followed the advice from the other blogs to add in the 'lzo' module to initramfs (/etc/initramfs-tools/module), update TuxOnIce config to use it (/etc/hibernate/tuxonice.conf), added a hook in /etc/initramfs-tools/hooks to load it, and a script in /etc/initramfs-tools/scripts/local-premount to run resume. All this is from the blogs/wiki posts but modified for Debian Jessie.

After all this, I'm now at the stage where running hibernate or selecting hibernate from the panel (which I think runs pm-hibernate as opposed to the hibernate script, not totally sure...) does run TuxOnIce, and does save the image and turn the NUC off.

Starting up again, I've got the kernel to try to restore the image, and TOI reads and does the atomic copy back, but then stalls at this point, usually just after a message about Disabling non-boot CPUs. Except once when it returned be back to my hibernated session, but with a kernel Ooops about trying to kill the idle task (presumably the CPUs hadn't all been enabled again). So still working on restore...