You are not logged in.
When I try to hibernate (i.e. systemctl hibernate) then my screen turns off for 1 second and is back on again.
Why doesn't it work? And how to interpret the image_size number?
cat /sys/power/image_size
6663536640
I created a swap file with 8 GB:
# fallocate -l 8G /swapfile
It is activated (and formatted and in fstab and with the right permissions):
swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 8G 0B -1
In my systemd boot entry I added:
options root=PARTUUID=b65ddffd-e9c4-4971-b70e-0bff87772fbf rw
resume=PARTUUID=b65ddffd-e9c4-4971-b70e-0bff87772fbf resume_offset=7462912
And in initramfs I also added resume.
Last edited by rgzfxf6bhu (2017-09-09 09:08:22)
Offline
For size, see wiki: https://wiki.archlinux.org/index.php/Po … Ffile_size
Offline
If I understand it correctly than I need at least 6.2 GB?
cat /sys/power/image_size
6663536640
6663536640/1024^3 = 6.2
But my swap file is 8 GB and hibernation is still not working.
Offline
There are many more reasons as to why hibernation might fail, and I'd harbor a guess that the swap partition size is almost never the reason for why it doesn't. Your hardware and/or kernel are much more likely to pose problems. Check your journal after a failed hibernation attempt
Offline
But I see following in the journal:
kernel: PM: thaw of devices complete after 246.994 msecs
kernel: PM: Writing image.
kernel: PM: Cannot find swap device, try swapon -a.
kernel: PM: Cannot get swap writer
...
systemd[1]: Failed to start Hibernate.
I am surprised why the swap device cannot be found!? Because when I use swapon --show I see it:
swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 8G 0B -1
Last edited by rgzfxf6bhu (2017-09-07 09:18:35)
Offline
did you run mkswap on your swapfile?
https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...
Offline
In my systemd boot entry I added...
And have you rebooted since those changes?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
did you run mkswap on your swapfile?
Yes I did, and I tried it again. But still no success.
And have you rebooted since those changes?
Yes, several times already. My dmesg seems fine!?
dmesg | grep swap
[ 0.851873] zswap: loaded using pool lzo/zbud
[ 1.882871] Adding 8388604k swap on /swapfile. Priority:-1 extents:57 across:21528572k SSFS
Seems that the Cannot find swap device error is not persistent. Now I get a Swap header not found!.
kernel: xhci_hcd 0000:05:00.0: xHCI host controller not responding, assume dead
kernel: xhci_hcd 0000:05:00.0: HC died; cleaning up
kernel: rtc_cmos 00:01: System wakeup disabled by ACPI
kernel: PM: thaw of devices complete after 175.307 msecs
kernel: PM: Writing image.
kernel: PM: Using 3 thread(s) for compression.
PM: Compressing and saving image data (672399 pages)...
kernel: PM: Image saving progress: 0%
kernel: PM: Image saving progress: 10%
kernel: [drm] RC6 on
kernel: PM: Image saving progress: 20%
kernel: PM: Image saving progress: 30%
kernel: PM: Image saving progress: 40%
kernel: PM: Image saving progress: 50%
kernel: PM: Image saving progress: 60%
kernel: PM: Image saving progress: 70%
kernel: PM: Image saving progress: 80%
kernel: PM: Image saving progress: 90%
kernel: PM: Image saving progress: 100%
kernel: PM: Image saving done.
kernel: PM: Wrote 2689596 kbytes in 2.74 seconds (981.60 MB/s)
kernel: PM: S
kernel: PM: Swap header not found!
kernel: |
kernel: PM: Basic memory bitmaps freed
And at the same time a failed dependency for Hibernate:
systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAI
systemd[1]: Failed to start Hibernate.
systemd[1]: Dependency failed for Hibernate.
systemd-logind[294]: Operation 'sleep' finished.
systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependen
systemd[1]: sleep.target: Unit not needed anymore. Stopping.
systemd[1]: systemd-hibernate.service: Unit entered failed state.
systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
systemd[1]: Stopped target Sleep.
Offline
filefrag /swapfile
Offline
@seth: I used filefrag to determine the resume_offset in my systemd boot entry.
Is that what you meant?
filefrag /swapfile
/swapfile: 57 extents found
I used the -v option before:
sudo filefrag -v /swapfile
[sudo] password for brunno:
Filesystem type is: ef53
File size of /swapfile is 8589934592 (2097152 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 7462912.. 7462912: 1:
1: 1.. 30719: 7462913.. 7493631: 30719: unwritten
2: 30720.. 61439: 7493632.. 7524351: 30720: unwritten
......................................................................
......................................................................
......................................................................
So I only use the first physical_offset as resume_offset in systemd boot.
Last edited by rgzfxf6bhu (2017-09-07 16:25:19)
Offline
Is it even possible in Arch to have the swap file on the root?
This is what I use in systemd boot:
options root=PARTUUID=b65ddffd-e9c4-4971-b70e-0bff87772fbf rw
resume=PARTUUID=b65ddffd-e9c4-4971-b70e-0bff87772fbf resume_offset=7462912
I was wondering because I found this about Ubuntu with swsusp.
The hibernation implementation currently used in Ubuntu, swsusp, needs a swap or suspend partition. It cannot use a swap file on an active file system.
https://help.ubuntu.com/community/SwapFaq
Last edited by rgzfxf6bhu (2017-09-07 16:27:04)
Offline
Of course you can have swap files on active filesystems, otherwise how on earth would you be able to access the swap file in the first place?
What you can't have is swap files in some filesystems, btrfs comes to mind (I haven't checked if that is possible now), or you have to allocate the swap file with dd (you can't just use truncate -s size).
All that said, it's much easier to just have a swap partition, specially if you want it to work for hibernation, it's not that it doesn't work if you have a swap file, you just have to jump though more hoops if you want to do so.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
At first starting over seemed to solve the problem.
Actually hibernation works (at least I see my system booting and then starting in the same state as before).
But I see error messages.
Before hibernation everything looks fine:
systemd[1]: Reached target Sleep.
systemd[1]: Starting Hibernate...
systemd-sleep[1778]: Suspending system...
kernel: PM: Hibernation mode set to 'platform'
kernel: PM: Syncing filesystems ...
But when I start my system again after hibernation I see in the journal that hibernate.target failed:
systemd-sleep[1778]: System resumed.
systemd[1]: Started Hibernate.
systemd[1]: sleep.target: Unit not needed anymore. Stopping.
systemd[1]: Stopped target Sleep.
systemd[1]: hibernate.target: Bound to unit systemd-hibernate.service, but unit isn't active.
systemd[1]: Dependency failed for Hibernate.
systemd-logind[323]: Operation 'sleep' finished.
systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency'.
And in dmesg I see:
[ 0.791396] PM: Checking hibernation image partition PARTUUID=b65ddffd-e9c4-4971-b70e-0bff87772fbf
[ 0.791410] PM: Hibernation image not present or could not be loaded.
.......
[ 1.206107] PM: Starting manual resume from disk
[ 1.206115] PM: Hibernation image partition 259:2 present
[ 1.206117] PM: Looking for hibernation image.
[ 1.206282] PM: Image not found (code -22)
[ 1.206285] PM: Hibernation image not present or could not be loaded.
But I don't really get why I see the error messages though?
Last edited by rgzfxf6bhu (2017-09-08 10:55:42)
Offline
Offline
Perfect thanks! I already tried the commit and it solves the problem with systemd.
Surprisingly I still see the error Hibernation image not present or could not be loaded..
But it works
Offline
Well, I tried it now several times and (despite the error message in dmesg) it works as expected.
So I mark it solved.
Thanks for all your help !!!
Offline