Installing Kali Linux with LUKS and Onto A USB Flash Drive
Jul 16, 2015
Before starting I highly recommend removing all connected hard drives or installing it inside a VM, otherwise grub might be installed to your hard drive and not the USB flash drive.
There might be an issue with grub not being able to to find the initramfs file and in which case see the references section below.
-
Boot from the Kali Linux ISO and choose ‘Graphical Install’.
-
Install normally and setup LUKS and LVM within the installer. I set my hostname to ‘kali’ so the LVM is named ‘kali’ and the root LVM partition is named ‘kali-root’.
-
After the reboot you shouldn’t be able to boot correctly off of the flash drive. This is because initramfs/grub2 have not been configured correctly by the installer.
- You should be at the initramfs console by now. You will need to unlock the partition so you can fix it.
cryptsetup luksOpen /dev/sdb5 kali lvm vgchange -ay exit
-
You should now be booting into Kali Linux.
-
Open a terminal and copy the UUID of the crypto_LUKS root partition.
blkid
-
Fix your crypttab. (replace ‘your-uuid’ with the UUID from blkid)
nano /etc/crypttab
kali-root UUID=your-uuid none luks
- Create a new config file for initramfs. (replace ‘your-uuid’ with the UUID from blkid)
/etc/initramfs-tools/conf.d/cryptroot target=kali,source=/dev/disk/by-uuid/your-uuid,key=none,lvm=kali-root
-
Install grub to the USB drive (probably not necessary if you unplugged all other drives).
grub-install /dev/sdb
- Update initramfs and grub
update-initramfs -u -k all update-grub
- Reboot to make sure it worked.
References