My System fail to resume from hibernate

Sometime I cannot resume from my hibernate session and loss all my progress. Anyone knows how to fix this?

journalctl -rb -1 | grep -i -E "sleep|resume|hibernate|systemd-hibernate"
10月 26 04:26:18 linux-desktop systemd-sleep[74799]: Performing sleep operation 'hibernate'...
10月 26 04:26:18 linux-desktop systemd-sleep[74799]: in suspend-then-hibernate operations or setups with encrypted home directories.
10月 26 04:26:18 linux-desktop systemd-sleep[74799]: This is not recommended, and might result in unexpected behavior, particularly
10月 26 04:26:18 linux-desktop systemd-sleep[74799]: User sessions remain unfrozen on explicit request ($SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=0).
10月 26 04:26:18 linux-desktop systemd[1]: Starting System Hibernate...
10月 26 04:26:18 linux-desktop systemd[1]: nvidia-hibernate.service: Consumed 1.391s CPU time, 1.9G memory peak.
10月 26 04:26:18 linux-desktop systemd[1]: Finished NVIDIA system hibernate actions.
10月 26 04:26:18 linux-desktop systemd[1]: nvidia-hibernate.service: Deactivated successfully.
10月 26 04:26:17 linux-desktop logger[74734]: <13>Oct 26 04:26:17 hibernate: nvidia-hibernate.service
10月 26 04:26:17 linux-desktop hibernate[74734]: nvidia-hibernate.service
10月 26 04:26:17 linux-desktop systemd[1]: Starting NVIDIA system hibernate actions...
10月 26 04:26:17 linux-desktop systemd[1]: Reached target Sleep.
10月 26 04:26:16 linux-desktop NetworkManager[681]: <info>  [1761420376.6628] device (enp5s0): state change: disconnected -> unmanaged (reason 'unmanaged-sleeping', managed-type: 'full')
10月 26 04:26:16 linux-desktop NetworkManager[681]: <info>  [1761420376.6302] device (enp5s0): state change: deactivating -> disconnected (reason 'sleeping', managed-type: 'full')
10月 26 04:26:16 linux-desktop kwin_wayland[1121]: Failed to delay sleep: Sender is not authorized to send message
10月 26 04:26:16 linux-desktop NetworkManager[681]: <info>  [1761420376.6054] device (enp5s0): state change: activated -> deactivating (reason 'sleeping', managed-type: 'full')
10月 26 04:26:16 linux-desktop NetworkManager[681]: <info>  [1761420376.6052] manager: NetworkManager state is now ASLEEP
10月 26 04:26:16 linux-desktop NetworkManager[681]: <info>  [1761420376.6051] manager: sleep: sleep requested (sleeping: no  enabled: yes)
10月 26 04:26:16 linux-desktop systemd-logind[685]: The system will hibernate now!
10月 26 03:41:03 linux-desktop kwin_wayland[1121]: Failed to delay sleep: Sender is not authorized to send message
10月 26 03:00:23 linux-desktop kwin_wayland[1121]: Failed to delay sleep: Sender is not authorized to send message

why the above ENV variable and reverse order?
I would use
systemctl hibernate
first and then after waiting for all leds are off reboot and show us
journalctl -b -u systemd-hibernate.service

Does not have entries when using systemctl hibernate

[daniel@daniel-desktop ~]$ sudo journalctl -b -u systemd-hibernate
– No entries –

However, I saw something new during resume, it says HibernationLocation system identifier does not match

From my lsblk -f, it is correct and offset also correct

nvme0n1
├─nvme0n1p1 vfat FAT32 9BAC-2533 2G 0% /boot/efi
└─nvme0n1p2 ext4 1.0 endeavouros c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 1.5T 13% /

How to further investigate the problem?

Here:
less /usr/lib/systemd/system/systemd-hibernate.service

[Unit]
Description=System Hibernate
Documentation=man:systemd-hibernate.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target

[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/systemd-sleep hibernate
#—
systemctl status systemd-hibernate
○ systemd-hibernate.service - System Hibernate
Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate.service; static)
Active: inactive (dead)
Docs: man:systemd-hibernate.service(8)

Oct 26 15:15:49 a-83k7 systemd[1]: Finished System Hibernate.
Oct 26 15:15:49 a-83k7 systemd[1]: systemd-hibernate.service: Consumed 2.603s CPU time, 2.4M memory peak.
Oct 26 15:16:01 a-83k7 systemd[1]: Starting System Hibernate…
Oct 26 15:16:01 a-83k7 systemd-sleep[4328]: Successfully froze unit ‘user.slice’.
Oct 26 15:16:01 a-83k7 systemd-sleep[4328]: Performing sleep operation ‘hibernate’…
Oct 26 15:16:57 a-83k7 systemd-sleep[4328]: System returned from sleep operation ‘hibernate’.
Oct 26 15:16:57 a-83k7 systemd-sleep[4328]: Successfully thawed unit ‘user.slice’.
Oct 26 15:16:57 a-83k7 systemd[1]: systemd-hibernate.service: Deactivated successfully.
Oct 26 15:16:57 a-83k7 systemd[1]: Finished System Hibernate.
Oct 26 15:16:57 a-83k7 systemd[1]: systemd-hibernate.service: Consumed 2.509s CPU time, 2.2M memory peak

