Add support for partition table inside LUKS on boot

Bug #1786688 reported by Nazar Mokrynskyi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cryptsetup
New
Undecided
Unassigned
cryptsetup (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'd like to have GPT partition table inside LUKS encrypted disk (not partition).

It looks like this:
vda 252:0 0 100G 0 disk
└─test 253:0 0 100G 0 crypt
  ├─test1 253:1 0 20G 0 part
  └─test2 253:2 0 80G 0 part

However, I'm having difficulties achieving this on Ubuntu because of its boot scripts.

2 steps that I needed to make this work.

First is to remove file system type check, since partition table is not a filesystem, so I've edited /usr/share/initramfs-tools/scripts/local-top/cryptroot and commented-out a few lines like this (snippet from 18.04, 18.10 is a bit different but not much):

# if [ -z "$FSTYPE" ]; then
# message "cryptsetup ($crypttarget): unknown fstype, bad password or options?"
# udev_settle
# $cryptremove
# continue
# fi

Second step was to add partprobe to recognize partitions from LUKS container, so that I can mount them in /etc/fstab.
For this I've created a hook:

root@fs-experiments:~# cat /etc/initramfs-tools/hooks/partprobe
#!/bin/sh

cp /sbin/partprobe $DESTDIR/sbin
cp -L /lib/x86_64-linux-gnu/libparted.so.2 $DESTDIR/lib/x86_64-linux-gnu

And a script:

root@fs-experiments:~# cat /etc/initramfs-tools/scripts/local-premount/partprobe
#!/bin/sh

case $1 in
prereqs)
 exit 0
 ;;
esac

partprobe

I'd like to see partitions being supported out-of-the-box so that there is no need to edit system files for such use case.

P.S. I know about LVM and the fact that is it supported out-of-the-box, but I found it extremely painful to use for this use case unfortunately.

Revision history for this message
Nazar Mokrynskyi (nazar-pc) wrote :

The first step is fixed in cryptsetup, would be nice if second part about partprobe was also built-in

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.