LVM, LUKS and separate /home (or other) during install of (x)Ubuntu 15.10

In general I’m not a huge fan of linux desktops, but XFCE4 is just decent enough that I tend to stick with it.

I had to reinstall my laptop with Xubuntu 15.10 due to a service repair on it, I used to have a custom install with a separate /home, all encrypted with LUKS.

This requires me to either use a keyfile, or input the encryption password twice/trice (once for root, swap and home).
Needless to say, I didn’t want this again.

Apparently there is no documented way to do this using the official installer, but I found some hints around. These are my notes, but first – my sources:
https://askubuntu.com/questions/663332/what-is-the-proper-way-to-install-ubuntu-15-04-with-lvm-luks-and-manual-partit
https://askubuntu.com/questions/654638/how-to-increase-boot-partition-size-when-installing-ubuntu-14-04-using-the-use/678074#678074
http://ftp.dc.volia.com/pub/debian/preseed/partman-auto-recipe.txt

So, apparently what you can do is open partman’s auto-recipe for the installation, edit that around, and suddenly a default LVM with LUKS-install includes a separate /home with some pre-defined sizes.

From the liveCD-environment, before starting the installer, open a terminal.

sudo nano /lib/partman/recipes/30atomic

Find the block that contains “mountpoint{ / }” and in the beginning replace the third value with the max size for your root partition.
Examples, turn this:

500 10000 1000000 ext4
	$primary{ }
	$bootable{ }
	method{ format }
	format{ }
	use_filesystem{ }
	filesystem{ ext4 }
	mountpoint{ / } .

Into this:
500 10000 50000 ext4
        $primary{ }
        $bootable{ }
        method{ format }
        format{ }
        use_filesystem{ }
        filesystem{ ext4 }
        mountpoint{ / } .

Notice that it's the third value that's important, this changes the max-allowed size from "so big it equals max" and down to "50gb".

And then add something like this at the end:
100 10000 1000000000 ext4
        method{ format }
        format{ }
        use_filesystem{ }
        filesystem{ ext4 }
        mountpoint{ /home } .

This will instruct partman to create a separate /home, with "at least" 100mb, and at most "1000000000" (back to the "so big it equals max"-value again) and it makes it so that your root partition wont fill up the drive, or have to split it with your /home.

Save the file, and then start the installer.

Select the default option for doing LVM and LUKS (encrypt my stuff, partition with LVM, or something like that.)

Good luck.

Advertisements