Bug 268020 - Notifier does not correctly react to state changes of LUKS devices
Summary: Notifier does not correctly react to state changes of LUKS devices
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-devicenotifier (show other bugs)
Version: 4.8.1
Platform: Gentoo Packages Linux
: NOR major
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-09 00:20 UTC by Markus Lohse
Modified: 2012-09-08 11:20 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9


Attachments
solid-hardware list details (983 bytes, application/x-gzip)
2012-04-23 11:47 UTC, ultr
Details
solid-hardware list details (6.75 KB, application/x-gzip)
2012-05-05 17:24 UTC, ultr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Lohse 2011-03-09 00:20:21 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

While mounting a LUKS encrypted volume works fine the device notifier does not allow to umount/lock it.

Hovering over the mounted device entry opens a tooltip saying: "It is currently safe to remove this device". This is clearly wrong and may lead to data-loss if users actually follow this instruction:
$ mount
/dev/mapper/udisks-luks-uuid-80e9924c-5c3e-42e1-9a8e-31e796ff542f-uid1000 on /media/backup type ext3 (rw,nosuid,nodev,uhelper=udisks)

Reproducible: Always

Steps to Reproduce:
1. plug in a LUKS encrypted usb-disk
2. click the device entry's "unlock"-button
4. enter password
5. click the device entry (not the "unlock"-button this time) to open Dolphin

Actual Results:  
1. the disk shows up as something like "74.5 GiB Encrypted Container"
2. after entering the password, nothing happens (in kde-4.5 another disk entry showed up in the notifier and the "unlock"-button turned into a "lock"-button)
3. Dolphin opens as expected and files can be accessed
4. Device notifier claims it is safe to unplug the hdd at any time (although it is still mounted and used by Dolphin)

Expected Results:  
1. "unlock"-button should turn into "lock"-button after the disk has been unlocked and mounted
2. disk should be marked as "not safe to unplug" while it is mounted/unlocked
Comment 1 Jacopo De Simoi 2011-03-09 08:15:25 UTC
I recall having fixed something like that just before release, maybe some other issue surfaced.
Will check asap.
Comment 2 Pal Körössy 2011-03-22 22:18:45 UTC
Same here on KDE 4.6.1 release:390
Comment 3 Vitor M. Pereira 2011-04-13 16:47:08 UTC
Same problem. It used to be that you could first unmount the encrypted partition and then "lock" it from devicenotifier. Now I have to resort to dolphin to unmount these devices.

$ rpm -q kdelibs kdebase
kdelibs-4.6.1-5.fc14.x86_64
kdebase-4.6.1-3.fc14.x86_64
Comment 4 Markus Lohse 2011-04-16 21:40:52 UTC
Problem still exists in KDE-4.6.2

@Vitor thx for the tip with dolphin - that's indeed way more convenient than running umount and cryptsetup (for locking the disk) from the console.
Comment 5 Mario Santagiuliana 2011-04-23 14:48:39 UTC
Same problem here on Fedora 14 with updated pachages:
$ rpm -q kdelibs kdebase
kdelibs-4.6.2-1.fc14.x86_64
kdebase-4.6.2-1.fc14.x86_64

From Dolphin I can unmount the partition.
Comment 6 Jacopo De Simoi 2011-04-23 18:36:04 UTC
this has been fixed by revision 6315b732cd8c775892d442c5709349e0f66d1f12 
which was intended for bug 271156; 
indeed the cause of the two bugs were the same, so happy locking encrypted devices in 4.6.3!
Comment 7 Jacopo De Simoi 2011-04-23 18:36:12 UTC
this has been fixed by revision 6315b732cd8c775892d442c5709349e0f66d1f12 
which was intended for bug 271156; 
indeed the cause of the two bugs were the same, so happy locking encrypted devices in 4.6.3!
Comment 8 Jacopo De Simoi 2011-04-23 18:36:21 UTC
this has been fixed by revision 6315b732cd8c775892d442c5709349e0f66d1f12 
which was intended for bug 271156; 
indeed the cause of the two bugs were the same, so happy locking encrypted devices in 4.6.3!
Comment 9 Jacopo De Simoi 2011-04-23 18:37:48 UTC
this has been fixed by revision 6315b732cd8c775892d442c5709349e0f66d1f12 
which was intended for bug 271156; 
indeed the cause of the two bugs were the same, so happy locking encrypted devices in 4.6.3!
Comment 10 Jacopo De Simoi 2011-04-23 18:38:40 UTC
argh, sorry for this inordinate mess, konqui/proxy/bko bug
Comment 11 ultr 2011-05-13 02:09:36 UTC
Does this fix resolve the following bug as well?


