You are not logged in.

#1 2024-04-01 06:14:44

XpYunkr
Member
Registered: 2017-11-21
Posts: 18

[Solved] Swap file not being used for hibernation

So I used 'archinstall' script to install arch on XPS 15 9500 Laptop and chose to encrypt the harddrive.
I have 3 partitions now. Boot, swap (4GB) and the rest. I guess I should have resized the swap space
immedieately but that ship has sailed now. I then created a swap file of 48 GB (roughly 1.5 x the 32 GB RAM)
with dd and then followed the procedure to turn it into swap space (mkswap, swapon etc.).
I added the swap file to fstab  with 'swapfile none swap sw,pri=100 0 0'. Still using free I can see that none
of the swap space is used by the OS which I find confusing.
If I do 'systemctl hibernate' I get logged out of the system and the monitor goes black for a few seconds and then
starts again with a single character blinking at the top left until after a couple of
seconds I am back at the lock screen.

If I run from the bash:

echo disk | sudo tee /sys/power/state; sudo dmesg | tail -n 25

the output is:

[  272.838375] PM: Compressing and saving image data (718183 pages)...
[  272.838403] PM: Image saving progress:   0%
[  273.100637] PM: Image saving progress:  10%
[  273.324604] PM: Image saving progress:  20%
[  273.537451] PM: Image saving progress:  30%
[  273.749547] PM: Image saving progress:  40%
[  274.005758] PM: Image saving progress:  50%
[  274.247298] PM: Image saving progress:  60%
[  274.460518] PM: Image saving progress:  70%
[  274.702315] PM: Image saving progress:  80%
[  274.863724] PM: Image saving progress:  90%
[  275.022182] PM: Image saving progress: 100%
[  281.984307] PM: Image saving done
[  281.984311] PM: hibernation: Wrote 2872732 kbytes in 9.14 seconds (314.30 MB/s)
[  281.984508] PM: S
[  281.984688] PM: Swap header not found!
[  281.984690] |
[  282.119275] PM: hibernation: Basic memory bitmaps freed
[  282.119407] pci_bus 0000:04: Allocating resources
[  282.119420] pci_bus 0000:38: Allocating resources
[  282.119737] pci_bus 0000:04: Allocating resources
[  282.119747] pci_bus 0000:38: Allocating resources
[  282.119896] OOM killer enabled.
[  282.119897] Restarting tasks ... done.
[  282.165332] PM: hibernation: hibernation exit

I got hibernate working previously with Guix
installed on the machine, but then didn't use the internal graphics card. Now I have the nvidia drivers installed so I am afraid
that this is interfering.

Any advice would be greatly appreciated thanks.

Last edited by XpYunkr (2024-04-17 20:30:39)

Offline

#2 2024-04-01 08:26:05

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

I added the swap file to fstab  with 'swapfile none swap sw,pri=100 0 0'. Still using free I can see that none of the swap space is used by the OS which I find confusing.

swapon; free -h

but neither will the kernel swap out if there's plenty of free RAM nor is the use as actual swap space relevant for it's state as hibernation target.

Have you read https://wiki.archlinux.org/title/Power_ … e_location ?
What does your relevant config look like and have you confirmed that it matches the location of the swap file?

Offline

#3 2024-04-08 20:10:59

XpYunkr
Member
Registered: 2017-11-21
Posts: 18

Re: [Solved] Swap file not being used for hibernation

Took me a while but only got to make changes on the weekend and did run a few more tests now.

I did add the following line to /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=fdbd7a76-bd1b-4817-a383-e43adf2145e0 resume_offset=39069696 quiet splash"

Where the offset is the return value of

filefrag -v swap_file | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'

which I took from the wiki and the UUID is the one of the decrypted device.
It was still not working afterwards and I read further that the prio of the zram should be
highest so I lowered the prio of the swapfile in the fstab to 90.
When I do:

systemctl hibernate

I get the following output (reading dmesg afterwards):

[  111.975382] PM: Using 3 thread(s) for compression
[  111.975389] PM: Compressing and saving image data (453152 pages)...
[  111.975414] PM: Image saving progress:   0%
[  112.161678] PM: Image saving progress:  10%
[  112.337958] PM: Image saving progress:  20%
[  112.509839] PM: Image saving progress:  30%
[  112.666525] PM: Image saving progress:  40%
[  112.809675] PM: Image saving progress:  50%
[  112.981572] PM: Image saving progress:  60%
[  113.169901] PM: Image saving progress:  70%
[  113.304091] PM: Image saving progress:  80%
[  113.440186] PM: Image saving progress:  90%
[  113.578513] PM: Image saving progress: 100%
[  114.249782] PM: Image saving done
[  114.249786] PM: hibernation: Wrote 1812608 kbytes in 2.27 seconds (798.50 MB/s)
[  114.249949] PM: S|
[  114.338896] printk: Suspending console(s) (use no_console_suspend to debug)
[  114.369809] PM: hibernation: Wakeup event detected during hibernation, rolling back.
[  114.369863] PM: hibernation: Basic memory bitmaps freed

What do you mean with relevant config?
And should I run swapon; free -h?

Offline

#4 2024-04-08 21:09:51

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

Instead of

[  281.984688] PM: Swap header not found!

you're now getting

[  114.369809] PM: hibernation: Wakeup event detected during hibernation, rolling back.

Something™ inhibited the hibernation, but you're not  facing a bogus destination - this is a different condition, the hibernation breaking event is likely in the surrounding dmesg/journal

What do you mean with relevant config?

resume=UUID=fdbd7a76-bd1b-4817-a383-e43adf2145e0 resume_offset=39069696

Offline

#5 2024-04-15 08:43:55

XpYunkr
Member
Registered: 2017-11-21
Posts: 18

