Activate hibernation on crypto BTRFS

Hi everyone.
I would like to be able to use the hibernation on my system, an old MacBook Pro with crypted btrfs filesystem.

System:
  Kernel: 6.8.7-zen1-1-zen arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.0.4 Distro: EndeavourOS
Machine:
  Type: Laptop System: Apple product: MacBookPro9,2 v: 1.0
    serial: <superuser required>
  Mobo: Apple model: Mac-6F01561E16C75D06 v: MacBookPro9,2
    serial: <superuser required> UEFI: Apple v: 429.0.0.0.0 date: 03/18/2022
Battery:
  ID-1: BAT0 charge: 34.1 Wh (98.6%) condition: 34.6/62.9 Wh (55.0%)
CPU:
  Info: dual core model: Intel Core i5-3210M bits: 64 type: MT MCP cache:
    L2: 512 KiB
  Speed (MHz): avg: 2717 min/max: 1200/3100 cores: 1: 3100 2: 3100 3: 1568
    4: 3100
Graphics:
  Device-1: Intel 3rd Gen Core processor Graphics driver: i915 v: kernel
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 23.2.6
    compositor: kwin_wayland driver: X: loaded: modesetting dri: crocus
    gpu: i915 resolution: 1280x800
  API: EGL v: 1.5 drivers: crocus,swrast
    platforms: wayland,x11,surfaceless,device
  API: OpenGL v: 4.5 compat-v: 4.2 vendor: intel mesa v: 24.0.5-arch1.1
    renderer: Mesa Intel HD Graphics 4000 (IVB GT2)
  API: Vulkan v: 1.3.279 drivers: intel surfaces: xcb,xlib,wayland
Audio:
  Device-1: Intel 7 Series/C216 Family High Definition Audio
    driver: snd_hda_intel
  API: ALSA v: k6.8.7-zen1-1-zen status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active
Network:
  Device-1: Broadcom NetXtreme BCM57765 Gigabit Ethernet PCIe driver: tg3
  IF: enp1s0f0 state: down mac: <filter>
  Device-2: Broadcom BCM4331 802.11a/b/g/n driver: wl
  IF: wlan0 state: up mac: <filter>
  IF-ID-1: virbr0 state: down mac: <filter>
  IF-ID-2: waydroid0 state: down mac: <filter>
Drives:
  Local Storage: total: 942.7 GiB used: 473.63 GiB (50.2%)
  ID-1: /dev/sda vendor: Samsung model: SSD 860 EVO 500GB size: 465.76 GiB
  ID-2: /dev/sdb vendor: Intenso model: SSD Sata III size: 476.94 GiB
Partition:
  ID-1: / size: 437.35 GiB used: 183.35 GiB (41.9%) fs: btrfs dev: /dev/dm-0
  ID-2: /boot/efi size: 998 MiB used: 1.1 MiB (0.1%) fs: vfat dev: /dev/sda1
  ID-3: /home size: 437.35 GiB used: 183.35 GiB (41.9%) fs: btrfs
    dev: /dev/dm-0
  ID-4: /tmp size: 437.35 GiB used: 183.35 GiB (41.9%) fs: btrfs
    dev: /dev/dm-0
  ID-5: /var/log size: 437.35 GiB used: 183.35 GiB (41.9%) fs: btrfs
    dev: /dev/dm-0
Swap:
  ID-1: swap-1 type: file size: 16 GiB used: 0 KiB (0.0%) file: /swap/swapfile
  ID-2: swap-2 type: zram size: 7.76 GiB used: 0 KiB (0.0%) dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 66.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 16 GiB available: 15.53 GiB used: 3.19 GiB (20.5%)
  Processes: 267 Uptime: 9m Shell: Zsh inxi: 3.3.34
❯ swapon
NAME           TYPE      SIZE USED PRIO
/swap/swapfile file       16G   0B   -2
/dev/zram0     partition 7,8G   0B  100

I use Grub as a bootloader and I calculated Uuid and offset following Archlinux’s wiki.

resume=UUID=24be0b8b-ae79-4258-b1b6-fe4a44d47bc0

sudo findmnt -no UUID -T /swapfile
24be0b8b-ae79-4258-b1b6-fe4a44d47bc0

resume_offset=53044480

sudo btrfs inspect-internal map-swapfile -r /swapfile
53044480

I activated the resume in Dracut

cat /etc/dracut.conf.d/resume.conf
add_dracutmodules+=" resume "

And I updated Grub and Dracut

sudo update-grub
sudo dracut-rebuild

I restarted the notebook but the hibernation still does not work, it gives me back error for the exhausted space on the device.

When i run systemctl hibernate I get this


Call to Hibernate failed: Not enough suitable swap space for hibernation available on compatible block devices and file systems


Where did I go wrong?

Sorry, my bad!

The correct swap file was located in /swap/swapfile but I mistakenly used an old /swap file that I should have deleted.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.