In KDE 4.6.2 there is a serious problem using LUKS encrypted devices with KDE.

Devices list displays only the encrypted container item. After opening it there is no way to unmount the partition from the Plasma's GUI.

Also the tooltip over the device icon says it is safe to remove the device, which is untrue and causes data loss.

In KDE 4.6.1 (from Debian experimental packages) this worked fine.
Comment 12 ultr 2011-05-27 18:39:40 UTC
This bug is _NOT_ fixed in KDE 4.6.3. Please reopen.

The encrypted device still cannot be unmounted via the DeviceNotifier Plasma applet.


WTF is wrong with today's KDE development? This was working more than fine in 4.6.1. 4.6.2 introduced this (and many more) stupid bugs, and 4.6.3 does not fix it despite of clear bug report and comments. I just can't understand this...

Please, fix old bugs instead of adding new ones into the code that works.
Comment 13 Jacopo De Simoi 2011-05-27 21:17:36 UTC
(In reply to comment #12)
> WTF is wrong with today's KDE development? This was working more than fine in
> 4.6.1. 4.6.2 introduced this (and many more) stupid bugs, and 4.6.3 does not
> fix it despite of clear bug report and comments. I just can't understand
> this...
> 
> Please, fix old bugs instead of adding new ones into the code that works.

Your attitude is absolutely unacceptable, 
We work very hard to first reproduce bugs that users report (and this step usually takes more than you might expect) then we need to understand what can go wrong, eventually find a way to solve the issue on our own test system, check that it does not break other stuff and only after all this we finally declare the issue to be fixed. 

I went thru this procedure and marked the issue as fixed, since I could reproduce it before commit 6315b732cd8c775892d442c5709349e0f66d1f12 and could not reproduce it after. 

If you want to report that the issue is not fixed in 4.6.3, that's excellent.
That's precisely the reason why we need a bug tracker: we simply cannot test the code on every machine out there. Other than that, I'm not overly interested in your opinion on how today KDE development is handled.
Comment 14 ultr 2011-05-28 01:37:16 UTC
Sorry for my previous comment, but I have simply gone mad. I updated my several KDE desktops only for this one patch just to see it doesn't work (again).

I know this is not a place for a discussion about this, but KDE4 really lacks many features KDE3 had and it introduces many new simple but annoying bugs. Fixing these regressions and bugs should, in my opinion, have the highest priority.
However I can see reports of such bugs unresolved for months or even over an year.


As for this particular bug:

It seems decrypt/encrypt actions (icons) are not updated properly.
Updating DeviceNotifier's configuration updates these actions as well, which allows you to close the encrypted device.

Steps to reproduce:
1) Plug in encrypted device: icon = unlocked padlock
2) Open it: icon = unlocked padlock (wrong)
3) Open DeviceNotifier's configuration window, press OK - action gets updated: icon = locked padlock
4) Press the icon - device is closed, but locked padlock icon remains
5) Update the configuration once again - icon = unlocked padlock - you can use it open the device again

The above way does not allow you to unmount the partition only, without locking the encrypted device though, which was possible before. I don't know if this feature is really needed, but I guess it is a change in DeviceNotifier's behavior worth reporting.
Comment 15 Jacopo De Simoi 2011-05-28 04:33:00 UTC
> The above way does not allow you to unmount the partition only, without locking
> the encrypted device though, which was possible before. I don't know if this
> feature is really needed, but I guess it is a change in DeviceNotifier's
> behavior worth reporting.

Yes, that is a known behavior change introduced with the switch to udisks; you can file a separate report for this issue to solid/libsolid-udisks if you can provide some usecase for the old behavior.

