On Fri Apr15'22 11:31:25PM, Alexander Zhang wrote:
Hello,
I'm trying to enable hibernation to a swap file on Fedora 35. I've created a
swapfile on a new BTRFS subvolume, added the resume dracut module, and set
the kernel command line arguments. I've also added
SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1 to the environments of
systemd-hibernate and systemd-logind since the swap size check is apparently
incorrect for some reason. Currently, hibernating with echo platform >
/sys/power/disk and echo disk > /sys/power/state works, but doing systemctl
hibernate only locks and briefly turns off the screen. I found these lines
in the logs, which seems to indicate that SELinux is causing the issue:
Apr 15 23:16:14 fedora systemd[1]: Reached target Sleep.
Apr 15 23:16:14 fedora systemd[1]: Starting Hibernate...
Apr 15 23:16:14 fedora systemd-sleep[9774]: Failed to find location to
hibernate to: Permission denied
Apr 15 23:16:14 fedora audit[9774]: AVC avc: denied { search } for
pid=9774 comm="systemd-sleep" name="swap" dev="dm-0"
ino=256
scontext=system_u:system_r:systemd_sleep_t:s0
tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=0
Apr 15 23:16:14 fedora systemd[1]: systemd-hibernate.service: Main process
exited, code=exited, status=1/FAILURE
Apr 15 23:16:14 fedora systemd[1]: systemd-hibernate.service: Failed with
result 'exit-code'.
Apr 15 23:16:14 fedora systemd[1]: Failed to start Hibernate.
Apr 15 23:16:14 fedora systemd[1]: Dependency failed for System Hibernation.
Apr 15 23:16:14 fedora systemd[1]: hibernate.target: Job
hibernate.target/start failed with result 'dependency'.
Apr 15 23:16:14 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295
ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hibernate
comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=?
terminal=?
res=failed'
Apr 15 23:16:14 fedora systemd-logind[1410]: Operation 'sleep' finished.
Apr 15 23:16:14 fedora systemd[1]: Stopped target Sleep.
How can I fix this?
Thanks,
Alexander Zhang
Hello Alexander,
It would be helpful to know more about your system, etc. Also, a listing of the exact
steps that you did to enable it?
It would be nice to have the hibernate issue settled, of course, but for some reason, it
persists.
Ranjan