Ubuntu – How to repair a Ubuntu 14.04 RAID-LVM-DM-CRYPT-LUKS Physical to Virtual system that won’t boot

dmcryptlukslvmraidUbuntu

I can't get a Ubuntu 14.04 Virtual server to boot correctly.
It's recently been cloned "dd if=/dev/sda of=vmimage"
The Physical has a RAID1-LVM-DMCRYPT-LUKS configuration,
The boot sequence aborts and drop to the BusyBox shell.

Begin: Waiting for encrypted source device

I can see above the message that it was unable to find any volume groups.

No volume groups found

I suspect this is due to the raid not starting up correctly.

Looking at /proc/mstat indicates that md0 is active and md1 is inactive

I have to stop md1, and force it with –run to start

mdadm --stop /dev/md1
mdadm --assemble /dev/md1 /dev/sda2 --run

I am now able to mount partitions on /dev/md0 and unlock the dmcrypt volume manually if I so desire.

If I exit the shell, it tries to unlock the dmcrypt container, but still fails to boot.

enter image description here

How do I fix this?

Best Answer

Your problem is caused by booting with one virtual disk cloned from two physical disks. After manually booting, you could try this if you have md0 uncrypted and md1 crypted :

vi /etc/initramfs-tools/scripts/local-top/workaround_mdadm : #!/bin/sh sleep 5 mdadm --stop /dev/md1 mdadm --stop /dev/md0 sleep 5 mdadm --assemble --scan Note : Feel free to change the sleep values as well.

Make the file executable : chmod 755 /etc/initramfs-tools/scripts/local-top/workaround_mdadm

Create new initrd files in /boot : update-initramfs -k all -c

Reboot with your virtual disk and check if you are prompted for a passphrase.

Related Topic