As for the main issue of this bug, as I said, I can't reproduce it on master (what will be 4.7), which shares the same relevant code with 4.6; I'll try with 4.6 as soon as I can.
Comment 16 Rodrigo de Farias Gomes 2011-05-29 01:19:35 UTC
(In reply to comment #14)
> Sorry for my previous comment, but I have simply gone mad. I updated my several
> KDE desktops only for this one patch just to see it doesn't work (again).
Count until 10 before post, works for me :-) 

> It seems decrypt/encrypt actions (icons) are not updated properly.
> Updating DeviceNotifier's configuration updates these actions as well, which
> allows you to close the encrypted device.
> 
> Steps to reproduce:
> 1) Plug in encrypted device: icon = unlocked padlock
> 2) Open it: icon = unlocked padlock (wrong)
> 3) Open DeviceNotifier's configuration window, press OK - action gets updated:
> icon = locked padlock
> 4) Press the icon - device is closed, but locked padlock icon remains
> 5) Update the configuration once again - icon = unlocked padlock - you can use
> it open the device again

 I can reproduce this behavior in a notebook with Fedora 14, kde 4.6.3. This bug remains unfixed...

Sorry by the poor english
Comment 17 Jacopo De Simoi 2011-05-29 01:31:25 UTC
@Rodrigo, @ultr:
is there *any* chance you could try with a live cd version kde 4.7 beta 1 to see if this works for you? Just to be sure. 
I would most appreciate this 
__J
Comment 18 ultr 2011-05-29 11:15:23 UTC
Where can I download livecd with KDE 4.7? I haven't found any.
Comment 19 Craig Magina 2011-09-30 13:42:54 UTC
I see this on Kubuntu 11.10 amd64, which is running KDE 4.7.1 currently. The tooltip says it is safe to remove and the padlock does not update, nor is there a button to unmount the device. I am currently working around this by using Dolphin to unmount the device.
Comment 20 ultr 2011-12-01 00:39:11 UTC
Still doesn't work for me in KDE 4.7.2 ;)
Comment 21 ultr 2011-12-28 19:41:00 UTC
In KDE 4.7.4 it still DOES NOT WORK.

