Page MenuHomeSolus

logind fails to hibernate: "Not enough swap space for hibernation"
Closed, ResolvedPublic

Assigned To
None
Authored By
hyphens
Feb 3 2020, 11:04 PM
Referenced Files
F5830195: ad-hoc-hibernate.c
Apr 21 2020, 10:54 PM
F5830196: Makefile
Apr 21 2020, 10:54 PM
F5831740: bat_watcher.sh
Apr 21 2020, 10:54 PM
F5830226: bat.timer
Apr 21 2020, 10:54 PM
F5830194: INSTALL
Apr 21 2020, 10:54 PM
F5830227: bat.service
Apr 21 2020, 10:54 PM
F5564807: logind
Feb 3 2020, 11:04 PM

Description

Hello. There seems to be an issue with systemd 244 (the current in repos) regarding hibernation. As seen here: search on github
and more specifically: this issue

The issue seems to have made its way to my system since the most recent systemd update. I had a working swap setup prior. Things are documented here:

I don't know if it's reproducible on a fresh system but these were the steps I've taken to create my config:

  • my ram is 4gb
  • create a 4.5gb swapfile with dd and /dev/zero
  • mkswap and swapon
  • add an entry for it in fstab
  • find the offsets with filefrag
  • add the relevant resume entries and offsets in cmdline
  • usysconf run -f to make sure everything is in its right place
  • reboot and try with systemctl hibernate

last step worked normally until the most recent systemd update

Event Timeline

I also want to stress that hibernating to this exact swapfile was working fine for months. It's very likely not an actual space issue.

So I've tried to bypass logind entirely by interfacing with the sysfs.. Just to make sure my swapfile/configuration didn't have any funny business in them:
# echo disk > /sys/power/state works just fine. It's the initial step of systemd checking whether I have enough space to hibernate that seems to stop the process. As highlighted in the journal entry in the file attached.

DataDrake edited projects, added Software; removed Lacks Project.
DataDrake added a subscriber: DataDrake.

I see a (bunch of) new upgrade(s) to systemd. Latest is "reverting to 244" . Did a patch happen in the process or am I still out of luck :'D

There was a brief period when we were using version 245, which would have fixed your issue if it is the one DataDrake posted, but then everything was reverted completely, so it will probably still show the same issue.

I don't know if it's appropriate to discuss here but I created a SUID executable that (coupled with a battery watching script running as a service) will hibernate the laptop on critical battery:

The executable:

Example service + script

Hey @hyphens, is this still an issue on your system? This issue was last updated over three years ago, and the upstream issue has been fixed.