I'm trying to setup an encrypted volume following this guide
Everything is setup but mounting the encrypted volume fails at boot-time with the error:
fsck.ext4: No such file or directory while trying to open /dev/mapper/safe_vault Possibly non-existent device?
This is my setup:
crypttab
$ sudo cat /etc/crypttab
safe_vault /dev/disk/by-uuid/d266ae14-955e-4ee4-9612-326dd09a463b none luks
NOTE:
The uuid comes from:
$ sudo blkid /dev/mapper/<my_logical_group>-safe_vault
/dev/mapper/<my_logical_group>-safe_vault: UUID="d266ae14-955e-4ee4-9612-326dd09a463b" TYPE="crypto_LUKS"
fstab
$ sudo cat /etc/fstab | grep safe_vault
/dev/mapper/safe_vault /safe-vault ext4 defaults 0 2
What I've done...
So I went to the devoper's website and in the Common Problems FAQ they say:
Check that you have the device mapper and the crypt target in your kernel. The output of "dmsetup targets" should list a "crypt" target. If it is not there or the command fails, add device mapper and crypt-target to the kernel.
So I did, turns out I don't have a crypt target:
$ sudo dmsetup targets
striped v1.4.1
linear v1.1.1
error v1.0.1
The problem is that I don't know how to add such a target.
I think this (not having the crypt target) maybe causing the crypttab configuration to be ignored at boot-time and thus trying to mount the entry in fstab fails because cryptsetup has not mapped my encrypted volume to /dev/mapper/safe_vault.
NOTE:
The encrypted volume can successfully be manually mapped, mounted and written:
$ sudo cryptsetup luksOpen /dev/mapper/<my_logical_group>-safe_vault safe_vault
Enter passphrase for /dev/mapper/<my_logical_group>-safe_vault:
$ sudo mount /dev/mapper/safe_vault /safe_vault
This is how it looks after mapping and mounting it:
$ sudo lsblk -o name,uuid,mountpoint
NAME UUID MOUNTPOINT
sda
├─sda1 28920b00-58d3-4941-889f-6249357c56ee
├─sda2
└─sda5 uhBLE7-Kcfe-RMi6-wrlX-xgVh-JfAc-PiXmBe
├─<my_logical_group>-root (dm-0) 1bed9027-3cf7-4f8d-abdb-28cf448fb426 /
├─<my_logical_group>-swap_1 (dm-1) a40c16c4-7d0c-46d7-afc8-99ab173c20bb [SWAP]
├─<my_logical_group>-home (dm-2) e458abb7-b263-452d-8670-814fa737f464 /home
├─<my_logical_group>-other (dm-3) 0a1eec42-6534-46e1-8eab-793d6f8e1003 /other
└─<my_logical_group>-safe_vault (dm-4) d266ae14-955e-4ee4-9612-326dd09a463b
└─safe_vault (dm-5) 9bbf9f47-8ad8-43d5-9c4c-dca033ba5925 /safe-vault
sr0
UPDATE
- It turns out that I do have the
crypttarget but for it to show up withdmsetup targetsI had to firstcryptsetup luksOpen <my-device> - I've tried using
UUIDs instead according to @Mikhail Morfikov's answer but it still fails at boot-time.
I still think the issue is that somehow the encrypted volume is not being mapped(opened with cryptsetup luksOpen) at boot-time thus no /dev/mapper/<safe_vault or UUID> exists, then trying to mount it (fstab) fails.
UPDATE 2
It turns out I didn't have the necessary scripts to mount at boot time. See the note in @MikhailMorfikov's answer.