Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

My goal is I want to have a Xubuntu/Ubuntu dual boot, with a catch - I want the disk to be fully encrypted with the dm-crypt (native supplied) whole disk encryption. Now I know, out of the box the ubuntu installer is not going to make this simple for me, and maybe this is not doable, because I am not sure I can ultimately trick the tools into creating the two different initrd configurations for each root filesystem.

So questions:

  1. Has anyone done this before and is there a simple way I am missing to do this?

  2. Given (1) is a negative... a. Should I create separate base ecrypted volumes for each installation (xubuntu/ubuntu) or should I just create 1 encrypted volume and separate install partitions inside it? I am leaning toward the latter to make the process simpler. However I am not sure how the boot loader will handle this.

b. Once I get the first laid in, if I go with 1 encrypted volume, how do I decrypt it and install the second distro (and get the boot loader, initrd, etc updated properly)?

I've asked about the security aspects on Security Stack Exchange.

share|improve this question

1 Answer 1

Note: I've answered the question as asked, but what you probably want is my last paragraph.

Manual partitioning and dual boot configurations

You'll need to install from the alternate CD for dmcrypt. Select manual partitioning in the installer. If you want two separate encrypted volumes, make them both primary or extended or EFI partitions, and leave enough room for the other volume when you install the first OS. If you want two Linux distributions that share an encrypted volume (but you probably don't want that as I explain below), create one large encrypted volume and create the filesystems for each OS when you install that OS.

Make the encrypted volume an LVM physical volume and create a volume group that spans just that physical volume. If two operating systems share the encrypted volume, they'll also share the volume group: volume groups are a way to manage multiple volumes, and in that configuration there's just the one. Create at least one logical volume for each root filesystem. If the two OSes share the encrypted volume and you don't want to use hibernation, they can share the swap area.

Leave a large enough boot area, which needs to be unencrypted. I recommend at least 1GB (lets you store a rescue CD in an emergency) unless you're heavily constrained on disk space, but 200MB is enough for just one kernel and one alternate kernel.

Having two separate boot partitions is the simplest way to install. Let one distribution control the boot sector, and install the secondary distribution's bootloader on the first sector of its boot partition. Chainload the secondary distribution's bootloader from the primary bootloader.

If you want a single boot partition, install Grub only on one operating system, and share /boot between the two operating systems.

Installing two Linux distributions

Dual boot is painful to use, and not needed in most situations. If you want to run two operating systems, use some form of virtualization. The only use case I can think of for dual boot is when you need to test multiple operating systems on the same expensive hardware (even then, if you can afford it, it's more convenient to have separate machines per OS).

You will need dual boot if you want two separate Linux installations with different passwords. Even then, you may well be able to implement your desired security policy by issuing separate accounts or by creating separate virtualized containers, each with its own root users.

To run Linux on Linux, you may not even need virtualization: you can run programs from another installation with chroot. With Ubuntu or another Debian-based distribution as the master OS, schroot makes this very easy. If you use schroot with a different secondary distribution, you'll probably need to install it separately, so on a separate volume. If the secondary distribution is Debian-based and you never need to boot it, you can install it in a subdirectory with debootstrap. See my schroot guide.

Ubuntu/Xubuntu dual installation

If you want to try out both Ubuntu and Xubuntu, you don't need all this rigmarole. Xubuntu and Ubuntu are the same distribution with different default packages. Install Ubuntu from any variant and make sure both the ubuntu-desktop and xubuntu-desktop packages are installed. Select your preferred environment when you log in, and you will be using either Ubuntu/Unity aka Ubuntu or Ubuntu/XFCE aka Xubuntu.

share|improve this answer
Well I kind of do need a dual boot. What I am actually wanting to do, is create a dual boot of backbox for infosec work and xunbuntu for daily work, with a common /home directory structure. I would like to use one password and whole disk encryption. – Tek Tengu Mar 11 '13 at 0:46
Actually your response got me thinking... Would using laying down Xubuntu as a base OS that uses whole disk encryption, then use Xen to bare metal virtualize BackBox be possible. I have never used Xen , and my concern with your suggestion of virtualization is that I give up too much "umph" (processing power) when I virtualize one or the other. However using something like Xen that is native virtualization might be an alternative. Thoughts? Any good pointers on how this could be done with whole disk encryption? – Tek Tengu Mar 12 '13 at 11:03
@TekTengu Install both and run one of them in a schroot. There's no special precaution to take at install time except for reserving a logical volume for the other distro when you install the first one (using the single encrypted volume method in my answer). There's no loss of computing power, no inconvenience from dual boot, and the two system installs are wholly separate. – Gilles Mar 12 '13 at 17:58
The one thing I am still trying to figure out is how to order the installations to get them encrypted. I am thinking set up the partitions, and install the non-encrypted distro, then install the encrypted distro... but my concern is that the encryption process will destroy the previously installed distro. If the other way, how do I get the now encrypted disk un-encrypted, or given your schroot option (above) do I do something like copy or slipsteam the binaries to the partition? – Tek Tengu Mar 13 '13 at 10:00
@TekTengu What non-encrypted distro? You can encrypt everything except /boot, and you can have multiple filesystems in logical volumes inside the same encrypted volumes. I don't understand what difficulty you're perceiving. I suggest that you try (just make a basic installation of both distributions), and ask for help if you get stuck somewhere. – Gilles Mar 13 '13 at 19:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.