[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#767832: Initramfs provided in initramfs-tools_0.118_all won’t automount luks partitions at boot



Control: retitle 767832 cryptsetup: does not decrypt a split /usr as required by initramfs-tools >= 0.118
Control: reassign 767832 cryptsetup
Control: found 767832 cryptsetup/2:1.6.6-3
Control: affects 767832 initramfs-tools
Control: tags 767832 + patch

I think this is a cryptsetup bug. The attached patch solves my test-case
in a virtual machine.

Regards,
    S
diffstat for cryptsetup-1.6.6 cryptsetup-1.6.6

 changelog                |    8 ++++++++
 initramfs/cryptroot-hook |   11 +++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff -Nru cryptsetup-1.6.6/debian/changelog cryptsetup-1.6.6/debian/changelog
--- cryptsetup-1.6.6/debian/changelog	2014-10-22 18:28:59.000000000 +0100
+++ cryptsetup-1.6.6/debian/changelog	2014-11-27 10:13:13.000000000 +0000
@@ -1,3 +1,11 @@
+cryptsetup (2:1.6.6-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/initramfs/cryptroot-script: decrypt /usr as well as / so that
+    split-/usr will work with initramfs-tools (>= 0.118). (closes: #767832)
+
+ -- Simon McVittie <smcv@debian.org>  Thu, 27 Nov 2014 10:12:15 +0000
+
 cryptsetup (2:1.6.6-3) unstable; urgency=medium
 
   * debian/initramfs/cryptroot-script: fix environment variable $CRYPTTAB_TRIED
diff -Nru cryptsetup-1.6.6/debian/initramfs/cryptroot-hook cryptsetup-1.6.6/debian/initramfs/cryptroot-hook
--- cryptsetup-1.6.6/debian/initramfs/cryptroot-hook	2014-10-02 12:20:55.000000000 +0100
+++ cryptsetup-1.6.6/debian/initramfs/cryptroot-hook	2014-11-27 10:27:45.000000000 +0000
@@ -16,8 +16,9 @@
 
 . /usr/share/initramfs-tools/hook-functions
 
-get_root_devices() {
+get_fs_devices() {
 	local device mount type options dump pass
+	local wantmount="$1"
 
 	if [ ! -r /etc/fstab ]; then
 		return 1
@@ -25,7 +26,7 @@
 
 	grep -s '^[^#]' /etc/fstab | \
 	while read device mount type options dump pass; do
-		if [ "$mount" = "/" ]; then
+		if [ "$mount" = "$wantmount" ]; then
 			local devices
 			if [ "$type" = "btrfs" ]; then
 				for dev in $(btrfs filesystem show $(canonical_device "$device" --no-simplify) 2>/dev/null | sed -r -e 's/.*devid .+ path (.+)/\1/;tx;d;:x') ; do
@@ -611,6 +612,7 @@
 
 setup="no"
 rootdevs=""
+usrdevs=""
 resumedevs=""
 
 # Include cryptsetup modules, regardless of _this_ machine
@@ -621,16 +623,17 @@
 
 # Find the root and resume device(s)
 if [ -r /etc/crypttab ]; then
-	rootdevs=$(get_root_devices)
+	rootdevs=$(get_fs_devices /)
 	if [ -z "$rootdevs" ]; then
 		echo "cryptsetup: WARNING: could not determine root device from /etc/fstab" >&2
 	fi
+	usrdevs=$(get_fs_devices /usr)
 	resumedevs=$(get_resume_devices)
 	initramfsdevs=$(get_initramfs_devices)
 fi
 
 # Load the config opts and modules for each device
-for dev in $rootdevs $resumedevs $initramfsdevs; do
+for dev in $rootdevs $usrdevs $resumedevs $initramfsdevs; do
 	if ! modules=$(add_device "$dev"); then
 		echo "cryptsetup: FAILURE: could not determine configuration for $dev" >&2
 		continue

Reply to: