Slow wake up from Suspend & Won't Hibernate

On a fresh install of EOS + i3 on my new Dell laptop when I close the laptop lid and then reopen it a few seconds later the screen is blank/off for a few seconds, then a frozen image of the DE the moment I closed the laptop is displayed. Completely unresponsive, cursor doesn’t move and a hard reset is required.

I followed the instructions here How to configure suspend-then-hibernate properly? - #3 by kagetora13 to set up suspend-then-hibernate as I thought maybe no hibernation or suspend functionality was configured out the box for EOS. However i’m still having exactly the same issue.

Here’s the last few lines from the log file

May 27 18:55:40 inspiron-5425 systemd[1]: Reached target Sleep.
May 27 18:55:40 inspiron-5425 systemd[1]: Starting System Suspend...
May 27 18:55:40 inspiron-5425 systemd-sleep[18521]: Entering sleep state 'suspend'...

Where do I go from here? Thanks

Some more information:

/etc/systemd/sleep.conf
[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#Suspend then Hibernate after 15 min
HibernateDelaySec=15min
/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=UUID=xxx root=/dev/mapper/luks-4xxx 
resume=UUID=xxx resume_offset=2247940 loglevel=3 nowatchdog nvme_load=YES"

sudo swapon -s
Filename				Type		Size		Used		Priority
/swap/swapfile                          file		16383996	0		-2

I might not be able to offer much help with this issue but I wonder if you did try to just suspend or hibernate “separately” to see if they work as intended:

systemctl suspend

systemctl hibernate

Try one at a time to see if they effectively suspend or hibernate and then the system will wake up as it should afterwards.

sudo systemctl hibernate
Failed to hibernate system via logind: Not enough swap space for hibernation

With systmctl suspend same thing as before, frozen screen. However I’ve now discovered if I leave it 1 minute the laptop suddenly comes back to life and the screen updates.

Looks like there’s two separate issues going on here, hibernation swap issue and slow wake up from suspend. The jump between 20:53 to 20:55 is where the screen is frozen and i’m waiting for the laptop to come back to life.

May 27 20:53:52 inspiron-5425 systemd[1]: Reached target Sleep.
May 27 20:53:52 inspiron-5425 systemd[1]: Starting System Suspend...
May 27 20:53:52 inspiron-5425 systemd-sleep[136930]: Entering sleep state 'suspend'...
May 27 20:53:52 inspiron-5425 kernel: PM: suspend entry (s2idle)
May 27 20:53:52 inspiron-5425 kernel: Filesystems sync: 0.007 seconds
May 27 20:53:52 inspiron-5425 wpa_supplicant[628]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
May 27 20:53:52 inspiron-5425 wpa_supplicant[628]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
May 27 20:53:52 inspiron-5425 wpa_supplicant[628]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
May 27 20:55:03 inspiron-5425 kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
May 27 20:55:03 inspiron-5425 kernel: OOM killer disabled.
May 27 20:55:03 inspiron-5425 kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
May 27 20:55:03 inspiron-5425 kernel: printk: Suspending console(s) (use no_console_suspend to debug)
1 Like

This delay occurs on two laptops around here as well one Intel-based the other AMD-based.

It takes a short while for the system to wake up completely after suspension though the screen is on and I can see the desktop.

But this

needs definitely a bit more looking-into. By the looks of it you have set up everything “by the book”.

Let’s wait for other forum members to chime in.

Cheers, yeah I can live with a 1 minute wake up from suspend for now, it’s not the end of the world. Hopefully I can fix the hibernation for a semi workable system. I’ll try increasing the size of the swap file first, it’s 16GB and I’ve got 16GB ram.

1 Like

you can try decreasing the size of /sys/power/image_size, even with less than system ram sized swap you usually can hibernate.

look here

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

1 Like

Thanks for the suggestion. /sys/power/image_size is 6427271168, which I assume is bytes, so 6.4GB. In which case I assume the 17GB swap_file I now have is more than enough?

I’m using btrfs and a swap file, I assume the issue is somewhere there.

oh… well yeah thats very possibly related :smile:

Well i’m making progress. Didn’t realise I had to regenerate the grub.cfg as stated here https://wiki.archlinux.org/title/GRUB#Generated_grub.cfg

With that hibernation now starts, screen goes black for a few seconds, comes on again then the laptop powers down. On powering up, going through the grub menu again and logging in none of my environment has been saved and it looks like a fresh login.

May 28 01:21:55 inspiron-5425 systemd[1]: Reached target Sleep.
May 28 01:21:55 inspiron-5425 systemd[1]: Starting Hibernate...
May 28 01:21:55 inspiron-5425 kernel: PM: Image not found (code -16)
May 28 01:21:55 inspiron-5425 systemd-sleep[2853]: Entering sleep state 'hibernate'...
May 28 01:21:55 inspiron-5425 kernel: PM: hibernation: hibernation entry
May 28 01:21:55 inspiron-5425 wpa_supplicant[634]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
May 28 01:21:55 inspiron-5425 wpa_supplicant[634]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
May 28 01:21:55 inspiron-5425 wpa_supplicant[634]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0

looks like some special care needs to be taken with BTRFS swap

Hibernation into swap file on Btrfs

The resume_offset number can be computed using the tool btrfs_map_physical.c. Do not try to use the filefrag tool, on Btrfs the “physical” offset you get from filefrag is not the real physical offset on disk; there is a virtual disk address space in order to support multiple devices. [3]

Download or copy the tool btrfs_map_physical.c into a file named btrfs_map_physical.c, then compile it,

$ gcc -O2 -o btrfs_map_physical btrfs_map_physical.c

and run it. An example output is shown below.

./btrfs_map_physical /path/to/swapfile

FILE OFFSET EXTENT TYPE LOGICAL SIZE LOGICAL OFFSET PHYSICAL SIZE DEVID PHYSICAL OFFSET 0 regular 4096 2927632384 268435456 1 4009762816 4096 prealloc 268431360 2927636480 268431360 1 4009766912 268435456 prealloc 268435456 3251634176 268435456 1 4333764608 536870912 prealloc 268435456 3520069632 268435456 1 4602200064 805306368 prealloc 268435456 3788505088 268435456 1 4870635520 1073741824 prealloc 268435456 4056940544 268435456 1 5139070976 1342177280 prealloc 268435456 4325376000 268435456 1 5407506432 1610612736 prealloc 268435456 4593811456 268435456 1 5675941888

Note the the first physical offset returned by this tool. In this example, we use 4009762816. Also note the pagesize that can be found with getconf PAGESIZE.

To compute the resume_offset value, divide the physical offset by the pagesize. In this example, it is 4009762816 / 4096 = 978946.

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file_on_Btrfs

Thanks, I’ve done all that already however i’m going over it again and double checking everything.

cat /proc/cmdline
BOOT_IMAGE=/@/boot/vmlinuz-linux 
root=UUID=XXX rw rootflags=subvol=@ 
cryptdevice=UUID=XXX
root=/dev/mapper/luks-XXX 
resume=UUID=XXX 
resume_offset=2247940 
loglevel=3 nowatchdog nvme_load=YES

Solved the no hibernation issue! I had to regenerate the initramfs which I had somehow missed the first time around. https://wiki.archlinux.org/title/Regenerate_the_initramfs

Does it make a difference where you place resume in the HOOKS var? I placed mine before filesystems?

HOOKS="base udev autodetect modconf block keyboard keymap consolefont encrypt resume filesystems"

The 1 minute wake up time from suspend is still happening, but I’m just going to leave that for now, got other issues to solve (audio, display)

Sorry for the necro- bump, but this instantly clarified the matter with this system that is not using a swap partition.