I can't make my Ubuntu 18.04 hibernate (I tried use both swap file and swap partion, nothing works)

5,539

Look at your /etc/initramfs-tools/conf.d/resume file. It should contain the UUID of your swap partition, like so:

RESUME=UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b # use your own correct UUID

To identify the correct UUID to use:

sudo blkid # to display your UUIDs

Look for a line similar to this:

/dev/sda8: UUID="071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b" TYPE="swap" PARTUUID="d042d9f3-dfe7-4ba9-bbc8-efe6413e7fa4" # your UUID will be different

Then perform:

sudo update-initramfs -c # to create a fresh initramfs image file

reboot # to reboot the computer

Now retest hibernate.

Share:
5,539

Related videos on Youtube

mathmd
Author by

mathmd

An aspiring applied mathematician.

Updated on September 18, 2022

Comments

  • mathmd
    mathmd over 1 year

    As the title suggest.

    I've already tried sudo pm-hibernate, sudo systemctl hibernate, sudo s2disk all of them did nothing and just freeze on input in the terminal, except sudo systemctl hibernate which seems to shutdown the system instantly but fail to resume after start the machine back up again.

    I had 8 Gb RAM, 9 Gb Swap partition, when I first tried and I've already added resume parameter in /etc/default/grub. And failed after I tried to hibernate as I described above.

    After that I tried use swap file instead of swap partition to hibernate by creating a 5 Gb swap file (I heard that I only need at least half the size of my RAM) and then add the parameter resume_offset to the GRUB_CMDLINE_LINUX_DEFAULT the same way as I did with resume.

    I also add the following to /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

    [Re-enable hibernate by default in upower]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes
    
    [Re-enable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate
    ResultActive=yes
    

    and also edit the following (changing from yes to no in the ResultActive both section) in /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla:

    [Disable hibernate by default in upower]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=no
    
    [Disable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
    ResultActive=no
    

    Note that when I use sudo pm-hibernate I only have pm-utils installed. And when I used sudo s2disk I uninstall pm-utils before reinstall uswsusp then run the command like this

    sudo dpkg-reconfigure -pmedium uswsusp
    

    before sudo s2disk and then again nothings happened

    what did I do wrong? I don't know what else I should try.

  • mathmd
    mathmd about 6 years
    Ok now there's RESUME=UUID=592d80c6-6112-4602-95f7-47f80d67e0e8, which is the UUID of my swap partition in my /etc/initramfs-tools/conf.d/resume Then I ran sudo update-initramfs -c -k 4.15.0-20-generic then reboot and test hibernation with sudo systemctl hibernate (with uswsusp and pm-utils purged) ..well it didn't hibernate but it turns into the Screen Lock instead
  • Boris Hamanov
    Boris Hamanov about 6 years
    @AidenBhe did hibernate work in 17.10? From your update-initramfs command, you're running kernel 4.15.0-20-generic, yes? Hibernate is normally disabled in Ubuntu for operational reliability issues, and may never work on your computer. However, have you checked for a BIOS update?
  • Boris Hamanov
    Boris Hamanov about 6 years
    @AidenBhe you may have to edit /etc/default/grub and find the quiet splash line and add something like resume=/dev/sda8 or resume=UUID=592d80c6-6112-4602-95f7-47f80d67e0e8 and then sudo update-grub, reboot and retest.
  • mathmd
    mathmd about 6 years
    Thank you for a quick reply. I've already done that here's the lines in /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=592d80c6-6112-4602-95f7-47f80d67e0e8" GRUB_CMDLINE_LINUX="" and yes 4.15.0-20-generic is my kernel version. I haven't thought about flashing BIOS though I'll try that and let you know!
  • mathmd
    mathmd about 6 years
    By "window manager" did you mean from GNOME? Because from my desktop I don't have any Hibernation Button in the status menu when I recently installed Ubuntu 18.04. But I did add a GNOME extension to have the button in the status menu though and it did the same thing when I sudo systemctl hibernate
  • mathmd
    mathmd about 6 years
    And also I just returned to Ubuntu recently so I haven't use 17.04 or 17.10 before.
  • Adriano dos Santos Fernandes
    Adriano dos Santos Fernandes almost 6 years
    It works for me, but the wired network is always down after restore, and I cant make it up until restart.