Bug 181847

Summary: Dolphin doesn't show crypt_LUKS partition (on built-in harddrive) in"Places"
Product: [Frameworks and Libraries] solid Reporter: Thomas Weissel <xapient>
Component: libsolid-udisksAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED FIXED    
Severity: normal CC: disp.reg.bugs.kde, gilbertd+kde, khashayar.lists, lukas, neil.castine, rico, stuart
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch that allows mounting and unmounting of luks part
V2 of kde4libs patch for crypto devices, now marks non-partition (e.g. lvm) Luks as crypto storage volumes
Patch against 4.6.2 (kubuntu package)
v4 of crypto patch, against current git

Description Thomas Weissel 2009-01-25 10:43:50 UTC
Version:            (using KDE 4.1.96)
OS:                Linux
Installed from:    Ubuntu Packages

I have a built-in sataII disk with LUKS partitions... i need to open a terminal to acces them, while the same disk plugged in with USB would show up in the "places" sidebar and a single click would ask for the lukspassphrase.
Comment 1 Khashayar 2009-10-26 22:21:21 UTC
I can confirm this bug.

I have an external disk that I connect through an e-sata connection. Nothing shows up in dolphin or the device notifier plasma widget. I need to manually "cryptsetup luksOpen", after which the device is detected by KDE and shown in dolphin.

As a comparison, in a gnome environment, a dialog pops up at connection, asking me for a password.

Ideally, a similar KDE dialog would allow one to choose a keyfile as an alternative to entering a pass phrase.
Comment 2 Stuart Morgan 2010-04-04 17:40:30 UTC
This appears to be a regression, earlier versions of KDE 4 would automatically behave as described above. The drive/device would appear in the dolphin panel, selecting the device would prompt for the password and if correct, mount and display the drive contents. This no longer occurs KDE 4.3.x
Comment 3 simon 2010-06-26 13:52:10 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 Dave Gilbert 2010-12-31 19:47:55 UTC
I'm digging on this a bit, and just thought I'd like to say how far I'd got, I'm at the point of needing to understand a bit more about udisks flags;

kfileplaces gets it's info from 'solid', and if I do

  solid-hardware list details

I get for my crypto backing device:

udi = '/org/freedesktop/UDisks/devices/dm_2d0'
  parent = '/org/freedesktop/UDisks'  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = '10.0 GiB Hard Drive'  (string)
  Block.major = 252  (0xfc)  (int)
  Block.minor = 0  (0x0)  (int)
  Block.device = '/dev/dm-0'  (string)
  StorageAccess.accessible = false  (bool)
  StorageAccess.filePath = ''  (string)
  StorageAccess.ignored = true  (bool)
  StorageDrive.bus = 'Platform'  (0x5)  (enum)
  StorageDrive.driveType = 'HardDisk'  (0x0)  (enum)
  StorageDrive.removable = false  (bool)
  StorageDrive.hotpluggable = false  (bool)
  StorageDrive.inUse = false  (bool)
  StorageDrive.size = 10737418240  (0x280000000)  (qulonglong)

note the 'StorageAccess.ignored = true' - and I think that's the reason it doesn't appear - so where does that come from?

Well, solid/solid/backends/udisks/udisksstorageaccess.cpp and udisksstoragevolume.cpp call ->isDeviceBlacklisted()

and udisksdevice.cpp defines isDeviceBlacklisted() as:


bool UDisksDevice::isDeviceBlacklisted() const
{
    return property("DevicePresentationHide").toBool() || property("DevicePresentationNopolicy").toBool() ||
            property("DeviceMountPaths").toStringList().contains("/boot") ||
            property("IdLabel").toString() == "System Reserved" ||
            property("IdUsage").toString().isEmpty();
}

Now, for my luks partition we have (from udisks --show-info):

presentation hide:  0
presentation nopolicy: 1
mount paths:
label:
usage: crypto

So it looks like the problem here is 'nopolicy'.

Whether it's udisks problem in setting it, or solid's udisks backend for caring about it I haven't figured out yet.

Dave
Comment 5 Dave Gilbert 2011-01-01 00:54:14 UTC
Well, here is a DANGEROUS half working patch:


--- kde4libs-4.5.90/solid/solid/backends/udisks/udisksdevice.cpp        2010-12-01 22:23:26.000000000 +0000
+++ kde4libs-4.5.90-daveg/solid/solid/backends/udisks/udisksdevice.cpp  2010-12-31 22:50:20.739968001 +0000
@@ -714,7 +714,7 @@
 
 bool UDisksDevice::isDeviceBlacklisted() const
 {
-    return property("DevicePresentationHide").toBool() || property("DevicePresentationNopolicy").toBool() ||
+    return property("DevicePresentationHide").toBool() || /* property("DevicePresentationNopolicy").toBool() || DaveG */
             property("DeviceMountPaths").toStringList().contains("/boot") ||
             property("IdLabel").toString() == "System Reserved" ||
             property("IdUsage").toString().isEmpty();

So why is it dangerous? Well:
   1) I don't know what other type of device might show up that shouldn't - but hey it's fine here on that count.

   2) OK, here's the real problem - when you unmount a crypted non-removable it doesn't do a luksClose - so even though it asks you for the password again when you double click, it doesn't really need to. (I checked, it's fine with removables, so the removable path must do something else).

Still, I believe it is right to remove the check for DevicePresentationNopolicy since the uDisks docs describes it as:
   'A hint if the device (or e.g. the multi-disk device that the device is part of) shouldn't be automatically mounted / assembled.'

and we're not trying to do anything automatic.

Incidentally the other thing that this doesn't fix, is that the device notifier doesn't show the crypted partition even when it's on 'All devices' - even though Dolphin does (and I'd assumed they used the same list)

Dave
Comment 6 Dave Gilbert 2011-01-01 23:16:07 UTC
Created attachment 55456 [details]
Patch that allows mounting and unmounting of luks part

OK, new version (against 4.5.90 as of current Kubuntu Natty)
This succesfully mounts and unmounts (and closes the Luks device) in Dolphin.
The device notifier still doesn't see it.

It's my first change to the solid and udisks stuff so constructive comments welcome, but otherwise it would be nice to add.

Dave
Comment 7 Dave Gilbert 2011-01-02 18:04:14 UTC
Created attachment 55475 [details]
V2 of kde4libs patch for crypto devices, now marks non-partition (e.g. lvm) Luks as crypto storage volumes

Now marks an LVM Luks partition as a StorageVolume with a usage of Encrypted - you now get it shown as encrypted/locked in Dolphin.

Device notifier still isn't that happy; I'm still looking at that - but I'm pretty convinced this patch covers what's needed in Solid and for Dolphin.

Dave
Comment 8 Neil 2011-02-13 20:44:51 UTC
I've applied this patch to KDE 4.6.0 on my Kubuntu 10.10 box and it has been working well for the past few weeks. Without this fix I had to use Nautilus instead of Dolphin to graphically mount my LUKS partitions that were on LVM. It would be great to see this patch get into 4.6.1.

In my case the LVM partitions are on a fixed disk so I don't mind that this patch does not have device notifier support. What it does so far works great for me.
Comment 9 Dave Gilbert 2011-04-29 19:19:55 UTC
Created attachment 59442 [details]
Patch against 4.6.2 (kubuntu package)

Hi,
  Attached is an updated version of the patch against the Kubuntu Natty KDE packages.
(I've just kicked off a ppa build at
https://launchpad.net/~ubuntu-treblig/+archive/kdefixes
but I'm guessing it'll take a while)

This mostly seems to work but I've had a few nepomuk crashes with my local build that I've not tracked down yet.

Dave
Comment 10 Dave Gilbert 2011-05-01 00:56:14 UTC
Well the PPA is built and seems to work fine (no repeat of the nepomuk problems I had with the local build I did).

So please test & report any issues.

I'd appreciate if this could get merged into main KDE.

Dave
Comment 11 Dave Gilbert 2011-09-04 16:42:40 UTC
Created attachment 63376 [details]
v4 of crypto patch, against current git
Comment 12 Lukáš Tinkl 2011-10-18 17:15:38 UTC
Git commit e1b3ce8115795e85f13b16011634cad3f8ee1e28 by Lukas Tinkl.
Committed on 18/10/2011 at 19:14.
Pushed by lukas into branch 'KDE/4.7'.

Show LUKS crypted partitions on local hard drive in Dolphin

REVIEW: 102529
BUG: 181847

M  +3    -2    solid/solid/backends/udisks/udisksdevice.cpp
M  +9    -3    solid/solid/backends/udisks/udisksstorageaccess.cpp
M  +1    -1    solid/solid/backends/udisks/udisksstorageaccess.h

http://commits.kde.org/kdelibs/e1b3ce8115795e85f13b16011634cad3f8ee1e28
Comment 13 Lukáš Tinkl 2011-10-18 17:18:24 UTC
Git commit e0a6171e0a9dc5471ae3dc956e6f401a04b0f9d9 by Lukas Tinkl.
Committed on 18/10/2011 at 19:14.
Pushed by lukas into branch 'frameworks'.

Show LUKS crypted partitions on local hard drive in Dolphin

REVIEW: 102529
BUG: 181847

M  +3    -2    tier1/solid/solid/backends/udisks/udisksdevice.cpp
M  +9    -3    tier1/solid/solid/backends/udisks/udisksstorageaccess.cpp
M  +1    -1    tier1/solid/solid/backends/udisks/udisksstorageaccess.h

http://commits.kde.org/kdelibs/e0a6171e0a9dc5471ae3dc956e6f401a04b0f9d9
Comment 14 Dave Gilbert 2011-10-19 00:25:44 UTC
Thanks Lukas!

Dave