Skip to main content
Topic: Hibernation into a Btrfs swapfile not working (Read 894 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Hibernation into a Btrfs swapfile not working

I followed the directions on the Arch wiki for btrfs swapfile hibernation, but I've had no success. To give greater details, here is my current setup, as well as the different proposed solutions that I tried.

My system is configured with a large HDD that uses bcache for a smaller SSD. As you can see below, sda1 is used to store the /boot folder as well as the EFI since no bootloader I know of supports bcache. I'm using the rEFInd bootloader. My graphics card is a GTX 1070, and I'm using the proprietary nvidia driver. /dev/bcache0 is formatted as btrfs with various subvolumes mounted to different locations. To ensure I can take snapshots of my root subvolume, the swapfile is placed in the @swap subvolume mounted at /.swap. I'm using the OpenRC init system. I'm using dracut instead of mkinitcpio to generate an initramfs. I'm using the KDE Plasma desktop environment.

Output of lsblk:

Quote
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
├─sda1        8:1    0   200M  0 part /boot
└─sda2        8:2    0 931.3G  0 part
  └─bcache0 254:0    0 931.3G  0 disk /var/lib/libvirt
sdb           8:16   0 111.8G  0 disk
└─bcache0   254:0    0 931.3G  0 disk /var/lib/libvirt

/etc/fstab file:

Quote
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /       btrfs   rw,relatime,compress=lzo,ssd,subvol=@   0 0

# /dev/sda1 UUID=39A6-0435
LABEL=EFI       /boot   vfat    rw,relatime     0 2

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /home   btrfs   rw,relatime,subvol=@home        0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /.snapshots     btrfs   rw,relatime,subvol=@snapshots   0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /.swap          btrfs   rw,relatime,subvol=@swap        0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /var/cache      btrfs   rw,relatime,subvol=var/@cache   0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /var/log        btrfs   rw,relatime,subvol=var/@log     0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /var/tmp        btrfs   rw,relatime,subvol=var/@tmp     0 0

# /dev/bcache0 UUID=719fe28b-c3d9-4571-a64b-f051880041b0
LABEL=Root      /var/lib/libvirt        btrfs   rw,relatime,subvol=var/lib/@libvirt     0 0

/.swap/swapfile         none    swap    defaults        0 0

/boot/refind_linux.conf file:

Quote
"Boot using default options"            "root=LABEL=Root resume=LABEL=Root resume_offset=12588288 nvidia-drm.modeset=1"
"Boot using fallback initramfs"        "root=LABEL=Root resume=LABEL=Root resume_offset=12588288 nvidia-drm.modeset=1 initrd=/initramfs-linux-dracut-fallback.img"
"Boot using single user mode"         "root=LABEL=Root resume=LABEL=Root resume_offset=12588288 nvidia-drm.modeset=1 single"

WIth that out of the way, let's get to the crux of the issue. When attempting to hibernate from KDE, the screen will switch off, but my system will not fully shutdown. At first, I thought this was strictly a KDE issue. That statement is half true because using the pm-utils pm-hibernate command or the echo shutdown > /sys/power/disk and echo disk > /sys/power/state commands does lead to a successfull shutdown. However, my system does not resume back to how it was when it shutdown. It starts up as if I did not hibernate at all! I also tried using the LTS kernel and nvidia driver, but that yielded no results.