Score:0

Failed to hibernate on ubuntu 22.04

pw flag

In my previous Kubuntu system I was able to hibernate, but with 22.04 I am unable. My output for grub:

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=4ff9741-2dc2-4f32-96e3-9b574a7f2739 resume_offset=34818 quiet splash"
GRUB_CMDLINE_LINUX=""

Then my output for fstab, specifically the section for swap:

swap was on /dev/sda4 during installation
UUID=14ff9741-2dc2-4f32-96e3-9b574a7f2739 none swap    sw  0       0

the output of /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;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes

[Enable hibernate to be run via cron]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=yes

Now when I do df -h:

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           785M  2.3M  783M   1% /run
/dev/sda2        24G   14G  8.5G  62% /
tmpfs           3.9G  3.6M  3.9G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/sda3       211G  140G   61G  70% /home
/dev/sda1       140M   22M  118M  16% /boot/efi
tmpfs           785M   13M  773M   2% /run/user/1000

Swap is supposed to be visible under sda4 with 17gb after I gparted it to increase its size. Lastly, if I do systemctl hibernate I have this error "Failed to hibernate system via logind: Not enough swap space for hibernation"

I really like the option to hibernate as it really save tons of battery and extend the durability of the battery. I also live in a country where shortage of electricity are common.

EDIT Output of swap -s

Filename                Type        Size        Used    Priority
/dev/sda4                               partition   17746940    0   -2
Pilot6 avatar
cn flag
Please add output of `swapon -s` command.
Pilot6 avatar
cn flag
And can you see that you have different UUID in grub and fstab? And what is `res>` there?
pw flag
Ah, that might be the cause... I will try it in 15 mints. I have inserted the swap -s output.
pw flag
I fixed the UUID of the swap however, when I systemctl hibernate, Ubuntu does not restore the previous session rather it kicks a brand new one. In the meantime I also removed the res> which was resume_offset=34818 but with no luck still.
nobody avatar
gh flag
maybe stupid question after altering /etc/default/grub did you run `sudo update-grub` afterwards?
pw flag
Thanks all for the comments. Indeed I found the solution thanks to you all. I will provide the full answer today after work. The issue was the UUID wrong name across the difference places.
Score:0
pw flag

I was able to find a solution thanks to Pilot6 - I leave this solution ticked with Community Wiki so that he can get recognition. Indeed Fstab and Grub had different UUID leading to an identity crisis.

  1. I found the correct name of the swap via the command cat /etc/fstab

  2. then edited the sudo nano /etc/default/grub like this: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=14ff9741-2dc2-4f32-96e3-9b574a7f2739 quiet splash" and updated sudo update-grub.

  3. I edited: sudo nano /etc/initramfs-tools/conf.d/resume with RESUME=UUID=14ff9741-2dc2-4f32-96e3-9b574a7f2739 and updated it sudo update-initramfs -u

Finally I modified the laptop behavior here sudo nano /etc/systemd/logind.conf: by uncommenting HandleLidSwitch=hibernate & HandleLidSwitchExternalPower=hibernate

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.