FS#22735 - [initscripts] Unable to open encrypted volume on LVM

Attached to Project: Arch Linux
Opened by Aravind Gottipati (aravind) - Thursday, 03 February 2011, 14:05 GMT
Last edited by Thomas Bächler (brain0) - Friday, 04 February 2011, 22:14 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
I use LVM and an encrypted filesystem on top of LVM. I narrowed down the problem to cryptsetup isLuks command failing on the LVM device. When that happens cryptsetup tries to create the encrypted device and fails. The root of all this seems to be that the lvm devices are not ready by the time the cryptsetup calls are made. Adding a 10s sleep after LVM initializes in rc.sysinit fixed the problem for me. I am running 2.6.37-ARCH, with lvm2 (2.02.81-1) and initscripts (2010.07-2).

Additional info:
* package version(s)
initscripts - 2010.07-2
kernel - 2.6.37-ARCH
lvm2 - 2.02.81-1

* config and/or log files etc.
My /etc/crypttab:
enc_home /dev/lvm_home/home ASK

The fix to /etc/rc.sysinit that fixes the problem for me:

[root@dogmatix ~]# diff -uNr /etc/rc.sysinit.orig /etc/rc.sysinit
--- /etc/rc.sysinit.orig 2011-02-03 05:21:55.820001446 -0800
+++ /etc/rc.sysinit 2011-02-03 05:38:58.073335378 -0800
@@ -152,6 +152,7 @@
stat_done
fi
fi
+ sleep 10
fi

# Set up non-root encrypted partition mappings
[root@dogmatix ~]#


Steps to reproduce:
re-boot your machine with an encrypted partition..
This task depends upon

Closed by  Thomas Bächler (brain0)
Friday, 04 February 2011, 22:14 GMT
Reason for closing:  Fixed
Comment by Ionut Biru (wonder) - Thursday, 03 February 2011, 14:11 GMT
i think this was fixed in initscript 2011.02.1-1 from testing. you should try it
Comment by Aravind Gottipati (aravind) - Thursday, 03 February 2011, 14:48 GMT
I tried initscripts 2011.02.1-1 and that's broken in the same way. Here is a patch to fix 2011.02.1-1. Come to think of it, using this udevadm command should fix the 2010.07-2 problem as well, and is more elegant than the 10s wait.

[root@dogmatix ~]# diff -uNr /etc/rc.d/functions.orig /etc/rc.d/functions
--- /etc/rc.d/functions.orig 2011-02-03 06:43:02.883333211 -0800
+++ /etc/rc.d/functions 2011-02-03 06:43:31.556666882 -0800
@@ -253,6 +253,7 @@
else
stat_fail
fi
+ udevadm settle
}

# Arch cryptsetup packages traditionally contained the binaries
[root@dogmatix ~]#
Comment by Thomas Bächler (brain0) - Thursday, 03 February 2011, 17:25 GMT
Actually, this is a bug in lvm and should be (temporarily) fixed in lvm 2.02.82-2. A permanent solution will hopefully be in the next lvm version.
Comment by Aravind Gottipati (aravind) - Friday, 04 February 2011, 00:23 GMT
cool, thanks for the information - I was wondering how this stuff worked in the past - since the scripts clearly didn't have any kind of sleep or
"udevadmin settle" calls in it. lvm2 itself being broken and causing the problem explains stuff.
Comment by Thomas Bächler (brain0) - Friday, 04 February 2011, 07:20 GMT
Does the lvm update fix it for you?
Comment by Aravind Gottipati (aravind) - Friday, 04 February 2011, 20:25 GMT
Yup, the lvm update fixes the problem. I can now mount encrypted volumes without any sysinit hacks.
Comment by Aravind Gottipati (aravind) - Friday, 04 February 2011, 20:26 GMT
And to be clear, I am now on lvm2 2.02.82-2
Comment by Thomas Bächler (brain0) - Friday, 04 February 2011, 22:13 GMT
Nice, something that works according to plan. Thanks for the quick feedback.

Loading...