Maybe I’m not didactic enough but do you use swapfile? (The offset is high.) I use swap partition.
cat /etc/fstab

A bottom up approach.

this is my systemd.service catch by less /usr/lib/systemd/system/systemd-hibernate.service

[Unit]
Description=System Hibernate
Documentation=man:systemd-hibernate.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target

[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/systemd-sleep hibernate

[daniel@daniel-desktop system]$ systemctl status systemd-hibernate
○ systemd-hibernate.service - System Hibernate
Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate.service; stati>
Drop-In: /usr/lib/systemd/system/systemd-hibernate.service.d
└─10-nvidia-no-freeze-session.conf
Active: inactive (dead)
Docs: man:systemd-hibernate.service(8)

Yes, I used a swapfile instead of swap partition, since I would like to dynamically change my swap size.

[daniel@daniel-desktop system]$ cat /etc/fstab

UUID=9BAC-2533 /boot/efi vfat fmask=0137,dmask=0027 0 2
UUID=c0f5f7b1-0bbc-4558-80e4-0ec8811b8904 / ext4 noatime 0 1
/swapfile none swap defaults 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

UUID=6218CD0118CCD567 /mnt/c ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=443290E33290DB6E /mnt/d ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=8C242499242487F2 /mnt/Storage_I ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=4E64F49A64F4864D /mnt/Storage_S ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=380AB82C0AB7E552 /mnt/Storage_U ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=1470FF9070FF7738 /mnt/ADATA_HD710 ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=CE528CC9528CB7AB /mnt/ADATA_HD710_2 ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0
UUID=48827A49827A3C0E /mnt/My_Passport ntfs-3g defaults,nofail,rw,exec,uid=1000,gid=1000,umask=022 0 0

I got tons of drives in my PC, but my system is a separated SSD, which my swapfile is “/swapfile”

I got 64GB ram, and a 80GB swapfile, in some situation, I can use 40GB ram before hibernate, but usually around 16GB

In addition, I found that my system sometimes marked as nvme0n1, or nvme1n1 which seems not stable, will this related to my hibernation fail? If so, how to ensure they got the specific name?

IDK.
There is a warning
HibernateLocation system identifier doesn't match currently running system, would not resume from it.
So a swapoff swapon are needed See: https://wiki.archlinux.org/title/Swap

Possibly related to this topic.

I tried few times, and found that even appear this message, it often able to resume, so I guess this may not the root of the problem

This is the log for hibernate service, the hibernate in 27 02:19:06 and resume in 27 09:03:57 is failed, but in 28, resume from hibernation success. However, from log, I am not able to see the reason

[daniel@daniel-desktop ~]$ journalctl -b -u systemd-hibernate.service
10月 27 02:19:06 daniel-desktop systemd[1]: Starting System Hibernate…
10月 27 02:19:06 daniel-desktop systemd-sleep[27734]: User sessions remain unfrozen on explicit request ($SYSTEMD_SLEEP_FREEZE>
10月 27 02:19:06 daniel-desktop systemd-sleep[27734]: This is not recommended, and might result in unexpected behavior, partic>
10月 27 02:19:06 daniel-desktop systemd-sleep[27734]: in suspend-then-hibernate operations or setups with encrypted home direc>
10月 27 02:19:06 daniel-desktop systemd-sleep[27734]: Performing sleep operation ‘hibernate’…
10月 27 09:03:57 daniel-desktop systemd-sleep[27734]: System returned from sleep operation ‘hibernate’.
10月 27 09:03:58 daniel-desktop systemd[1]: systemd-hibernate.service: Deactivated successfully.
10月 27 09:03:58 daniel-desktop systemd[1]: Finished System Hibernate.
10月 27 09:03:58 daniel-desktop systemd[1]: systemd-hibernate.service: Consumed 27.161s CPU time, 2.1G memory peak.
10月 28 02:34:56 daniel-desktop systemd[1]: Starting System Hibernate…
10月 28 02:34:56 daniel-desktop systemd-sleep[123822]: User sessions remain unfrozen on explicit request ($SYSTEMD_SLEEP_FREEZ>
10月 28 02:34:56 daniel-desktop systemd-sleep[123822]: This is not recommended, and might result in unexpected behavior, parti>
10月 28 02:34:56 daniel-desktop systemd-sleep[123822]: in suspend-then-hibernate operations or setups with encrypted home dire>
10月 28 02:34:56 daniel-desktop systemd-sleep[123822]: Performing sleep operation ‘hibernate’…
10月 28 08:57:18 daniel-desktop systemd-sleep[123822]: System returned from sleep operation ‘hibernate’.
10月 28 08:57:19 daniel-desktop systemd[1]: systemd-hibernate.service: Deactivated successfully.
10月 28 08:57:19 daniel-desktop systemd[1]: Finished System Hibernate.
10月 28 08:57:19 daniel-desktop systemd[1]: systemd-hibernate.service: Consumed 29.112s CPU time, 1.9G memory peak.
lines 1-18/18 (END)