From 2e4998ebde5696468faafcc4d684037f789aa465 Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Tue, 7 Nov 2017 23:02:44 -0700 Subject: Add support for encrypted partition tables Previously, it was assumed that the encrypted device contained a single filesystem. Now we run a partprobe on decrypt to detect an existing partition table inside the container. Behavior with devices that just contain a single filesystem is unaffected. This adds the partprobe binary to the initramfs. --- init | 3 +++ mkinitramfs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/init b/init index 06abfc4..8ea174a 100755 --- a/init +++ b/init @@ -108,6 +108,9 @@ setup_encrypted() { read fi + # Probe the new crypto device for an additional partition table + partprobe "/dev/mapper/${name}" 2>/dev/null 1>/dev/null + # Success. Return the path of the decrypted root device echo "/dev/mapper/${name}" } diff --git a/mkinitramfs b/mkinitramfs index 547d436..9ea6760 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -190,7 +190,7 @@ function main { # List of binaries to exist in the new initramfs resolve_bins \ bash cat echo ls cryptsetup chmod chown mount sleep umount clear cut \ - grep less tr which blkid reboot shutdown switch_root + grep less tr which blkid partprobe reboot shutdown switch_root # Set up the archive source dir. -- cgit v1.2.3