Wednesday, December 16, 2015

Fedora 23 - Hibernate

Peace be upon you..
By default, Fedora 23 have suspend function but I still prefer to use hibernate function with my laptop. We need to add resume parameter to the default grub parameter.

First thing, we need to get UUID of swap partition from our computer. Let use blkid command:

$ sudo blkid | grep swap
/dev/mapper/fedora-swap: UUID="bt81a351-8421-1337-96ca-r9ab3605ff7c" TYPE="swap"

Then copy UUID code from you output (Don't copy my swap UUID partition example), which we gonna need that in next step. Now lets edit the default GRUB2 file located at /etc/default/grub

Open that GRUB2 file and find GRUB_CMDLINE_LINUX then, put resume=UUID parameter inside the quote such like this :

GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet resume=UUID=bt81a351-8421-1337-96ca-r9ab3605ff7c"

Now we need to rebuild the GRUB2 config file. Just run sudo grub2-mkconfig -o /boot/grub2/grub.cfg or if you have EFI feature with you computer, please run sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg command, make sure you know which command to execute.

Congratulation, now you have hibernate features enabled. If you are using Gnome desktop, I suggest you to install this wonderful, awesome and nice hibernate status button extension that adds a Hibernate button in status menu.

That all for now. Thanks :)

23 comments:

  1. Hi,

    Thanks for the article. I followed your steps. However, when I tried booting back post-hibernation all I could see was a blank screen.

    blkid | grep swap
    /dev/mapper/fedora-swap: UUID="a7178298-3fd4-4267-b8c6-f03a66792c78" TYPE="swap"

    cat /etc/default/grub
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT=saved
    GRUB_DISABLE_SUBMENU=true
    GRUB_TERMINAL_OUTPUT="console"
    GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet resume=UUID=a7178298-3fd4-4267-b8c6-f03a66792c78"
    GRUB_DISABLE_RECOVERY="true"

    Any pointers on how to debug this further?

    ReplyDelete
    Replies
    1. Have you check driver card are configure well or not? Did suspend working have same issue?
      Try to cross check graphic card model with hibernate / suspend issue on internet. Could be any hint for you..Most radeon card have this issue..

      Delete
  2. Hi Kriptonium

    I did on my Fedora 23 running on a Dell Latitude E4310 and it worked perfectly.
    Thank you for your tip.

    ReplyDelete
  3. hibernation works like a charm here on my desk. thanks, bro =)

    ReplyDelete
  4. thanks. Any idea why I need to do this manually? Seems that hibernate has been working for years (in Fedora) but not in Fedora 23...

    ReplyDelete
    Replies
    1. systemd are new and affected the services..even now, when laptop battery are critical point..the linux turn off it self! The upower configuration are override by systemd.. Hopefully, systemd will fix this soon!

      Delete
  5. I did on my Sony Vaio pro 13 and worked. Thanks...

    ReplyDelete
  6. Hello,
    I can not find the GRUB2 file it just a "grub" file.
    My grub file:
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT=saved
    GRUB_DISABLE_SUBMENU=true
    GRUB_TERMINAL_OUTPUT="console"
    GRUB_CMDLINE_LINUX="rhgb quiet"
    GRUB_DISABLE_RECOVERY="true"

    [[email protected] ~]# blkid | grep swap
    /dev/sda7: UUID="287e1b52-d752-492c-b3d7-687ebeb7e53f" TYPE="swap" PARTUUID="e681fe32-07"

    What should i do?
    And how i can rebuild the "grub" config file?
    What is EFI feature? How do i know that i have it?

    ReplyDelete
    Replies
    1. Hi there! Try this:
      sudo nano /etc/default/grub

      Then paste this configuration as below:
      GRUB_TIMEOUT="5"
      GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
      GRUB_DEFAULT="saved"
      GRUB_DISABLE_SUBMENU="true"
      #GRUB_TERMINAL_OUTPUT="console"
      GRUB_CMDLINE_LINUX="rhgb quiet resume=/dev/sda7"
      GRUB_DISABLE_RECOVERY="true"

      Saved that grub file and run :
      sudo grub2-mkconfig -o /boot/grub2/grub.cf

      Delete
    2. If you use UEFI, you should create the grub.cfg in the EFI folder as follows:
      sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

      Delete
  7. Using the swap's UUID wasn't working for me (boot was hanging for a minute and a half trying to locate it).
    Instead I used resume=/dev/*** , the swap partition shown in the first blkid command you give.

    ReplyDelete
  8. On a Dell Studio 1555 works great, thanks a lot. Would be great that Fedora 23 sove this issue, in past versions hibernate works fine.

    ReplyDelete
  9. Hi
    I am unable in installing hibernate status button extension. So how can i hibernate my fedora 23 without extension?

    ReplyDelete
    Replies
    1. Go into the Terminal enter the following command:
      systemctl hibernate

      Delete
    2. Thanks a lot :-)

      Delete
    3. Why you unable to install the extension ? Extension only can be installed via Firefox browser..

      Delete
  10. It can be done from GUI, using grub-customizer. If it's not installed, can be added using "sudo dnf install grub-customizer".

    ReplyDelete
  11. Can you check why my script does not resume hibernate?

    GRUB_TIMEOUT="10"
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT="saved"
    GRUB_DISABLE_SUBMENU="true"
    #GRUB_TERMINAL_OUTPUT="console"
    #GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet resume=UUID=39dc1dfa-5d42-42ac-a566-7cc0802f2a8e"
    GRUB_CMDLINE_LINUX="rhgb quiet resume=/dev/sda7"
    GRUB_DISABLE_RECOVERY="true"

    export GRUB_COLOR_NORMAL="black/yellow"
    export GRUB_COLOR_HIGHLIGHT="white/red"
    #GRUB_GFXMODE="saved"
    #GRUB_BACKGROUND="/usr/share/backgrounds/gnome/Road.jpg"
    #GRUB_THEME="/boot/grub2/themes/starfield/themes.txt"
    GRUB_THEME="/usr/share/grub/themes/supermario/theme.txt"

    GRUB_FONT="/boot/efi/EFI/fedora/unicode.pf2"

    ReplyDelete
    Replies
    1. You have two `GRUB_CMDLINE_LINUX`.
      The first one are comment with # so, that line won't be read. You new grub file should be like :

      GRUB_TIMEOUT="10"
      GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
      GRUB_DEFAULT="saved"
      GRUB_DISABLE_SUBMENU="true"
      GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet resume=UUID=39dc1dfa-5d42-42ac-a566-7cc0802f2a8e"
      GRUB_DISABLE_RECOVERY="true"

      export GRUB_COLOR_NORMAL="black/yellow"
      export GRUB_COLOR_HIGHLIGHT="white/red"
      GRUB_THEME="/usr/share/grub/themes/supermario/theme.txt"

      GRUB_FONT="/boot/efi/EFI/fedora/unicode.pf2"

      Delete
    2. Post here you `$ sudo blkid ` out, so I can know which partition and type that you use

      Delete