6

Moving to GRUB2 my Arch Linux no longer resumes from hibernation, because the actual resuming is no longer set up. In GRUB legacy I'd write:

/boot/grub/menu.lst:

kernel /vmlinuz26 root=/dev/disk/by-uuid/X ro resume=/dev/disk/by-uuid/Y ro

But with GRUB2's new way of handling the boot menu, I no longer know how, where and in which form to add this. My guess is you'd add the entire menuentry to /etc/grub.d/40_custom/ and somehow set up the resuming there? Manually hardcoding menuentries into GRUB2 seems to go against its flexible menu generation approach, but whatever reenables me to use hibernate is gladly welcomed.

Thanks!

15

Open up /etc/default/grub with root privledges and add GRUB_CMDLINE_LINUX="resume=/dev/sdXY" Where XY is the swap partition location, which can be found by sudo fdisk -l. It looks like you are using UUID instead and that's fine. /etc/default/grub only affects the current operating system so don't worry about every linux OS using grub to start using that swap. After finishing your edits, run sudo grub-mkconfig -o /boot/grub/grub.cfg (substitute grub.cfg with whatever file grub reads at boot, e.g. it may be named /boot/grub/grub.efi) to update your grub startup information with what you changed in /etc/default/grub

(I don't think this needs to be done on Ubuntu)
Note that one may need to add a resume hook to make sure the kernel knows that it should resume if Archlinux or perhaps another OS is being used. To do this, if one is using mkinitcpio, go to /etc/mkinitcpio.conf and insert resume in the HOOKS array before filesystems but after ide, scsi, and sata. Then, you you need to rebuild the initial ramdisk(early OS state for loading modules, including resume) image by mkinitcpio -p linux

Other links that may help
https://askubuntu.com/questions/6769/hibernate-to-a-swap-file
https://wiki.archlinux.org/index.php/Pm-utils#Mkinitcpio_Resume_Hook

  • 2
    Thanks! Arch is now successfully back from hibernating again! – miyalys Mar 29 '12 at 13:28
  • @xlys Glad I could help. Did you wait all these months to fix it? – Bryce Guinta Mar 30 '12 at 0:31
  • 1
    Yes, I did, and I left my computer on a lot more because of it. – miyalys Mar 30 '12 at 11:12
  • I had to update initramfs sudo update-initramfs -u -k all – Zamicol Dec 2 '18 at 22:42
  • When I boot, grub gives "error: invalid file name `resume=UUID=XX...XX'. it gives the same error using resume=/dev/sdb1. Any thoughts? – James Talbert Apr 23 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.