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.

  1. Boot from the Kali Linux ISO and choose ‘Graphical Install’.

  2. 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’.

  3. 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.

  4. 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
    
  5. You should now be booting into Kali Linux.

  6. Open a terminal and copy the UUID of the crypto_LUKS root partition. blkid

  7. Fix your crypttab. (replace ‘your-uuid’ with the UUID from blkid) nano /etc/crypttab kali-root UUID=your-uuid none luks

  8. 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
    
  9. Install grub to the USB drive (probably not necessary if you unplugged all other drives). grub-install /dev/sdb

  10. Update initramfs and grub
    update-initramfs -u -k all
    update-grub
    
  11. Reboot to make sure it worked.

References

Comments