What is more, the update-configuration workaround (https://bugs.kde.org/show_bug.cgi?id=268020#c14) does not work anymore.

To be able to unmount encrypted device now you have to:
- open the widget's configuration
- change the devices to be shown
- save configuration
- open the configuration once again
- change the devices back
- save configuration
Comment 22 Daniel Faust 2012-02-13 14:57:50 UTC
*** This bug has been confirmed by popular vote. ***
Comment 23 Jacopo De Simoi 2012-04-22 08:43:09 UTC
The device notifier has been rewritten from scratch for  KDE SC 4.8 and I cannot reproduce the described bug with this version. 
Please test with 4.8, it should be out in most distros by now. Please reopen if the issue is still there.
Comment 24 ultr 2012-04-23 10:43:44 UTC
@Jacopo De Simoi

Tested on Kubuntu 12.04 beta2 with KDE 4.8.1.

It DOES NOT work.

The device is always shown as unmounted no matter what its actual state is.
Device Notifier also always states that 'the device can be removed safely' which can obviously not be true and lead to data loss.

Even refreshing the devices list mentioned in my previous post (#21: https://bugs.kde.org/show_bug.cgi?id=268020#c21) does not work anymore.
Now the only way to safely unmount my encrypted device is via Dolphin.

Here is the way I used to create my device:
http://www.emcken.dk/weblog/archives/164-encrypted-usb-drive-in-ubuntu.html
Maybe this can help with testing.


PS.
There is also another related minor bug in Device Notifier:
Not providing password for the encrypted volume (by pressing Cancel in the password dialog box) still opens the file manager (with home directory), while it should do nothing.
Comment 25 ultr 2012-04-23 10:52:37 UTC
> Tested on Kubuntu 12.04 beta2 with KDE 4.8.1.
Sorry, Kubuntu 12.04 beta2 has KDE 4.8.2.
Comment 26 Jacopo De Simoi 2012-04-23 11:29:26 UTC
Thanks for the quick feedback. Since I cannot reproduce the issue, I have to rely on your feedback to properly deal with this, so I very much appreciate if we can work this quickly. 

Could you please run 

solid-hardware list details 

on a console and attach its output here? 
I would need the output in the following three cases: 
- encrypted device unplugged
- encrypted device plugged but not mounted
- encrypted device mounted

Thanks
__J
Comment 27 ultr 2012-04-23 11:47:00 UTC
Created attachment 70584 [details]
solid-hardware list details

From my PC and VirtualBox. Both look the same:

plugged:
+ udi = '/org/freedesktop/UDisks/devices/sdb'
+ udi = '/org/freedesktop/UDisks/devices/sdb1'

mounted:
+ udi = '/org/freedesktop/UDisks/devices/dm_2d0'
Comment 28 Jacopo De Simoi 2012-05-05 16:18:30 UTC
It seems you attached the output of 

$ solid-hardware list

I do need the output of 

$ solid-hardware list details

Thanks
Comment 29 ultr 2012-05-05 17:24:04 UTC
Created attachment 70878 [details]
solid-hardware list details

Oops. Sorry.
That's strange. I'm almost sure I have added "details" to the command line.


plugged in:

udi = '/org/freedesktop/UDisks/devices/sdb'
  parent = '/org/freedesktop/UDisks'  (string)
  vendor = 'Generic'  (string)
  product = 'Card-Reader'  (string)
  description = 'Generic Card-Reader'  (string)
  Block.major = 8  (0x8)  (int)
  Block.minor = 16  (0x10)  (int)
  Block.device = '/dev/sdb'  (string)
  StorageDrive.bus = 'Usb'  (0x1)  (enum)
  StorageDrive.driveType = 'HardDisk'  (0x0)  (enum)
  StorageDrive.removable = true  (bool)
  StorageDrive.hotpluggable = true  (bool)
  StorageDrive.inUse = false  (bool)
  StorageDrive.size = 7969177600  (0x1db000000)  (qulonglong)

udi = '/org/freedesktop/UDisks/devices/sdb1'
  parent = '/org/freedesktop/UDisks/devices/sdb'  (string)
  vendor = 'Generic'  (string)
  product = 'Card-Reader'  (string)
  description = '7.4 GiB Encrypted Container'  (string)
  Block.major = 8  (0x8)  (int)
  Block.minor = 17  (0x11)  (int)
  Block.device = '/dev/sdb1'  (string)
  StorageAccess.accessible = false  (bool)
  StorageAccess.filePath = ''  (string)
  StorageAccess.ignored = false  (bool)
  StorageVolume.ignored = false  (bool)
  StorageVolume.usage = 'Encrypted'  (0x5)  (enum)
  StorageVolume.fsType = 'crypto_LUKS'  (string)
  StorageVolume.label = ''  (string)
  StorageVolume.uuid = '2b93ed9b-28d8-4497-b90f-0bd73e0110f3'  (string)
  StorageVolume.size = 7968129024  (0x1daf00000)  (qulonglong)


mounted:

udi = '/org/freedesktop/UDisks/devices/sdb'
  parent = '/org/freedesktop/UDisks'  (string)
  vendor = 'Generic'  (string)
  product = 'Card-Reader'  (string)
  description = 'Generic Card-Reader'  (string)
  Block.major = 8  (0x8)  (int)
  Block.minor = 16  (0x10)  (int)
  Block.device = '/dev/sdb'  (string)
  StorageDrive.bus = 'Usb'  (0x1)  (enum)
  StorageDrive.driveType = 'HardDisk'  (0x0)  (enum)
  StorageDrive.removable = true  (bool)
  StorageDrive.hotpluggable = true  (bool)
  StorageDrive.inUse = true  (bool)
  StorageDrive.size = 7969177600  (0x1db000000)  (qulonglong)

udi = '/org/freedesktop/UDisks/devices/sdb1'
  parent = '/org/freedesktop/UDisks/devices/sdb'  (string)
  vendor = 'Generic'  (string)
  product = 'Card-Reader'  (string)
  description = '7.4 GiB Encrypted Container'  (string)
  Block.major = 8  (0x8)  (int)
  Block.minor = 17  (0x11)  (int)
  Block.device = '/dev/sdb1'  (string)
  StorageAccess.accessible = true  (bool)
  StorageAccess.filePath = '/media/35c8e4a2-7a25-498a-8e5d-1560302e6402'  (string)
  StorageAccess.ignored = false  (bool)
  StorageVolume.ignored = false  (bool)
  StorageVolume.usage = 'Encrypted'  (0x5)  (enum)
  StorageVolume.fsType = 'crypto_LUKS'  (string)
  StorageVolume.label = ''  (string)
  StorageVolume.uuid = '2b93ed9b-28d8-4497-b90f-0bd73e0110f3'  (string)
  StorageVolume.size = 7968129024  (0x1daf00000)  (qulonglong)

udi = '/org/freedesktop/UDisks/devices/dm_2d0'
  parent = '/org/freedesktop/UDisks/devices/sdb1'  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = '7.4 GiB Removable Media'  (string)
  Block.major = 252  (0xfc)  (int)
  Block.minor = 0  (0x0)  (int)
  Block.device = '/dev/dm-0'  (string)
  StorageAccess.accessible = true  (bool)
  StorageAccess.filePath = '/media/35c8e4a2-7a25-498a-8e5d-1560302e6402'  (string)
  StorageAccess.ignored = false  (bool)
  StorageVolume.ignored = false  (bool)
  StorageVolume.usage = 'FileSystem'  (0x2)  (enum)
  StorageVolume.fsType = 'ext2'  (string)
  StorageVolume.label = ''  (string)
  StorageVolume.uuid = '35c8e4a2-7a25-498a-8e5d-1560302e6402'  (string)
  StorageVolume.size = 7966031872  (0x1dad00000)  (qulonglong)
Comment 30 Jacopo De Simoi 2012-05-06 09:10:07 UTC
At last! I can finally reproduce this, stay tuned.
Comment 31 Myriam Schweingruber 2012-05-23 09:09:37 UTC
Setting status to confirmed.
Comment 32 Jacopo De Simoi 2012-08-19 16:17:54 UTC
Git commit f817675abe83982b99634a0be663800fd65d18ee by Jacopo De Simoi.
Committed on 19/08/2012 at 17:17.
Pushed by jacopods into branch 'KDE/4.8'.

Ensure slotChanged is called in all instances

Move slotChanged call to the broadcastDone slot
so that it is called in all instances of the device; in fact broadcastDone
is called by dbus.  This makes sure that the device state is correctly updated
when modified by some out-of-process routine, e.g. when mounted via
kde-runtime/soliduiserver actions.

This *should* fix bug 268020, please check

M  +4    -8    solid/solid/backends/udisks/udisksstorageaccess.cpp

http://commits.kde.org/kdelibs/f817675abe83982b99634a0be663800fd65d18ee
Comment 33 Jacopo De Simoi 2012-08-19 16:17:55 UTC
Git commit 886014f477ebddaf7a4e66d795a85ecab7bad617 by Jacopo De Simoi.
Committed on 19/08/2012 at 17:17.
Pushed by jacopods into branch 'KDE/4.9'.

Ensure slotChanged is called in all instances

Move slotChanged call to the broadcastDone slot
so that it is called in all instances of the device; in fact broadcastDone
is called by dbus.  This makes sure that the device state is correctly updated
when modified by some out-of-process routine, e.g. when mounted via
kde-runtime/soliduiserver actions.

This *should* fix bug 268020, please check

M  +4    -8    solid/solid/backends/udisks/udisksstorageaccess.cpp

http://commits.kde.org/kdelibs/886014f477ebddaf7a4e66d795a85ecab7bad617
Comment 34 Jacopo De Simoi 2012-08-19 16:30:53 UTC
@ultr: Could you please check that the commit solves the issue? 
Thanks a lot
Comment 35 Myriam Schweingruber 2012-09-08 11:20:47 UTC
Closing for now, please reopen if this is not fixed for your in KDE 4.9. or later.