I set up a RAID using this guide: https://wiki.debian.org/SoftwareRAID on a minimal Stretch install.
After that, I cryptsetup luksFormat
'ed /dev/md0
(without using LVM).
The problem is that the encrypted partition isn't unlocked automatically.
My /etc/crypttab
looks like this:
sda2_crypt UUID=ROOTUUID /dev/disk/by-label/USBLABEL:/root.key luks,keyscript=/lib/cryptsetup/scripts/passdev
raid UUID=RAIDUUID /dev/disk/by-label/USBLABEL:/raid.key luks,keyscript=/lib/cryptsetup/scripts/passdev
This loads the key from a USB drive during boot and unlocks the LUKS partition.
It works fine for sda2_crypt
(the rootfs), but not for the raid.
My guess is that mdadm isn't loaded at this point and thus the RAID device doesn't exist. When the machine is booted cryptdisks_start raid
works just fine.
I think the relevant part of the logs is this:
/var/log/syslog:Aug 22 15:09:54 nas systemd[1]: Dependency failed for Cryptography Setup for raid.
/var/log/syslog:Aug 22 15:09:54 nas systemd[1]: Dependency failed for dev-mapper-raid.device.
/var/log/syslog:Aug 22 15:09:54 nas systemd[1]: dev-mapper-raid.device: Job dev-mapper-raid.device/start failed with result 'dependency'.
/var/log/syslog:Aug 22 15:09:54 nas systemd[1]: systemd-cryptsetup@raid.service: Job systemd-cryptsetup@raid.service/start failed with result 'dependency'.
/var/log/syslog:Aug 22 15:13:31 nas systemd[1]: Dependency failed for Cryptography Setup for raid.
/var/log/syslog:Aug 22 15:13:31 nas systemd[1]: systemd-cryptsetup@raid.service: Job systemd-cryptsetup@raid.service/start failed with result 'dependency'.
I've tried to force cryptsetup.target
to wait for systemd-cryptsetup@raid.service
but that didn't work.
This is my first time with systemd and I could really use some help :) Thanks!