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 <br...@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.kehay...@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....@waegenei.re/
>
> Cheers,
> - Brice
>

Reply via email to