Ask Your Question
3

fedora 24 - how to enable hibernate

asked 2016-11-06 13:14:23 -0600

noammo gravatar image

updated 2016-11-06 13:16:15 -0600

hey, I have Fedora 24, and i'm trying to add hibernate. I've been installed this extension, (hibernate extension) and I also did these two commands

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

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

(from here - link , which I found in the extension page (in the comments))

but the hibernate button, still doesn't working.. (it asking me "hibernate - do you really want to hibernate the system ?" but its still does nothing) and if i'm holding the alt, so the icon (of the hibernate button) has changed (i dont know whats the difference between them), but when i click it, so it does nothing, and even doesn't show popup or something..

did i miss something ? anything that i had to do - and i forgot ?

Thanks in advance,

Noam

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2016-12-01 06:10:31 -0600

basic6 gravatar image

updated 2016-12-23 09:12:03 -0600

Hibernate is available, but it does not work by default on Fedora 24 due to a missing parameter.

When hibernating, the system state is saved in an image on disk, which must be loaded and restored the next time the system is booted. In order for hibernate to work properly, the system needs to know where its state (memory) is saved on disk. Even if it's saved in a swap partition that is currently being used (and that is large enough to hold the contents of the RAM) - if it does not know that there might be a saved state image on that swap partition when booting, it would just boot normally, not restoring the state, which would be just like a system crash (state lost).

When booting, the Linux kernel must be provided with a resume parameter with the location of the swap partition that would contain a state image. Unfortunately, the Fedora installer does not seem to configure this parameter, which is why hibernate does not work by default. All you need to do to fix it is add this parameter to the boot configuration, so that the system will look for a saved state when turned on.

Find out what you need to add:
It's resume=/path/to/swap, where /path/to/swap must be replaced with your swap partition (that, again, should be large enough to hold the contents of the RAM). Run the following command to find out where your swap partition is: swapon -s
In the following example, the path would be /dev/sda2 (parameter: resume=/dev/sda2):

# swapon -s
Filename                Type        Size    Used    Priority
/dev/sda2                               partition   16777216    1004    -1

Note that this gives you the current device path of the mounted swap partition. If your swap partition is on top of another filesystem layer, e.g., if it's encrypted (luks/dmcrypt), use the path in your fstab, which might differ from the above output:

# grep swap /etc/fstab
/dev/mapper/luks-123 swap                    swap    defaults,x-systemd.device-timeout=0 0 0

In this case, you might end up with something like: resume=/dev/mapper/luks-123

Add this parameter to the boot config template:
As root, edit /etc/default/grub (e.g., sudo vi ... or sudo gedit /etc/default/grub), find the line that starts with GRUB_CMDLINE_LINUX= and append the resume=... parameter at the end of the quote (before ").

Then, update the boot configuration based on this template, so that the parameter will be used from now on when the system is booting. The following command writes the boot configuration for BIOS systems. EFI systems have a different config file (see below). If you're not sure, make sure the file exists.

# grub2-mkconfig -o /boot/grub2/grub.cfg

EFI systems may use /boot/efi/EFI/fedora/grub.cfg. If your system is using that file, use:

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

This is the command you mentioned in your question, but as long as you don't update the ... (more)

edit flag offensive delete link more

Comments

This doesn't work for me: EFI system. Answer was on the Fedoraproject "Common F24 bugs" page. For completeness of answer should add to post above: sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg With the correct grub config the system will hibernate, on reboot the "recover" option on the default kernel will need to be selected from the grub menu. Thanks! Had never seen the 'swapon' command.

naifukinaifu gravatar imagenaifukinaifu ( 2016-12-17 09:35:09 -0600 )edit

@naifukinaifu: Good point, thanks. I've updated the answer. However, you shouldn't have to select anything manually, as you're only updating the boot parameters, not adding a new boot option.

basic6 gravatar imagebasic6 ( 2016-12-20 08:05:23 -0600 )edit

Thanks for the great how-to! I followed your instructions and it works well. There is one thing i did differently: I used the device from fstab instead of the output of swapon -s in the resume= parameter. (Do cat /etc/fstab, look for the line containing swap.) So I have resume=/dev/mapper/... instead of resume=/dev/dm-2 (Swap partition on encrypted LUKS volume)

mightyflea gravatar imagemightyflea ( 2016-12-23 07:01:00 -0600 )edit

@mightyflea: Thanks for the comment. I've added a note.

basic6 gravatar imagebasic6 ( 2016-12-23 09:12:43 -0600 )edit

It works fine on Fedora 25 too. Thanks basic6

konrad_lorenz gravatar imagekonrad_lorenz ( 2017-08-24 18:32:17 -0600 )edit
0

answered 2016-11-06 18:35:37 -0600

TWTOoth gravatar image

Hibernate in fedora has an error or a bug or something its common it doesn't work you can use the command

$ systemctl suspend

should work just fine

edit flag offensive delete link more

Comments

I already know about suspend, but I need hibernate, and not suspend. Anyway, if you are saying that its a common bug, (and not just for me) so its alright. and btw, hibernate, it depends on the DE I have, right ? (for example, if I have fedora, but with kde DE (or xfce, etc.. - and not gnome) so it different, and may work, right ?)

noammo gravatar imagenoammo ( 2016-11-06 23:50:18 -0600 )edit

That's not a helpful answer: "[it] has an error or a bug or something" and then mentioning a command to suspend the system. It doesn't answer the question at all.

basic6 gravatar imagebasic6 ( 2016-12-01 05:41:35 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-06 13:14:23 -0600

Seen: 15,948 times

Last updated: Dec 23 '16