Package: busybox-static
Version: 1:1.30.1-6
Hi.
I wasn't able to figure out all the details yet and likely won't get to that in the next few weeks. However, I tried getting hibernation to work on a machine with only a swap file.
This failed miserably (machine appeared to hibernate properly, but on reboot, the script in the initrd (local-premount/resume, from initramfs-tools) did call /usr/bin/resume properly (I added some echo/sleep commands to see what happens), but that just terminated apparently, without any error message or similar.
Reproduction (on ext4, btrfs needs more involved procedure for offset):
1) create a sufficiently large file /swap
2) mkswap /swap
3) Add swap to /etc/fstab
4) Figure out parameters for resume/resume_offset, /sys/power/resume_offset and /sys/power/resume
resume=$(findmnt -no SOURCE -T /swap)
findmnt -no MAJ:MIN -T /swap > /sys/power/resume
resume_offset=$(debugfs -R 'bmap /swap 0' $resume 2>/dev/null)
cat > /etc/initramfs-tools/conf.d/resume <<EOF
RESUME=$resume
resume_offset=$resume_offset
EOF
echo resume_offset > /sys/power/resume_offset
(Note the different capitalization for conf.d/resume - it is needed this way)
Run 'update-initramfs -k all -u'
Now you should be ready to hibernate (NOTE: Unless the bug is fixed or you configured initramfs-tools to _not_ use busybox, this will potentially lead to data loss, close all programs)
echo shutdown > /sys/power/disk
echo disk > /sys/power/state
your system should now suspend to disk and power off.
On power-on, the expected state would be that the machine resumes.
The actual state is that the machine does a fresh boot (after running /usr/bin/resume $resume $resume_offset though).
Cross-check:
Modify /usr/share/initramfstools/hooks/klibc-utils by adding:
rm "$DESTDIR/bin/resume"
cp -pL /usr/lib/klibc/bin/resume "$DESTDIR/bin/resume"
Re-run the steps from "resume=" above.
The system properly resumes from hibernation.
I know that the "resume" tool in busybox originates from the code in klibc-utils, but right now, the one in busybox doesn't work in this scenario while the one from klibc-utils does.
Cheers,
Sven