I am trying to setup an encrypted disk using LUKS on a software RAID that was setup using mdadm
on 14.04.1 LTS (GNU/Linux 3.8.13.26 armv7l) (Odroid U3).
The problem is that the LUKS container is not automatically unlocked upon boot and I have no clue why or where to look for issues.
Problem
The software RAID is working fine if I format it with ext4
and put it in the fstab for automounting.
Also if I use LUKS separately (without RAID, just on /dev/sda1
) it works without problems and the device shows up in /dev/mapper
when configured in /etc/crypttab
.
The problem appears when combining the two. The RAID device shows up as /dev/md0
but the LUKS container is not automatically mounted into /dev/mapper/crypt
. On the other hand, using sudo cryptdisks_start crypt
after booting works without any problems. Also, I ran sudo update-initramfs -u -k all
after setting up the /etc/crypttab
(see output below).
mdadm
sudo cat /proc/mdstat
gives the following output:
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
976596800 blocks super 1.2 [2/2] [UU]
[>....................] resync = 0.6% (6345024/976596800) finish=1342.7min speed=12042K/sec
unused devices: <none>
And the /etc/mdadm/mdadm.conf
has the following line:
ARRAY /dev/md/0 metadata=1.2 UUID=f2c7b09f:71620ae5:7b6ec321:e9ce02cc name=odroid:0
crypttab
# <target name> <source device> <key file> <options>
usb-crypt /dev/md0 None luks,keyscript=/home/user/key.sh
syslog
Oct 22 06:34:40 odroid kernel: [ 9.283025] md: bind<sda1>
Oct 22 06:34:40 odroid kernel: [ 9.302273] md: raid1 personality registered for level 1
Oct 22 06:34:40 odroid kernel: [ 9.302817] md/raid1:md0: not clean -- starting background reconstruction
Oct 22 06:34:40 odroid kernel: [ 9.302826] md/raid1:md0: active with 2 out of 2 mirrors
Oct 22 06:34:40 odroid kernel: [ 9.302878] md0: detected capacity change from 0 to 1000035123200
Oct 22 06:34:40 odroid kernel: [ 9.305140] md: resync of RAID array md0
Oct 22 06:34:40 odroid kernel: [ 9.305149] md: minimum _guaranteed_ speed: 1000 KB/sec/disk.
Oct 22 06:34:40 odroid kernel: [ 9.305153] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.
Oct 22 06:34:40 odroid kernel: [ 9.305162] md: using 128k window, over a total of 976596800k.
Oct 22 06:34:40 odroid kernel: [ 9.305166] md: resuming resync of md0 from checkpoint.
Oct 22 06:34:41 odroid kernel: [ 9.499399] md0: unknown partition table
update-initramfs
sudo update-initramfs -u -k all
:
update-initramfs: Generating /boot/initrd.img-3.8.13.26
update-initramfs: Generating /boot/initrd.img-3.8.13.23
WARNING: missing /lib/modules/3.8.13.23
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.8.13.23: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_PDBSh1/lib/modules/3.8.13.23/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_PDBSh1/lib/modules/3.8.13.23/modules.builtin: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.8.13.18
grep: /boot/config-3.8.13.18: No such file or directory
WARNING: missing /lib/modules/3.8.13.18
Device driver support needs thus be built-in linux image!
depmod: ERROR: could not open directory /lib/modules/3.8.13.18: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_r2PYwd/lib/modules/3.8.13.18/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_r2PYwd/lib/modules/3.8.13.18/modules.builtin: No such file or directory
From what I understand this is kind of OK.
/etc
)init.d/mdadm
,init/cryptdisks
, andinit/cryptdisks-early
. Look at the start conditions to devise the running order or take a look at the boot logs./etc/init/cryptdisks
statesstart on stopped udevtrigger or container
and I don't know how to put an init.d script as a dependency there (mdadm-raid is ininit.d
).I tried to override the upstart scripts forcryptdisks
andcryptdisks-udeve
and install the init.d scripts instead but this also didn't help. Is there a way to get more log-output somehow?