cryptdisks failure when called from udev

Bug #178829 reported by KM on 2007-12-27
12
Affects Status Importance Assigned to Milestone
cryptsetup (Ubuntu)
Low
Reinhard Tartler

Bug Description

Binary package hint: cryptsetup

Today I configured encrypted backup on an external hard drive, mostly based on
http://www.saout.de/tikiwiki/tiki-index.php?page=EncryptedDeviceUsingLUKS

For convenience of testing I first set it up on a laptop running Debian sid/Lenny. Part of the config includes a udev rule which I placed in /etc/udev/rules.d/50-nick.rules:

   KERNEL=="sd?1", ATTRS{serial}=="DEF10BBE1D0D", NAME="$kernel", \
      SYMLINK+="bakker", RUN+="/usr/sbin/invoke-rc.d cryptdisks restart cryptbak"

This worked fine. On plugging the hard drive cable into a USB port on the laptop, udev creates the symlink, calls cryptdisks to create the mapping (via an entry in /etc/crypttab), and a user can then mount the drive.

The same configuration on a PC running Ubuntu 7.10 did not work. When run from udev (and only then) the cryptdisks call failed with

   exec: 34: env: not found

I found that I could make it work by removing some lines from
/lib/cryptdisks/cryptdisks.functions. These are lines 30-34:

   # Always output to console
   stdin=`readlink /proc/self/fd/0`
   if [ "${stdin#/dev/null}" != "$stdin" ] && [ "$ON_VT" != "yes" ]; then
       exec env ON_VT=yes /usr/bin/openvt -f -c `fgconsole` -w $0 "$@"
   fi

The lines are not present in the current Debian sid package, Version 2:1.0.5-1.
Whether this is the best or correct way I have no idea, but the encrypted backup now works on 7.10.

About the PC,

$ uname -a
Linux carbon 2.6.22-14-server #1 SMP Tue Dec 18 05:52:24 UTC 2007 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 7.10
Release: 7.10
Codename: gutsy

cryptsetup is Version: 3.0.0-3ubuntu2.

Thanks for any comments.

Baronek (baronek1) wrote :

This problem was also found and solved as outlined when usuing encrypted filesystem with CONCURENCY=shell (with none it works perfectly)

Call to /etc/init.d/cryptdisks will fail with the same message, removing this lines helped and everthing works now

Reinhard Tartler (siretart) wrote :

oh, indeed. the 'env' call should be with path, since PATH is not set from within the udev rules, I suspect.

Changed in cryptsetup:
assignee: nobody → siretart
importance: Undecided → Low
status: New → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cryptsetup - 2:1.0.6-1ubuntu3

---------------
cryptsetup (2:1.0.6-1ubuntu3) intrepid; urgency=low

  * Parse comments in lines not starting with '#', LP: #185380
  * in cryptroot hook, don't rely on 'udevadm settle' to wait long enough
    for the cryptdevice to appear. Reimplement the busy waiting loop found
    while waiting for the root file system. Patch based on work by Swâmi
    Petaramesh. LP: #164044
  * debian/crypdisks.functions: call 'env' with full path. LP: #178829.

 -- Reinhard Tartler <email address hidden> Mon, 26 May 2008 22:12:32 +0200

Changed in cryptsetup:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers