I recently had the pleasure of installing Xubuntu 16.04.1 with preexisting software RAIDs (mdadm), disk encryption (LUKS), and device mapping (lvm2). It didn't go great and first attempts were met with (initramfs) prompts on boot.
The first sign of trouble was discovering the Xubuntu 16.04.1 installer didn't read the software RAID, so it was time to "Try Xubuntu" for a Live CD installation environment. The Xubuntu 16.04.1 Live CD lacks the mdadm package and will require a network connection (or sneakernet .deb) to install it. Given a network connection, the following commands should make available the LVM volume groups to Xubuntu:
sudo apt-get install mdadm # install mdadm sudo mdadm --assemble --scan # initialize the RAID devices (md0 and md1 in this case) sudo cryptsetup luksOpen /dev/md1 cryptroot # /dev/md1 stores the LUKS volume group of interest sudo lvm vgchange -a y # make the LVM volume groups from cryptsetup available to the system
Now install Xubuntu as normal. I received an inconsistent bootloader install error which locked up the installer, but the important bits are installed before the failure. The next step is fixing the bootloader (so initramfs can correctly decrypt and mount the "real" filesystem) by updating the files/drivers of the initramfs (saved on disk as
/boot/initrd.img-*-generic). Linux includes an
update-initramfs utility for this purpose, but it is built to execute within the "real" filesystem (not the LiveCD) which we're still trying to prepare. Fortunately,
mdadm is included in initramfs by default (
/etc/initramfs-tools/initramfs.conf:MODULES=most), but this may require an update in some cases (e.g.
Actually updating the initramfs fairly straightforward by configuring a fake root then chroot in to execute
update-initramfs. We'll also need to update
/etc/crypttab to configure the LUKS encrypted filesystem or initramfs will fail with some variant of
Volume group "vg0" not found (vg0 being a common LVM Volume Group). The
chroot may be setup as follows (executed by root):
mkdir /fakeroot mount /dev/mapper/vg0-root /fakeroot mount /dev/mapper/vg0-home /fakeroot/home mount /dev/md0 /fakeroot/boot # /boot is stored in a mdadm RAID1 array (md0) mount -t proc proc /fakeroot/proc mount -t sysfs sys /fakeroot/sys mount --bind /dev /fakeroot/dev # make currently loaded devices available in chroot chroot /fakeroot
Configuring LUKS appears to require updating both
/etc/initramfs/initramfs.conf (although the latter may be a bug):
echo <<EOF > /etc/crypttab # <target name> <source device> <key file> <options> cryptroot /dev/md1 none luks # LVM vg0 is stored in a mdadm RAID5 array (md1) EOF echo <<EOF >> /etc/initramfs/initramfs.conf CRYPTSETUP=y EOF
Now it's as simple as running
update-initramfs in the chroot:
update-initramfs -v -c -k all # -v=verbose, -c=create, -k=kernel version (all)
Restart and everything should run smoothly (or at least did in my case).