-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
systemctl hibernate does not hibernate on swapfile on Btrfs after kernel 5.0 #11939
Copy link
Copy link
Closed
Closed
Copy link
Labels
Description
systemd version the issue has been seen with
241.7
Used distribution
Archlinux
Expected behaviour you didn't see
systemctl hibernate should hibernate on swap file on Btrfs after kernel 5.0
Unexpected behaviour you saw
Btrfs supports swapfile after kernel 5.0. echo disk > /sys/power/state works fine to hibernate but systemctl hibernate failed.
Since Btrfs is using virtual physical offset of the file. The current logic in sleep.c does not get the correct physical offset of the file. The resume_offset kernel parameter is also ignored and overriden by systemd so it is unable to get the correct offset.
Line 80 in c5e6f73
| offset = fiemap->fm_extents[0].fe_physical / page_size(); |
Steps to reproduce the problem
- Create swapfile on btrfs according to man 5 btrfs
- Activate swap file in fstab
- Calculate the physical offset of swapfile and add kernel parameter
resume=/dev/nvme1n1p2 resume_offset=52761856 - echo disk > /sys/power/state works fine to hibernate
- systemctl hibernate failed.
[ 26.828436] PM: Cannot find swap device, try swapon -a
[ 26.828441] PM: Cannot get swap writer
Reactions are currently unavailable