Solved Swap not mounting during boot

I just notice that my swap (encrypted, created during install with zfs auto install option) isn't decrypting or mounting at all.
Code:
beastie@BattleStar-Lat54 --> ~
Ψ cat /etc/fstab                                                                                                           < 21:36 >  < 11,724-09-05 >  < 0 >
# Device                Mountpoint                    FStype            Options                Dump        Pass
/dev/gpt/efiboot0    /boot/efi                    msdosfs            rw                2            2
/dev/nvd0p2.eli        none                        swap            sw                0            0
proc            /proc                        procfs            rw                0            0
fdesc            /dev/fd                    fdescfs         rw                  0           0
tmpfs            /tmp                        tmpfs           rw,mode=777         0           0
#linprocfs        /compat/linux/proc          linprocfs       rw                  0           0
#linsysfs        /compat/linux/sys           linsysfs        rw                  0           0
#tmpfs            /compat/linux/dev/shm       tmpfs           rw,mode=1777        0           0
beastie@BattleStar-Lat54 --> ~
Ψ doas swapinfo                                                                                                            < 21:36 >  < 11,724-09-05 >  < 0 >
Device          1K-blocks     Used    Avail Capacity
beastie@BattleStar-Lat54 --> ~
Ψ lsblk                                                                                                                    < 21:37 >  < 11,724-09-05 >  < 0 >
DEVICE         MAJ:MIN SIZE TYPE                                    LABEL MOUNT
nda0             0:91  932G GPT                                         - -
  nda0p1         0:93  260M efi                              gpt/efiboot0 /boot/efi
  <FREE>         -:-   1.0M -                                           - -
  nda0p2         0:95   16G freebsd-swap                        gpt/swap0 -
  nda0p3         0:97  915G freebsd-zfs                          gpt/zfs0 <ZFS>
  nda0p3.eli     0:101 915G zfs                                         - -
  <FREE>         -:-   708K -                                           - -

I dind't found any documentation about encrypted swap on 14.1. Can someone point me in the right direction, please?
 
You are using nvd0p2 in /etc/fstab and nda0p2 is shown as swap in the block device list.

Assuming that you have just one NVMe "disk", I suspect that your swap device in /etc/fstab should be /dev/gpt/swap0.eli, though /dev/nda0p2.eli would probably also work.

Forensically, it might be worthwhile to investigate the differences between nda(4) and nvd(4).
 
Regarding nvd(4) and nda(4), as well
I dind't found any documentation about encrypted swap on 14.1. Can someone point me in the right direction, please?
/usr/src/UPDATING
Rich (BB code):
20230612:
        Belatedly switch the default nvme block device on x86 from nvd to nda.
        nda created nvd compatibility links by default, so this should be a
        nop. If this causes problems for your application, set hw.nvme.use_nvd=1
        in your loader.conf or add `options NVME_USE_NVD=1` to your kernel
        config. To disable the nvd compatibility aliases, add
        kern.cam.nda.nvd_compat=0 to loader.conf.  The default has been nda on
        all non-x86 platforms for some time now. If you need to fall back,
        please email imp@freebsd.org about why.

        Encrypted swap partitions need to be changed from nvd to nda if you
        migrate, or you need to use the above to switch back to nvd.
IMO it's better to use GPT labels instead of device names ( /dev/gpt/swap0.eli )
 
doas geli onetime /dev/nda0p2 && doas swapon /dev/nda0p2.eli worked, but how do I make permanent during reboots?

Edit: Also, my homelab has a similar setup, but it doesn't have this problem:
Code:
beastie@BattleStar-Hydra --> ~
Ψ lsblk                                                                                                                    < 23:52 >  < 11,724-09-05 >  < 0 >
DEVICE         MAJ:MIN SIZE TYPE                                    LABEL MOUNT
ada0             0:117 256G GPT                                         - -
  ada0p1         0:121 260M efi                              gpt/efiboot0 /boot/efi
  <FREE>         -:-   1.0M -                                           - -
  ada0p2         0:123  16G freebsd-swap                        gpt/swap0 SWAP
  ada0p2.eli     0:150  16G freebsd-swap                                - SWAP
  ada0p3         0:125 240G freebsd-zfs                          gpt/zfs0 <ZFS>
  ada0p3.eli     0:131 240G zfs                                         - -
  <FREE>         -:-   660K -                                           - -
ada1             0:115 466G zfs                                         - -
ada2             0:119 466G zfs                                         - -
da0              0:148 932G MBR                                         - -
  <FREE>         -:-   512B -                                           - -
  da0s1          0:149 932G freebsd                                     - -
  da0s1.eli      1:192 932G zfs                                         - -

EDIT: OK, I changed from nvd to nda and also worked, thank you everyone.
 
Edit: Also, my homelab has a similar setup, but it doesn't have this problem:
Did you upgrade the NVMe machine from an earlier version of FreeBSD? The device name changed from nvd to nda. Your other machine is ada and there was no device name change.

That's IF upgrades were involved.

(EDIT: not sure if the below applies to geli-encrypted devices so might need some more research/checking).

See:


NVMe disks are now nda devices by default, for example nda0; see nda(4). Symbolic links for the previous nvd(4) device names are created in /dev. However, configuration such as fstab(5) should be updated to refer to the new device names. Options to control the use of nda devices and symbolic links are described in nda(4). bdc81eeda05d (Sponsored by Netflix)
 
Did you upgrade the NVMe machine from an earlier version of FreeBSD? The device name changed from nvd to nda. Your other machine is ada and there was no device name change.

That's IF upgrades were involved.

See:


NVMe disks are now nda devices by default, for example nda0; see nda(4). Symbolic links for the previous nvd(4) device names are created in /dev. However, configuration such as fstab(5) should be updated to refer to the new device names. Options to control the use of nda devices and symbolic links are described in nda(4). bdc81eeda05d (Sponsored by Netflix)
I indeed upgraded from 13.3 to 14.1 (not directly).

BaronBS, I am terribly sorry. I didn't saw you replying to my posting before I deleted it. That solution wasn't permanent. Best is to edit fstab as in post #2 or #3
No problemo mate, your answer in the post#3 already had the solution. ;-)
 
Back
Top