Subject: bug#50788: Swapfile on Btrfs does not start at boot

From: John Kehayias <[email-masked]>
Date: Fri, 24 Sep 2021 21:14:58 +0000

Hi all,

This has been discussed a few times on #guix, with some having success, but mostly it seems not. The issue is having a swapfile (maybe also for partition?) on Btrfs and swap not being activated on boot. In my case, I can manually start with `sudo herd start swap-/swap/swapfile` and it will work fine. There might be an issue with when different filesystems are loaded with Btrfs subvolumes? I have my swap as a file on a subvolume.

>From syslog, just before and after the only "swap" related message:

Sep 23 13:09:31 localhost vmunix: [    9.424364] shepherd[1]: Service udev has been started.
Sep 23 13:09:31 localhost vmunix: [    9.424466] Unable to find swap-space signature
Sep 23 13:09:31 localhost vmunix: [    9.424912] shepherd[1]: Service user-file-systems has been started.
Sep 23 13:09:31 localhost vmunix: [    9.443245] shepherd[1]: Service file-system-/swap has been started.
Sep 23 13:09:31 localhost vmunix: [    9.454002] shepherd[1]: Service file-system-/var/log has been started.
Sep 23 13:09:31 localhost vmunix: [    9.464911] shepherd[1]: Service file-system-/home has been started.

Checking the status of the service shows:

  It is stopped.
  It is enabled.
  Provides (swap-/swap/swapfile).
  Requires (udev).
  Conflicts with ().
  Will not be respawned.

This is the file-systems and swap part of my system configuration:

  (file-systems (append
                 (list (file-system
                         (device (file-system-label "system"))
                         (mount-point "/")
                         (type "btrfs")
                         (flags '(no-atime))
                         (options "subvol=root,compress=lzo,ssd"))
                       (file-system
                         (device (file-system-label "system"))
                         (mount-point "/swap")
                         (type "btrfs")
                         (flags '(no-atime))
                         (options "subvol=swap,ssd"))
                       (file-system
                         (device (file-system-label "system"))
                         (mount-point "/gnu/store")
                         (type "btrfs")
                         (flags '(no-atime))
                         (options "subvol=gnu-store,compress=lzo,ssd"))
                       (file-system
                         (device (file-system-label "system"))
                         (mount-point "/var/log")
                         (type "btrfs")
                         (flags '(no-atime))
                         (options "subvol=var-log,compress=lzo,ssd"))
                       (file-system
                         (device (file-system-label "system"))
                         (mount-point "/home")
                         (type "btrfs")
                         (flags '(no-atime))
                         (options "subvol=home,compress=lzo,ssd"))
                       (file-system
                         (device (uuid "5989-F926" 'fat))
                         (mount-point "/boot/efi")
                         (type "vfat")))
                 %base-file-systems))
  (swap-devices (list "/swap/swapfile"))

Hope this is helpful in tracking down what is happening, I know I'm not alone in this issue.

John