Skip to content

Instantly share code, notes, and snippets.

@Nuttymoon
Last active June 9, 2022 11:52
Show Gist options
  • Save Nuttymoon/c82d1164a8285706b09aee4bdbfdfec2 to your computer and use it in GitHub Desktop.
Save Nuttymoon/c82d1164a8285706b09aee4bdbfdfec2 to your computer and use it in GitHub Desktop.
Ubuntu chroot procedure for encrypted systems

Ubuntu chroot procedure for encrypted systems

  1. Boot with a bootable Ubuntu USB
  2. Find the name of the root partition with lsblk
  3. Decrypt the partition using cryptsetup. The mapping name of the device has to be ${DEVICE}_crypt
    sudo cryptsetup luksOpen /dev/nvme0n1p3 nvme0n1p3_crypt
  4. Activate the new volume with vgchange
    sudo vgchange -ay
  5. Create a mount directory and mount the logical volume (found it in /dev/mapper)
    sudo mkdir /mnt/ubuntu-chroot
    sudo mount /dev/mapper/nvme0n1p3_crypt
  6. Mount all the Linux partitions needed for the chroot OS to be fully operational
    sudo mount /dev/nvme0n1p4 /mnt/ubuntu-chroot/boot # boot partition
    sudo mount --bind /dev /mnt/ubuntu-chroot/dev
    sudo mount --bind /dev/pts /mnt/ubuntu-chroot/dev/pts
    sudo mount --bind /proc /mnt/ubuntu-chroot/proc
    sudo mount --bind /sys /mnt/ubuntu-chroot/sys
  7. Chroot into the system
    sudo chroot /mnt/ubuntu-chroot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment