Install & configure dracut with encrypted swap file [SOLVED]

I installed EOS about 2 years ago so I still have mkinitcpio on my system, but want to replace it with dracut. EOS is installed on btrfs with LUKS, still using GRUB bootloader (I’ll replace GRUB another time).

I followed the guide at https://discovery.endeavouros.com/installation/dracut/2022/12/
However, I have a question regarding the encrypted swap part. The guide mentions that a line must be added to the encryption.conf file. Does this only apply to encrypted swap partition or swap file also?

Here is copy of my fstab:

#
UUID=1D75-AE2A /boot/efi vfat defaults,noatime 0 2
/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a / btrfs subvol=/@,defaults,noatime,compress=zstd 0 0
/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a /home btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a /var/cache btrfs subvol=/@cache,defaults,noatime,compress=zstd 0 0
/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a /var/log btrfs subvol=/@log,defaults,noatime,compress=zstd 0 0
/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a /swap btrfs subvol=/@swap,defaults,noatime 0 0
/swap/swapfile swap swap defaults 0 0

My question is this: Do I add this line even if I use an encrypted swap file or do I add it?

If so, is this then correct?

add_device+=" /dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a "

Please advise.

Edit: During install 2 years ago, I selected swap file (no hibernate)

Can you share the contents of /proc/cmdline

Sure

BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=52b3168e-62c6-4ad0-b1f9-c2bbd5daa019 rw rootflags=subvol=@ quiet cryptdevice=UUID=5ded6456-fe42-4560-961d-4acf5426560a:luks-5ded6456-fe42-4560-961d-4acf5426560a root=/dev/mapper/luks-5ded6456-fe42-4560-961d-4acf5426560a loglevel=3 nowatchdog nvme_load=YES

It doesn’t look like you need to add anything for encryption. It should get everything it needs from the cmdline

That’s awesome! Thanks for the advice. Have to say this is genuinely the best community that I’ve ever joined (with fastest response). Glad I chose EOS.

Btw. What does the swap line actually do in dracut?

2 Likes