I would like to install Ubuntu on a two-disk RAID 1 with dm-integrity and LUKS2-encryption.
Unfortunately, neither Ubiquity, nor the alternative textmode-installer offer such a solution.
Although this seemed simple to do manually, I haven't been able to install the system, yet.
The layout for both drives was as follows:
/dev/sdX1
[ext2] to be used as unencrypted/boot
/dev/sdX2
[unformatted] to be configured in LVM for encrypted/root
&swap
I formatted both drives on a live system in gparted
and then executed cryptsetup luksFormat --type luks2 --integrity hmac-sha256 /<device>/<partition>
for either drive as a basis in order to create the RAID device, LVM and filesystem on top of later in the manual installer.
However, the manual partitioner does not recognise the encrypted partitions and I can't continue to work with them.
How can I "open" the encrypted partitions to set them up for the system installation without re-formatting them first?
Is there anything else that needs to be considered with this approach? Does Ubuntu demand certain LUKS-parameters or is something advisable to use for this purpose?
Do I have to manually add the devices to a file after the installation to be corrctly decrypted at boot? Is the --integrity
option used automatically?
Is this even the best approach or is there another way to accomplish this? (Excluding the usage of Btrfs/ZFS filesystems)
First of all, it's likely safer to create the encrypted volumes in an extended, logical partition if using LVM on it later.
I've tried to format a partition with dm-integrity in Ubuntu 20.04 before opening the installer and while cryptsetup was able to open it, I could not create a volume group or filesystem on it, because
mkfs.ext4
would fail andpvcreate
resulted in:The installer also did not know how to handle the partitions and wouldn't let me create any partitions on it.
I did not try this on a RAID device, but I doubt that would make it any better. I also noticed that dm-integrity creates two crypt devices as seen in
lsblk
:The filesystem creation worked fine on a regular luks device without integrity, so I assume that might be the issue.
When trying to open the dm-integrity device on a virtual console, even after loading all dm-crypt modules, I got the error:
I searched for the error online and found this blog entry, which deals with a very similar issue: https://kenta.blogspot.com/2019/07/ttvdpsoo-installing-ubuntu-with-luks2.html
The author suggests to:
I haven't tried this and can't comment whether this works or not, but I can see that the live system would get the same errors on step 4 while trying to format the new partitions, so it would have to be a system on USB that can somehow format them correctly.
The author also mentions at the end that:
At the moment, this doesn't seem to be possible unfortunately, unless one can somehow copy and reformat the entire system without any further issues. Please feel free to correct me if I made an error or there is another option.