Skip to content

Instantly share code, notes, and snippets.

@peci1
Last active June 5, 2026 00:05
Show Gist options
  • Select an option

  • Save peci1/241a5fb3c5343404fcd6530350646fe5 to your computer and use it in GitHub Desktop.

Select an option

Save peci1/241a5fb3c5343404fcd6530350646fe5 to your computer and use it in GitHub Desktop.
Ubuntu 26.04 install encrypted to an existing partition

Ubuntu 26.04 installed (subiquity) supports GUI-configured disk encryption, but only if you wipe the whole disk. That is often not suitable, so this tutorial shows how to work around it.

Initial state

You have a harddrive with several installed operating systems (including e.g. Windows).

Target state

You want to replace one of the installed systems with 26.04 which is encrypted and TPM-unlocked.

Warning

Everything you'll do in this guide is super dangerous and total data loss is just a few bad commands away.

Steps

  1. Make sure you have your Windows recovery keys if Windows is installed (as well as passwords/recovery keys of all other encrypted filesystems).
  2. Boot the live USB
  3. Get up to disk partitioning (select manual partitioning) in the installer.
  4. Delete the partition you want to replace. Instead of it, create first a 2 GB partition mounted to /boot and the rest of the free space should be for / partition.
  5. Finish installation.
  6. Follow https://karthikkaranth.me/blog/setting-up-luks-encryption-on-an-existing-ubuntu-partition/ to encrypt the partition
  7. Try rebooting and booting into the system. You'll have to type in the drive password.
  8. If succeeded, configure TPM unlocking according to https://www.reddit.com/r/Ubuntu/comments/1su9ojt/upgrading_from_2404_to_2604_migrate_to_tpm_backed/ .
  9. Voila, the system boots and most of the time it doesn't ask you for the drive's password!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment