GNU bug report logs - #50788
Swapfile on Btrfs does not start at boot

Previous Next

Package: guix;

Reported by: John Kehayias <john.kehayias <at> protonmail.com>

Date: Fri, 24 Sep 2021 21:16:02 UTC

Severity: normal

Done: Josselin Poiret <dev <at> jpoiret.xyz>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50788 in the body.
You can then email your comments to 50788 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#50788; Package guix. (Fri, 24 Sep 2021 21:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Kehayias <john.kehayias <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 24 Sep 2021 21:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: "bug-guix <at> gnu.org" <bug-guix <at> gnu.org>
Subject: Swapfile on Btrfs does not start at boot
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




Information forwarded to bug-guix <at> gnu.org:
bug#50788; Package guix. (Fri, 24 Sep 2021 23:15:01 GMT) Full text and rfc822 format available.

Message #8 received at 50788 <at> debbugs.gnu.org (full text, mbox):

From: Zacchaeus Scheffer <zaccysc <at> gmail.com>
To: 50788 <at> debbugs.gnu.org
Subject: RE: Swapfile on Btrfs does not start at boot
Date: Fri, 24 Sep 2021 19:13:47 -0400
[Message part 1 (text/plain, inline)]
I have the same problem.  I can start the swapfile normally with herd start
swap-/swap/swapfile, but it fails to start at boot.

Here are the (possibly) relevant parts of my system configuration:
 (mapped-devices
  (list
   (mapped-device
    (source (uuid "59d615e4-8a35-469c-aa24-88f28f084847"))
    (target "ex")
    (type luks-device-mapping))))
 (file-systems
  (append
   (list
    (file-system
     (type "btrfs")
     (mount-point "/")
     (device (file-system-label "ex"))
     (options "subvol=guix")
     (dependencies mapped-devices))
    (file-system
     (type "btrfs")
     (mount-point "/swap")
     (device (file-system-label "ex"))
     (options "subvol=swap")
     (dependencies mapped-devices))
    (file-system
     (type "vfat")
     (mount-point "/boot/efi")
     (device (file-system-label "EFI"))))
   %base-file-systems))
 (swap-devices
  (list "/swap/swapfile"))

Let me know if I should include more info.

-Zacchae
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#50788; Package guix. (Sat, 25 Sep 2021 12:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 50788 <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: zaccysc <at> gmail.com, 50788 <at> debbugs.gnu.org
Subject: Re: bug#50788: Swapfile on Btrfs does not start at boot
Date: Sat, 25 Sep 2021 14:54:47 +0200
Hello John and Zacchaeus,

A month ago I open a thread in guix-devel titled “Using a swapfile on btrfs for
hibernation”¹ describing in depth my setup about your specific issue but it had
no response so far.  It should be detailled enought for you to reproduce a
similar setup and if not I would like your feedbakc on it.

John Kehayias <john.kehayias <at> protonmail.com> writes:

> 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:

[...]

> Checking the status of the service shows:

[...]

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

Following are the same output as yours but from a working setup.

--8<---------------cut here---------------start------------->8---
# dmesg
[...]
[    6.393304] shepherd[1]: Service udev has been started.
[    6.431318] Adding 32488200k swap on /swap/swapfile.  Priority:-2 extents:2 across:32706248k FS
[    6.433275] shepherd[1]: Service swap-/swap/swapfile has been started.
[    6.434347] shepherd[1]: Service user-file-systems has been started.
[    6.469352] shepherd[1]: Service file-system-/boot/efi has been started.
[    6.535679] shepherd[1]: Service file-system-/home has been started.
[...]
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
# herd status swap-/swap/swapfile
Status of swap-/swap/swapfile:
  It is started.
  Running value is #t.
  It is enabled.
  Provides (swap-/swap/swapfile).
  Requires (udev).
  Conflicts with ().
  Will not be respawned.
--8<---------------cut here---------------end--------------->8---

