Bug 15285

Summary: Unable to mount encrypted volumes
Product: hal Reporter: Sam Morris <sam>
Component: haldAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: danny.kukawka
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Sam Morris 2008-03-31 07:41:14 UTC
[ forwarded from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467200 ]


I am no longer able to mount an encrypted volume. The last time I tried
was a couple of months ago, when it worked.

When I insert the device, I am prompted for my passphrase. Even through
I enter it correctly, I am prompted again. If I enter it a second time,
the prompt goes away, and a device-mapper mapping is created for the
device, but the volume does not get mounted. In fact, the '300 GB
volume' icon disappears from computer:/// entirely!

Some digging around lead to the gnome-mount utility. If I manually
deactivate the device-mapper mapping and try to use it, I get the
following errors:

 $ gnome-mount -t -d /dev/sda1
 gnome-mount 0.7
 Enter password to unlock encrypted data for /dev/sda1: 
 Setup clear-text device for /dev/sda1.
 Clear text device is /dev/dm-2. Mounting.
 
 ** (gnome-mount:6191): WARNING **: /org/freedesktop/Hal/devices/volume_part_1_size_0 does not have a mountable filesystem

O RLY?

 # file -s /dev/dm-2
 /dev/dm-2: Linux rev 1.0 ext3 filesystem data (large files)

Well, let's try to mount it again:

 $ gnome-mount -t -d /dev/dm-2
 gnome-mount 0.7
 GConf Error: Bad key or directory name: "/system/storage/default_options/(null)/fstype_override": `(' is an invalid character in key/directory names

 ** (gnome-mount:6233): WARNING **: Mount failed for /org/freedesktop/Hal/devices/volume_part_1_size_0
 org.freedesktop.DBus.Error.UnknownMethod : Method "Mount" with signature "ssas" on interface "org.freedesktop.Hal.Device.Volume" doesn't exist

Let's try manually:

 # mount /dev/dm-2 /mnt; echo $?
 0

Success!
Comment 1 Sam Morris 2008-03-31 07:47:33 UTC
Also filed with GNOME at <http://bugzilla.gnome.org/show_bug.cgi?id=525346>.
Comment 2 Sam Morris 2008-04-19 12:00:55 UTC
I added the following udev rule:

 # ignore device mapper nodes
 # http://bugzilla.gnome.org/show_bug.cgi?id=525346
 # https://bugs.freedesktop.org/show_bug.cgi?id=15285
 KERNEL="dm-[0-9]*", OPTIONS+="ignore_device"

and now everyhing works again. I think HAL should handle the case where /dev/dm-* devices are created as well as symlinks in /dev/mapper.
Comment 3 Sam Morris 2008-04-19 17:30:43 UTC
Ok, forget the last message. I think the source of this problem is really that HAL does not ignore the 'temporary-cryptsetup' mapping created by cryptsetup during the luksOpen operation.

http://gitweb.freedesktop.org/?p=hal.git;a=commit;h=0f2dfc66d1f92aaf464adadeaf327d5a31e0ebcb was committed to avoid this problem but it does not work. I added an else clause to the if, containing some debugging code, and it revealed:

Apr 20 01:26:51 xerces hald[28904]: 01:26:51.013 [I] osspec.c:238: Not doing workaround; hotplug_event->sysfs.device_file == '/dev/dm-2' 

So another workaround needs to be found.

BTW, can anyone point me to the udev fix mentioned in that commit log?
Comment 4 Sam Morris 2008-04-21 11:44:24 UTC
More info and information about workarounds can be found: http://lists.freedesktop.org/archives/hal/2008-April/011440.html
Comment 5 Danny Kukawka 2011-08-26 04:29:26 UTC
IIRC this is already fixed in latest HAL git code.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.