Issue with hibernate using xfce

Hello, I am having an issue. I tried setting up hibernate when my laptop lid is closed. Here are the settings.

When I open the lid nixos boots back up rather than resuming.

I found the related logs in journalctl -r.

Dec 12 08:51:20 n2 kernel: x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256'
Dec 12 08:51:20 n2 kernel: x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask'
Dec 12 08:51:20 n2 kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
Dec 12 08:51:20 n2 kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
Dec 12 08:51:20 n2 kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
Dec 12 08:51:20 n2 kernel: x86/split lock detection: warning about user-space split_locks
Dec 12 08:51:20 n2 kernel: Command line: initrd=\efi\nixos\9pzhkk8cpgl9yii33yx3sypqjbyj295y-initrd-linux-5.9.11-initrd.efi systemConfig=/nix/store/qqswaqqndkwjcvaqnczc7w5yqcw5lnlg-nixos-sys>
Dec 12 08:51:20 n2 kernel: Linux version 5.9.11 (nixbld@localhost) (gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.31.1) #1-NixOS SMP Tue Nov 24 12:39:15 UTC 2020
-- Reboot --
Dec 11 22:48:58 n2 kernel: PM: hibernation: hibernation entry
Dec 11 22:48:58 n2 systemd-sleep[16060]: Suspending system...
Dec 11 22:48:58 n2 kernel: PM: Image not found (code -22)
Dec 11 22:48:58 n2 dbus-daemon[872]: [system] Rejected send message, 7 matched rules; type="method_call", sender=":1.23" (uid=1000 pid=1645 comm="/run/current-system/sw/bin/xfce4-power-mana>
Dec 11 22:48:58 n2 pkexec[16050]: john: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/nix/store/5prb2zpjzk0pvi4cwbs90qiifdpxjk9f-xfce4-power-manager-1.6.6/sbin/xfpm-power-ba>
Dec 11 22:48:58 n2 pkexec[16050]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Dec 11 22:48:58 n2 systemd[1]: Starting Hibernate...
Dec 11 22:48:58 n2 systemd[1]: Reached target Sleep.
Dec 11 22:48:58 n2 systemd[1]: Finished Pre-Sleep Actions.
Dec 11 22:48:58 n2 systemd[1]: pre-sleep.service: Succeeded.
Dec 11 22:48:58 n2 systemd[1]: Starting Pre-Sleep Actions...
Dec 11 22:48:56 n2 xserver-wrapper[1087]: (II) modeset(0): Modeline "1920x1200"x0.0  123.20  1920 1968 2000 2080  1200 1203 1209 1235 -hsync -vsync (59.2 kHz e)
Dec 11 22:48:56 n2 xserver-wrapper[1087]: (II) modeset(0): Modeline "1920x1200"x0.0  154.00  1920 1968 2000 2080  1200 1203 1209 1235 -hsync -vsync (74.0 kHz eP)
Dec 11 22:48:56 n2 xserver-wrapper[1087]: (II) modeset(0): Printing DDC gathered Modelines:
Dec 11 22:48:56 n2 xserver-wrapper[1087]: (II) modeset(0): EDID vendor "SHP", prod id 5323
Dec 11 22:48:55 n2 wpa_supplicant[1092]: wlp0s20f3: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-70 noise=9999 txrate=263300
Dec 11 22:48:55 n2 dbus-daemon[872]: [system] Rejected send message, 7 matched rules; type="method_call", sender=":1.23" (uid=1000 pid=1645 comm="/run/current-system/sw/bin/xfce4-power-mana>
Dec 11 22:48:55 n2 .xfdesktop-wrap[1632]: Failed to set the background '/nix/store/iw86sbad55jxgwpx1vwjr1apmzb8wcm0-xfdesktop-4.14.1/share/backgrounds/xfce/xfce-stripes.png': GDBus.Error:or>
Dec 11 22:48:55 n2 systemd-logind[871]: Lid closed.

Is there anything else I can post to see what the issue could be? There isn’t any logging of the hibernate process or any failure that I can see.

The computer is a dell xps 9300. My computer doesn’t have a swap partition. I chose to go with a swapfile similar to the way the ubuntu install had.

swapDevices = [                                                               
   {                                                                           
     device = "/swapfile";                                                     
     size = 34816;                                                             
   }                                                                           
 ];  

I have 16 gigs of ram so this should be big enough for it. I will try digging more into it to see if I can find something. Thanks!

I did find where the swap was setup. It seems to be good.

Dec 04 18:06:08 n2 systemd[1]: Starting Create list of static device nodes for the current kernel...
Dec 04 18:06:08 n2 systemd[1]: Starting Initialisation of swap device /swapfile...
Dec 04 18:06:08 n2 systemd[1]: Condition check resulted in File System Check on Root Device being skipped.
Dec 04 18:06:08 n2 systemd[1]: Starting Journal Service...
Dec 04 18:06:08 n2 systemd[1]: Starting Load Kernel Modules...
Dec 04 18:06:08 n2 systemd[1]: Starting Remount Root and Kernel File Systems...
Dec 04 18:06:08 n2 systemd[1]: Starting Coldplug All udev Devices...
Dec 04 18:06:08 n2 systemd[1]: Mounted Huge Pages File System.
Dec 04 18:06:08 n2 systemd[1]: Mounted POSIX Message Queue File System.
Dec 04 18:06:08 n2 systemd[1]: Mounted Kernel Debug File System.
Dec 04 18:06:08 n2 systemd[1]: Finished Create list of static device nodes for the current kernel.
Dec 04 18:06:08 n2 systemd[1]: Starting Create Static Device Nodes in /dev...
Dec 04 18:06:08 n2 systemd[1]: mkswap-swapfile.service: Succeeded.
Dec 04 18:06:08 n2 systemd[1]: Finished Initialisation of swap device /swapfile.
Dec 04 18:06:08 n2 kernel: EXT4-fs (nvme0n1p3): re-mounted. Opts: (null)
Dec 04 18:06:08 n2 systemd[1]: Finished Remount Root and Kernel File Systems.
Dec 04 18:06:08 n2 systemd[1]: Activating swap /swapfile...
Dec 04 18:06:08 n2 systemd[1]: Starting Load/Save Random Seed...
Dec 04 18:06:08 n2 systemd[1]: Finished Create Static Device Nodes in /dev.
Dec 04 18:06:08 n2 systemd[1]: Starting Rule-based Manager for Device Events and Files...
Dec 04 18:06:08 n2 systemd[1]: Finished Load/Save Random Seed.
Dec 04 18:06:08 n2 kernel: Adding 35651580k swap on /swapfile.  Priority:-2 extents:278 across:103333884k SSFS
Dec 04 18:06:08 n2 systemd[1]: Activated swap /swapfile.
Dec 04 18:06:08 n2 systemd[1]: Reached target Swap.
Dec 04 18:06:08 n2 systemd-journald[516]: Journal started
Dec 04 18:06:08 n2 systemd-journald[516]: Runtime Journal (/run/log/journal/85fff69c19c247e899cbbd094bc3c4ff) is 8.0M, max 390.0M, 382.0M free.
Dec 04 18:06:08 n2 swapon[524]: swapon: /swapfile: software suspend data detected. Rewriting the swap signature.

One thing that stands out to me is this message

Dec 12 08:51:20 n2 swapon[512]: swapon: /swapfile: software suspend data detected. Rewriting the swap signature.

What does rewriting the swap signature mean? Could it be removing the suspend data before it can be restored?

I found some help with this post.

First I added

boot.resumeDevice = "/dev/disk/by-uuid/efb2c8a0-169b-4d4f-b09f-f656f617a49e";

But in order to resume from a swap file the resume_offset kernel parameter needs to be set.

boot.kernelParams = [ "resume_offset=21317632" ];

The arch wiki provided details on how to get the offset of the swapfile.

To test this I opened some windows and mousepad with some text and then closed the laptop lid. When the lid is open the normal bootloader opens the kernel and it resumes from the swap file. All of the windows were still open correctly.

1 Like