Pages

Tuesday, 24 May 2011

Arch Linux: How to Make Resume from Hibernate Work

I usually don't use the Hibernate function much, but lately I have been wondering why it was that my Arch installation did not resume from swap when my new Slackware 13.37 on the same laptop had no such problems.
Two things. I found I didn't actually have a swap partition in Arch as through some fooling around a while ago the UUID of the swap partition had changed, and Arch identifies partitions by this ID by default.

But even after I had rectified the problem by entering the correct UUID into fstab I was able to hibernate, but the system booted up normally when it was supposed to resume. Btw, here's a link on how to set up and make active a swap partition and perhaps more interestingly a swap file.

The other issue is that simply following the helpful tip to add resume=/dev/sdaX or the UUID equivalent to your kernel line in Grub, which apparently needs to be inserted before the ro vga= part, is not enough. There are as always many different ways, what I am setting out here applies to a set up with laptop mode tools and pm-utils.

If you're using UUID insert resume=/dev/disk/by-uuid/whatever-random-UUID-number after the root= entry on your kernel line, or if you have an encrypted set up something similar to

kernel /vmlinuz26 cryptdevice=/dev/sda2:main root=/dev/mapper/main-root resume=/dev/disk/by-uuid/whatever-random-number-here ro

That's only half the job though. Now we have to create a hook and rebuild the initramfs. For this to work we need to edit /etc/mkinitcpio.conf (as root) and add resume to the Hooks array, similar to this
HOOKS="base udev autodetect ide scsi sata lvm2 resume filesystems "

Note that resume has to be after scsi sata lvm2 and before filesystems. Finally, issue

#mkinitcpio -p kernel26

and we should be done. Next time you come out of hibernation you should see a screen 'unfreezing' or rather decompressing the previous session.

The process is well documented on the Arch Wiki but needs a fair amount of digging among the results when doing a search.

1 comment:

  1. Thanks very much. This is I was looking for a long time.
    Sorry for my english.

    ReplyDelete

Please leave your comment here. Spam will be deleted.

Note: only a member of this blog may post a comment.