Re: [Solved] Swap file not being used for hibernation

Okay I managed to check the journalctl and something still does not seem quite right but
I don't know what to make of it:

$ journalctl -r -u hibernate.target
Apr 14 22:43:27 dellxps systemd[1]: Stopped target System Hibernation.
Apr 14 22:43:27 dellxps systemd[1]: Reached target System Hibernation.
Apr 14 22:10:30 dellxps systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency'.
Apr 14 22:10:30 dellxps systemd[1]: Dependency failed for System Hibernation.

Looking for the dependencies

$ systemctl list-dependencies -a hibernate.target
hibernate.target
○ └─systemd-hibernate.service
●   ├─system.slice
●   │ └─-.slice
○   └─sleep.target

Running "journalctl -r -u systemd-hibernate.service"

Apr 14 22:43:27 dellxps systemd[1]: systemd-hibernate.service: Consumed 4.122s CPU time.
Apr 14 22:43:27 dellxps systemd[1]: Finished System Hibernate.
Apr 14 22:43:27 dellxps systemd[1]: systemd-hibernate.service: Deactivated successfully.
Apr 14 22:43:27 dellxps systemd-sleep[2926508]: System returned from sleep operation 'hibernate'.
Apr 14 22:43:14 dellxps systemd-sleep[2926508]: Performing sleep operation 'hibernate'...
Apr 14 22:43:14 dellxps systemd[1]: Starting System Hibernate...
Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Consumed 1.516s CPU time.
Apr 14 22:10:30 dellxps systemd[1]: Failed to start System Hibernate.
Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
Apr 14 22:10:30 dellxps systemd-sleep[2888403]: Failed to put system to sleep. System resumed again: Connection timed out
Apr 14 22:10:26 dellxps systemd-sleep[2888403]: Performing sleep operation 'hibernate'...
Apr 14 22:10:26 dellxps systemd[1]: Starting System Hibernate...

Sometimes it fails othertimes it wakes up immediately afterward as far as I can see.

And here the last bit of info:

$ systemctl status systemd-hibernate.service
○ systemd-hibernate.service - System Hibernate
     Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate.service; static)
     Active: inactive (dead)
       Docs: man:systemd-hibernate.service(8)

Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
Apr 14 22:10:30 dellxps systemd[1]: Failed to start System Hibernate.
Apr 14 22:10:30 dellxps systemd[1]: systemd-hibernate.service: Consumed 1.516s CPU time.
Apr 14 22:43:14 dellxps systemd[1]: Starting System Hibernate...
Apr 14 22:43:14 dellxps systemd-sleep[2926508]: Performing sleep operation 'hibernate'...
Apr 14 22:43:27 dellxps systemd-sleep[2926508]: System returned from sleep operation 'hibernate'.
Apr 14 22:43:27 dellxps systemd[1]: systemd-hibernate.service: Deactivated successfully.
Apr 14 22:43:27 dellxps systemd[1]: Finished System Hibernate.
Apr 14 22:43:27 dellxps systemd[1]: systemd-hibernate.service: Consumed 4.122s CPU time.

I am afraid there still is no useful information in there, as to why the system wakes up sometimes.

Offline

#6 2024-04-15 12:15:05

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

Filtering the journal won't help, if there's nothing in "systemd-inhibit --list" you'll have to look at the wider context in the journal around the hiberation attempt - unfiltered, because you don't know what you want to filter for.

Offline

#7 2024-04-15 13:21:59

XpYunkr
Member
Registered: 2017-11-21
Posts: 18

Re: [Solved] Swap file not being used for hibernation

$ systemd-inhibit --list
WHO            UID  USER   PID   COMM           WHAT  WHY                                       MODE
NetworkManager 0    root   3464  NetworkManager sleep NetworkManager needs to turn off networks delay
UPower         0    root   6590  upowerd        sleep Pause device polling                      delay
signal-desktop 1000 geegee 15527 signal-desktop sleep Application cleanup before suspend        delay
swayidle       1000 geegee 6279  swayidle       sleep Swayidle is preventing sleep              delay

Could it be that swayidle, UPower or systemd are somehow interfering with each other?
I will grep everything that happened around hibernate +- 30 lines.
Here the output around 22:43:00 http://0x0.st/X-It.txt.
and here the one around  22:10:00 http://0x0.st/X-Ix.txt

I think the failure around 22:10:00 is connected to the SD card I have plugged into the laptop.

Last edited by XpYunkr (2024-04-15 13:22:31)

Offline

#8 2024-04-15 13:36:22

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

Does it work w/ the LTS kernel?
https://bugzilla.kernel.org/show_bug.cgi?id=218634

cat /proc/acpi/wakeup # on the 6.8.x kernel, LTS for coparism if the problem doesn#t exist there

'

Offline

#9 2024-04-15 21:12:28

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

Offline

#10 2024-04-17 18:17:33

XpYunkr
Member
Registered: 2017-11-21
Posts: 18

Re: [Solved] Swap file not being used for hibernation

Was following those threads too.
With the lts kernel hibernation works fine now.
What confused me is that I needed to change the initramfs again
in /etc/mkinitcpio.conf and run mkinitcpio -p linux. Also when waking up I can
select the kernel which I find confusing. Anyway glad it works now.

Edit:
The lts kernel seems to use a lot more power. Battery time went from 7h 15 min to 3h 30 min.
Hopefully can do some tweaking there.
Edit:
Okay found out about tlp and now its even better than before.
Thanks again for everything.

Last edited by XpYunkr (2024-04-17 19:24:30)

Offline

#11 2024-04-17 20:19:50

seth
Member
Registered: 2012-09-03
Posts: 52,640

Re: [Solved] Swap file not being used for hibernation

\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB