You are not logged in.

#1 2024-03-09 14:51:28

amemeida
Member
Registered: 2024-03-09
Posts: 2

System cannot hibernate or hybrid-sleep due to Invalid Argument

Hi

I have 16GB of RAM and a 17GB swapfile configured in both fstab and kernel parameters.
The system always errors when trying to hibernate, both with or without secure boot, as follows:

# systemctl hibernate
Call to Hibernate failed: Invalid argument
# systemctl status systemd-hibernate.service
× systemd-hibernate.service - System Hibernate
     Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate.service; static)
     Active: failed (Result: exit-code) since Sat 2024-03-09 11:20:18 -03; 4min 11s ago
       Docs: man:systemd-hibernate.service(8)
    Process: 1841 ExecStart=/usr/lib/systemd/systemd-sleep hibernate (code=exited, status=1/FAILURE)
   Main PID: 1841 (code=exited, status=1/FAILURE)
        CPU: 3ms

Mar 09 11:20:18 txz systemd[1]: Starting System Hibernate...
Mar 09 11:20:18 txz systemd-sleep[1841]: Failed to find location to hibernate to: Invalid argument
Mar 09 11:20:18 txz systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
Mar 09 11:20:18 txz systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
Mar 09 11:20:18 txz systemd[1]: Failed to start System Hibernate.

The swapiness is set to 10 and the swap space is almost always completely empty. None of the error messages cite insuficient storage as a reason for the failure.

Relevant system configurations:

  • dracut

  • LUKS encrypted partition

  • BTRFS

  • Unified Kernel Image with stub loader

  • linux-zen and linux UKI (same problem on both)

  • hybrid graphics (nvidia discrete graphics and intel integrated)

As I'm using BTRFS, dracut and LUKS, the swapfile lives in a @swap subvolume.
This is my main dracut configuration:

hostonly=yes
hostonly_cmdline=yes
compress=zstd
show_modules=yes

add_dracutmodules+=" tpm2-tss resume "

force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "

CMDLINE=(
    rd.driver.pre=btrfs
    rd.luks.name=53cb9af5-0b8f-4f88-a5c0-de83be3fa325=root
    rd.luks.options=53cb9af5-0b8f-4f88-a5c0-de83be3fa325=tpm2-device=auto
    root=/dev/mapper/root
    rootfstype=btrfs
    rootflags=rw,noatime,compress=zstd:3,ssd,space_cache=v2,subvolid=264,subvol=/@
    resume=UUID=49951f64-0113-43e3-aa39-a51ae50bfe3d
    resume_offset=4728064
    nvme_load=YES
    rw
    nowatchdog
    nvidia-drm.modeset=1
    quiet
)

kernel_cmdline="${CMDLINE[*]}"
unset CMDLINE

I got the offset as follows, by specified on the wiki

# btrfs inspect-internal map-swapfile -r /swap/swapfile
4728064

The swapfile itself was created as by the the wiki;

53cb9af5-0b8f-4f88-a5c0-de83be3fa325 is the UUID of the LUKS encrypted partition
49951f64-0113-43e3-aa39-a51ae50bfe3d is the UUID of the unlocked BTRFS main filesystem where everything lives. It is mapped to /dev/mapper/root by luks

I also tried setting resume to /dev/mapper/root and got the same result

The @swap subvolume is mounted to /swap by fstab.
System swap works perfectly, just as intented.

fstab swap section:

# /dev/mapper/root UUID=49951f64-0113-43e3-aa39-a51ae50bfe3d
/dev/mapper/root    /swap     btrfs     rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=266,subvol=/@swap    0 0

/swap/swapfile      none      swap      defaults  0 0

the discrete GPU is configured to power down when not used by fine-grained D3
I have the following nvidia systemctl services enabled:

  • nvidia-resume.service

  • nvidia-persistenced.service

  • nvidia-suspend.service

nvidia-powerd.service is disabled

None of the nvidia services seem to error in journalctl

Any advice on what I could do to make hibernation and hybrid sleep work?
If any more information is needed, just let me know.

Last edited by amemeida (2024-03-09 15:04:48)

Offline

#2 2024-03-21 19:17:34

Corax
Member
Registered: 2013-08-06
Posts: 31

Re: System cannot hibernate or hybrid-sleep due to Invalid Argument

FWIW my hibernation setup stopped working after I upgraded mkinitcpio to v38. I then stumbled upon https://wiki.archlinux.org/title/Power_ … _initramfs, which suggests that from systemd 255 + mkinitcpio 38 there is no need to pass resume= to the kernel any more. Turns out removing it from my command line made hibernation work again! It doesn't sound like that's how it should be, but well, that was an easy fix.

Offline

Board footer

Powered by FluxBB