Title photo
frugal technology, simple living and guerrilla large-appliance repair
Sat, 18 Jan 2014

I solve the suspend/resume problem in Fedora 20

It's my holy grail. My holy fucking grail. Suspend/resume.

And I finally figured it out. I've seen the hints about putting a resume=/dev/??? line into the bootline in GRUB, with ??? being the location of the swap partition. I tried it, and it never seemed to work.

So I forgot about it.

Then I saw this post from Ankur Sinha that makes the same suggestion:

resume=/dev/??? in the bootline in GRUB

But what to sub in for ???? Where exactly is /swap?

My system is encrypted and using LVM, so finding /swap is not as easy as using df -h or opening up gParted.

Maybe the system itself could help me figure out where /swap lives in the LVM/encrypted world of Fedora.

I looked at the man page for swapon and soon had my answer:

$ swapon -s

That returns the following:

/dev/dm-1

So I rebooted and dropped this at the end of my bootline in GRUB:

resume=/dev/dm-1

Lo, behold and holy shit, IT WORKS!

I now have working suspend/resume in Fedora 20 -- and presumably every other Linux distribution out there.

Next step, how to modify GRUB so this persists. It's not so easy because GRUB isn't set up the same way in this Fedora U/EFI system as in other systems I've seen.

If/when I figure that out, I'll update this entry. But for now, I HAVE SUSPEND/RESUME. Couldn't be happier. (Really!)

First try at making GRUB modification permanent

I tried to get resume=/dev/dm-1 into GRUB permanently on my EFI-based Fedora system.

Here's what I did.

$ sudo gedit /etc/default/grub

I turned this line:

GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.md=0 rd.dm=0 $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) vconsole.keymap=us rd.lvm.lv=fedora/root rd.luks.uuid=luks-f87cd0dc-c2a5-4a18-913d-b0c9d0e7d18f rhgb"

into this:

GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.md=0 rd.dm=0 $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) vconsole.keymap=us rd.lvm.lv=fedora/root rd.luks.uuid=luks-f87cd0dc-c2a5-4a18-913d-b0c9d0e7d18f rhgb resume=/dev/dm-1"

Note the added bit at the end.

Then I rebuilt my GRUB entries:

$ sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

GRUB didn't look quite the same upon reboot, but my boot stanza did have resume/dev/dm-1 in it. And suspend/resume still works.

I don't know if this will persist after a kernel update (I suspect it won't), so I'll update this entry when I know more.