Hello everyone, my first steps on Guix and ... I lost my swap!

Hello,

my first steps on Guix (the full system). I explain where i come from in my profile, i suppose you can easily access to it (I can tell more if you want :slight_smile:).

Installation went well, I did a guix pull && guix system reconfigure /etc/config.scm straight after the install, I did it twice because the first time the reconfigure told me that there was an issue with a regression, second time went well

Now my point is : after the install, I had the swap working, no issue, I checked that with htop. But … for some reasons, after a restart, my swap dissapeared, not any more in use …

In case this helps:

(bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (targets (list "/dev/sda"))
                (keyboard-layout keyboard-layout)))
  (swap-devices (list (swap-space
                        (target (uuid
                                 "here-the-uuid-numebrs-and-letters")))))
  (mapped-devices (list (mapped-device
                          (source (uuid
                                   "here-the-uuid-numebrs-and-letters"))
                          (target "crypthome")
                          (type luks-device-mapping))
                        (mapped-device
                          (source (uuid
                                   "here-the-uuid-numebrs-and-letters"))
                          (target "cryptroot")
                          (type luks-device-mapping))))

I’ll very probably have other questions on other topics …

Swap stopped working for me once, right after I tried to put the laptop into hybernation. The hybernation doesn’t work and the swap partition had a suspend image on it.

Anyway I think I reset it by forcing the mount: sudo swapon /dev/..
Looking at the output of sudo herd status ... might also be helpful.

I think you need to add a kernel argument to use swap for hibernation.


(kernel-arguments
  (cons* "resume=/dev/mapper/my-swap"
         %default-kernel-arguments))
1 Like

I just came across this post and thought maybe you should add (dependencies mapped-devices) to your swap-space record?

Thank you very much for your help, I am really not a programmer so my knowledge here is very limited.

So 2 questions:

  1. swapon, ok, I know the command, but here I don’t know which /dev/ to choose - there are so many, nothing that evokes a swap

but as for /dev/mapper, i only have this:

~$ ls /dev/mapper
control crypthome cryptroot

  1. herd status answers :

herd status

Failed to start:
! swap-74e19e-this-the-uuid-of-my-swap-disk-see-my-config-in-the-first-message

  1. I tested a:

sudo herd restart swap-74e19e9d-3bba-4154-881f-0c5ad076254b

wich returns:

Service swap-74e19e9d-3bba-4154-881f-0c5ad076254b is not running.
Service swap-74e19e9d-3bba-4154-881f-0c5ad076254b could not be started.

If anyone can point me in the right direction …

It’s ok. I’m not a programmer either :smile:

Anyway, here are some ways you can find your swap device:

swapon --show
cat /proc/swaps
sudo fdisk --list | grep swap

You can also try

sudo herd log

and

guix system shepherd-graph /etc/config.scm | guix shell xdot -- xdot -

Maybe this could give some clues.

My guess is still that you need to add something in (dependencies …), but I’m not sure about that.

Thanks a lot, really very helpfull, this helps me to understand the different basic commands of linux or guix.

I have executed the different commands:

swapon --show
==> no result

cat /proc/swaps
==> no result (except the headers Filename Type etc)

sudo fdisk --list | grep swap
==> /dev/sda3 206301184 225851391 19550208 9.3G Linux swap
==> this is the swap I created, and worked fine right after the install, never again after

sudo herd log | grep swap
==> 4 Mar 2024 19:08:05 service swap-74e19e9d-3bba-4154-881f-0c5ad076254b is being started
4 Mar 2024 19:08:05 service swap-74e19e9d-3bba-4154-881f-0c5ad076254b failed to start

The last command installs something, I’m waiting for the outcome

My conclusion (not an expert !)at this stage is that I have a swap device, but guix is not able to start it (and was able to start it after the first install !!)

Anybody could help further ?

I just built the system with exactly the same partitions configuration. And everything just works fine!

Honestly, I no longer have any idea what the problem might be.
If you haven’t done this yet, you can contact help-guix or bug-guix mailing lists. Also it might be useful if you attach some info: computer model, config file, the output of the guix describe command.

Oh, and for the future, if you want an encrypted system, I advise you to try encrypted btrfs.

Ok thanks for all that you did.
I’ll ask on the help-guix mailing list.

Just to know : why do you advise btrfs for an encrypted system ?

I just like the built-in functionality of subvolumes and snapshots. Besides the fact that it is simply convenient and allows you to get rid of the extra layer in the form of lvm, with this you can achieve better control over the state of your system.

There’s one technique, that, I think, was first demonstrated in this article using the example of nixos and zfs. But it also should work for guix with btrfs. I currently have a simple btrfs partition scheme, but this techique is definitely something I want to try with my next fresh install.

I think Andrew Tropin has this thing going on his rde system. He also has these two old videos that provide some explanations:
Stateless Operating System
Installing GNU Guix on encrypted btrfs