Here are the file-systems and swap-devices fields of my operating-system:
--8<---------------cut here---------------start------------->8---
(file-systems
  (append (list (file-system
                 (mount-point "/boot/efi")
                 (device (uuid "588A-2266" 'fat32))
                 (type "vfat"))
                (file-system
                 (mount-point "/swap")
                 (device (uuid "2ab8e658-5878-4acd-ba33-8a46707a3828" 'btrfs))
                 (type "btrfs")
                 (needed-for-boot? #t)
                 (options "compress=zstd,subvol=swap")))
          (hash-map->list
           (lambda (mount-point subvolume)
             (file-system
               (mount-point mount-point)
               (device (uuid "2ab8e658-5878-4acd-ba33-8a46707a3828" 'btrfs))
               (type "btrfs")
               (options (string-append "compress=zstd" ",subvol=" subvolume))))
           (alist->hash-table '(("/"                 . "guix-system")
                                ("/home"             . "home")
                                ;; ("/swap"             . "swap")
                                ("/mnt/btrfs-root"   . "/"))))
          %base-file-systems))

(swap-devices (list "/swap/swapfile"))
--8<---------------cut here---------------end--------------->8---

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

I think you are just missing “(needed-for-boot? #t)” on your swap subvolume,
even tho you shouldn't need to have it mounted from the initramfs (except if you
want to hibernate on your swapfile).  On the thread previsouly cited¹, I suggest
two new records “swap-file” and “swap-device” where it would make sense to add
an additional “dependecies” field, similar to the one in ”file-system” record,
which would list the “file-system” to be mounted before activating that swap
file (or device).

Hope it helps.

¹ https://yhetil.org/guix/87zgt9nrmg.fsf <at> waegenei.re/

Cheers,
- Brice




Information forwarded to bug-guix <at> gnu.org:
bug#50788; Package guix. (Mon, 27 Sep 2021 15:38:02 GMT) Full text and rfc822 format available.

Message #14 received at 50788 <at> debbugs.gnu.org (full text, mbox):

From: Zacchaeus Scheffer <zaccysc <at> gmail.com>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 50788 <at> debbugs.gnu.org
Subject: Re: bug#50788: Swapfile on Btrfs does not start at boot
Date: Mon, 27 Sep 2021 11:37:02 -0400
[Message part 1 (text/plain, inline)]
Hi Brice,

Yes, setting "(needed-for-boot? #t)" did it for me.  I agree that adding a
dependencies field for swap devices is the "correct" solution.

Thanks,
-Zacchae

On Sat, Sep 25, 2021 at 8:54 AM Brice Waegeneire <brice <at> waegenei.re> wrote:

>
> Hello John and Zacchaeus,
>
> A month ago I open a thread in guix-devel titled “Using a swapfile on
> btrfs for
> hibernation”¹ describing in depth my setup about your specific issue but
> it had
> no response so far.  It should be detailled enought for you to reproduce a
> similar setup and if not I would like your feedbakc on it.
>
> John Kehayias <john.kehayias <at> protonmail.com> writes:
>
> > 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:
>
> [...]
>
> > Checking the status of the service shows:
>
> [...]
>
> > This is the file-systems and swap part of my system configuration:
>
> Following are the same output as yours but from a working setup.
>
> --8<---------------cut here---------------start------------->8---
> # dmesg
> [...]
> [    6.393304] shepherd[1]: Service udev has been started.
> [    6.431318] Adding 32488200k swap on /swap/swapfile.  Priority:-2
> extents:2 across:32706248k FS
> [    6.433275] shepherd[1]: Service swap-/swap/swapfile has been started.
> [    6.434347] shepherd[1]: Service user-file-systems has been started.
> [    6.469352] shepherd[1]: Service file-system-/boot/efi has been started.
> [    6.535679] shepherd[1]: Service file-system-/home has been started.
> [...]
> --8<---------------cut here---------------end--------------->8---
>
> --8<---------------cut here---------------start------------->8---
> # herd status swap-/swap/swapfile
> Status of swap-/swap/swapfile:
>   It is started.
>   Running value is #t.
>   It is enabled.
>   Provides (swap-/swap/swapfile).
>   Requires (udev).
>   Conflicts with ().
>   Will not be respawned.
> --8<---------------cut here---------------end--------------->8---
>
> Here are the file-systems and swap-devices fields of my operating-system:
> --8<---------------cut here---------------start------------->8---
> (file-systems
>   (append (list (file-system
>                  (mount-point "/boot/efi")
>                  (device (uuid "588A-2266" 'fat32))
>                  (type "vfat"))
>                 (file-system
>                  (mount-point "/swap")
>                  (device (uuid "2ab8e658-5878-4acd-ba33-8a46707a3828"
> 'btrfs))
>                  (type "btrfs")
>                  (needed-for-boot? #t)
>                  (options "compress=zstd,subvol=swap")))
>           (hash-map->list
>            (lambda (mount-point subvolume)
>              (file-system
>                (mount-point mount-point)
>                (device (uuid "2ab8e658-5878-4acd-ba33-8a46707a3828"
> 'btrfs))
>                (type "btrfs")
>                (options (string-append "compress=zstd" ",subvol="
> subvolume))))
>            (alist->hash-table '(("/"                 . "guix-system")
>                                 ("/home"             . "home")
>                                 ;; ("/swap"             . "swap")
>                                 ("/mnt/btrfs-root"   . "/"))))
>           %base-file-systems))
>
> (swap-devices (list "/swap/swapfile"))
> --8<---------------cut here---------------end--------------->8---
>
> > Hope this is helpful in tracking down what is happening, I know I'm not
> alone in this issue.
>
> I think you are just missing “(needed-for-boot? #t)” on your swap
> subvolume,
> even tho you shouldn't need to have it mounted from the initramfs (except
> if you
> want to hibernate on your swapfile).  On the thread previsouly cited¹, I
> suggest
> two new records “swap-file” and “swap-device” where it would make sense to
> add
> an additional “dependecies” field, similar to the one in ”file-system”
> record,
> which would list the “file-system” to be mounted before activating that
> swap
> file (or device).
>
> Hope it helps.
>
> ¹ https://yhetil.org/guix/87zgt9nrmg.fsf <at> waegenei.re/
>
> Cheers,
> - Brice
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#50788; Package guix. (Mon, 27 Sep 2021 18:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 50788 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Zacchaeus Scheffer <zaccysc <at> gmail.com>
Cc: Brice Waegeneire <brice <at> waegenei.re>, 50788 <at> debbugs.gnu.org
Subject: Re: bug#50788: Swapfile on Btrfs does not start at boot
Date: Mon, 27 Sep 2021 18:25:13 +0000
[Message part 1 (text/plain, inline)]
Hi Brice and Zacchaeus,

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, September 27th, 2021 at 11:37 AM, Zacchaeus Scheffer wrote:

> Hi Brice,
>
> Yes, setting "(needed-for-boot? #t)" did it for me. I agree that adding a dependencies field for swap devices is the "correct" solution.

Worked for me too, thanks! I'm guessing this is only needed for btrfs not ext4 for example? In any event, I support any change that makes it more obvious, at the very least a note and example in the documentation for swap.

John
[Message part 2 (text/html, inline)]

Reply sent to Josselin Poiret <dev <at> jpoiret.xyz>:
You have taken responsibility. (Sun, 06 Feb 2022 20:21:01 GMT) Full text and rfc822 format available.

Notification sent to John Kehayias <john.kehayias <at> protonmail.com>:
bug acknowledged by developer. (Sun, 06 Feb 2022 20:21:01 GMT) Full text and rfc822 format available.

Message #22 received at 50788-done <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: 50788-done <at> debbugs.gnu.org
Subject: Re: Swapfile on Btrfs does not start at boot
Date: Sun, 06 Feb 2022 21:20:27 +0100
Hello,

swap-devices now include a dependencies system since
133a61ae263520378ac44482810d7adecfb017d9, see "(guix) Swap Space".

Closing.

-- 
Josselin Poiret




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Mar 2022 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.