By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 1450 - TDEHWLIB won't remove device icons from the desktop w/o suid /usr/bin/eject
Summary: TDEHWLIB won't remove device icons from the desktop w/o suid /usr/bin/eject
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: tdelibs (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: Other Linux
: P5 major
Assignee: Timothy Pearson
URL:
Depends on:
Blocks:
 
Reported: 2013-04-12 20:51 CDT by Darrell
Modified: 2013-04-20 19:55 CDT (History)
3 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments
Screen shots of popup device icon popup menus (22.91 KB, image/png)
2013-04-19 16:50 CDT, Darrell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darrell 2013-04-12 20:51:07 CDT
Latest GIT, Slackware 14.0.

This is a bug discussed in bug report 850 that is not yet resolved.

When I select Safely Remove for a device icon on the desktop, the device will unmount but Trinity does not remove the icon from the desktop.

When I set /usr/bin/eject suid (chmod 4755) then Trinity removes the icon.

I don't need to set suid with other desktops.
Comment 1 Timothy Pearson 2013-04-15 03:01:03 CDT
Do you know how the other desktops have access to the underlying block device in order to eject it?  Fundamentally this is a permissions issue; the other desktops you mention must use a different mechanism to which your user has had access granted.
Comment 2 Darrell 2013-04-15 12:06:25 CDT
I have KDE4 and Xfce installed and have access to 3.5.10 and 3.5.13 in virtual machines.

That suid is needed indicates something of a permissions issue, but where I don't know. That said, the 3.5.10 and 3.5.13 systems are HAL based. I'm guessing with the HAL systems that HAL notified everything of device changes and any related software needed to use those announcements accordingly.

My current system has udisks and udisks2 installed.

I noticed something related. Although the icon does not immediately disappear when selecting Safely Remove, as was the case in earlier versions of Trinity and KDE on HAL systems, the device is unmounted when selecting Safely Remove. Only when I physically remove the device does the icon disappear.

Similarly with my camera, powering off the device while connected causes the icon to disappear.

Possibly tdehwlib is removing the icons but not at the correct time.

I'll troubleshoot, but I don't know where to start.
Comment 3 Timothy Pearson 2013-04-15 13:02:59 CDT
It looks like the other desktops you mention use udisks2 to get around the permissions problem.  I have committed initial support for the udisks2 eject command in GIT hashes 43e1392 and 670690f.
Comment 4 Darrell 2013-04-15 13:15:20 CDT
Thanks. :) I'm kind of busy today. I will report late tonight or tomorrow on the results for this report.
Comment 5 Darrell 2013-04-16 00:33:29 CDT
Test results:

The icon does not disappear when selecting Safely Remove. The icon unmounts with Safely Remove but disappears after I remove the device.

On the desktop I lost my Trash icon and a $HOME/Desktop *.desktop file. The $HOME/Desktop file is a shortcut for the eject -T command for my DVD drive. Probably a coincidence because I can't get any of the other special device icons to appear on the desktop.
Comment 6 Darrell 2013-04-16 00:44:38 CDT
The following device icons appear on the desktop when enabled:

Unmount Floppy
Unmounted Hard Disk partition
Unmounted NFS Share
Comment 7 Darrell 2013-04-16 07:42:48 CDT
I forgot to add I need suid for /usr/bin/eject and none of the special device icons appear when using a fresh profile.
Comment 8 Timothy Pearson 2013-04-16 08:07:30 CDT
Do you have udisks2 installed on your system?
Comment 9 Darrell 2013-04-16 09:19:35 CDT
Yes, udisks2-1.98 (and udisks-1.0.4).

Start Trinity with a fresh profile to verify none of the special device icons appear. In the past all of them appeared on the desktop with a fresh profile.

I don't know how that is related to the ~/Desktop/*.desktop shortcut no longer appearing either. :)
Comment 10 Timothy Pearson 2013-04-16 10:31:15 CDT
(In reply to comment #9)
> Yes, udisks2-1.98 (and udisks-1.0.4).
> 
> Start Trinity with a fresh profile to verify none of the special device icons
> appear. In the past all of them appeared on the desktop with a fresh profile.
> 
> I don't know how that is related to the ~/Desktop/*.desktop shortcut no longer
> appearing either. :)

I am aware of the desktop icons issue and am working on it.  What I don't understand is why you still need suid on eject for device icon removal.

Did you recompile tdelibs with -DWITH_UPOWER2="ON" or an equivalent flag?
Comment 11 Darrell 2013-04-16 11:02:37 CDT
Yes, per the CMakeLists.txt, with the following:

-DWITH_UDISKS2=ON
-DWITH_UPOWER=ON

The build logs confirm:

//Enable UDISKS2 support
WITH_UDISKS2:BOOL=ON

//Enable UPOWER support
WITH_UPOWER:BOOL=ON
Comment 12 Timothy Pearson 2013-04-16 11:31:53 CDT
(In reply to comment #11)
> Yes, per the CMakeLists.txt, with the following:
> 
> -DWITH_UDISKS2=ON
> -DWITH_UPOWER=ON
> 
> The build logs confirm:
> 
> //Enable UDISKS2 support
> WITH_UDISKS2:BOOL=ON
> 
> //Enable UPOWER support
> WITH_UPOWER:BOOL=ON

Do you have permissions to eject the device via udisks2?  If the udisk2 eject fails, TDE will fail over to using the eject binary.  It might be possible for a user to have udisks eject permission and not udisks2 eject permission, I am not sure.
Comment 13 Darrell 2013-04-16 12:24:16 CDT
I don't know and don't yet know how to even check that relationship.

Your question prompted  me to look in my xsession-error log. I see the following:

eject: unable to eject, last error: Inappropriate ioctl for device
eject: device name is `/dev/sde1'
eject: expanded name is `/dev/sde1'
eject: `/dev/sde1' is not mounted
eject: `/dev/sde1' is not a mount point
eject: `/dev/sde1' is a multipartition device
eject: trying to eject `/dev/sde1' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: trying to eject `/dev/sde1' using SCSI commands
eject: SCSI eject failed
eject: trying to eject `/dev/sde1' using floppy eject command
eject: floppy eject command failed
eject: trying to eject `/dev/sde1' using tape offline command
eject: tape offline command failed

The messages seem to be from the eject command directly. Doesn't help know how eject interacts with udisks(2).
Comment 14 Darrell 2013-04-16 13:16:01 CDT
I can run eject -T from the command line, which opens and closes the DVD drive tray. When I try to run only the eject command with no parameters I see the same error messages:

eject: unable to eject, last error: Inappropriate ioctl for device

Running the following resulted in a similar message:

udisks --eject /dev/dvd

Eject failed: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Subsequent attempts to run the same command result in this:

Eject failed: Not Authorized

Last year I raised the same issue on the Slackware forum:

https://www.linuxquestions.org/questions/slackware-14/slackware-14-udev-eject-4175425297/

There are many hits on a web search.

Perhaps for the moment we restore the special device icons. I'll search some more about eject. I'm guessing tdehwlib is making the correct calls to udev/udisks2/eject, but something else is awry.
Comment 15 Darrell 2013-04-16 15:57:17 CDT
Tim,

I spent some time fiddling with this and finally ran across a patch (https://bugs.archlinux.org/task/25405?getfile=7391) for the eject command that solves the problem on my end. I will try to get the patch merged in Slackware, but that is my problem, not yours. :)

If we get the desktop icons restored I'll test and hopefull then we close this report.
Comment 16 Timothy Pearson 2013-04-16 16:09:32 CDT
(In reply to comment #15)
> Tim,
> 
> I spent some time fiddling with this and finally ran across a patch
> (https://bugs.archlinux.org/task/25405?getfile=7391) for the eject command that
> solves the problem on my end. I will try to get the patch merged in Slackware,
> but that is my problem, not yours. :)
> 
> If we get the desktop icons restored I'll test and hopefull then we close this
> report.

I am still working on the icons.  There are fundamental problems with the media:/ kioslave that have existed for a very long time; I am attempting to resolve them now.
Comment 17 Darrell 2013-04-16 17:03:38 CDT
Ok.

I wrote too soon about the eject problem. The patch does help at my end, but only for optical disks. After mounting an optical disk the Eject command from the popup menu works with the disk unmounting and the tray opening. The Safely Remove problem applies only to USB flash drives and will unmount the device but not remove/clear the icon. So we still have to cross the bridge later. (Sorry!)
Comment 18 Timothy Pearson 2013-04-17 16:49:40 CDT
(In reply to comment #17)
> Ok.
> 
> I wrote too soon about the eject problem. The patch does help at my end, but
> only for optical disks. After mounting an optical disk the Eject command from
> the popup menu works with the disk unmounting and the tray opening. The Safely
> Remove problem applies only to USB flash drives and will unmount the device but
> not remove/clear the icon. So we still have to cross the bridge later. (Sorry!)

The icons are not removed/cleared because the system has not ejected the drive.

To debug the udisks2 eject failure, try this:
1.) Install d-feet and launch it.
2.) File-->Connect to System Bus
3.) Click on org.freedesktop.UDisks2 in the left pane
4.) Find your removable block device in the list shown in the right pane and expand it
5.) Expand org.freedesktop.UDisks2.Drive
6.) Under Methods, double-click Eject
7.) In the pop-up dialog, type '{}' (without the quotes) and click Execute.

Is the device now ejected from the system?  If not, did an error message display in the lower pane of the pop-up dialog?
Comment 19 Timothy Pearson 2013-04-17 17:36:50 CDT
(In reply to comment #10)
> (In reply to comment #9)
> > Yes, udisks2-1.98 (and udisks-1.0.4).
> > 
> > Start Trinity with a fresh profile to verify none of the special device icons
> > appear. In the past all of them appeared on the desktop with a fresh profile.
> > 
> > I don't know how that is related to the ~/Desktop/*.desktop shortcut no longer
> > appearing either. :)
> 
> I am aware of the desktop icons issue and am working on it.  What I don't
> understand is why you still need suid on eject for device icon removal.
> 
> Did you recompile tdelibs with -DWITH_UPOWER2="ON" or an equivalent flag?

Desktop icons issue should now be fixed by commits to tdelibs and tdebase.  I still need debugging information from udisks2/d-feet as mentioned above. :-)
Comment 20 Timothy Pearson 2013-04-17 21:36:04 CDT
I have added preliminary (largely untested!) udisks eject support to tdelibs in GIT hash bfc7b3b.  Be sure to set both -DWITH_UDISKS="ON" and -DWITH_UDISKS2="ON", as TDE will try all known (enabled) methods in sequence until it either succeeds or exhausts all possibilities.  There are also some new debug messages in that commit that should give a better idea of what TDE is trying and when.
Comment 21 Darrell 2013-04-17 21:57:39 CDT
Ok. Don't spend much time on that for the next few days. I've updated with the previous patches and have all desktop icons again (yay!) and whatever other tdeio improvements. I'm freezing my local repo to support the final testing of bug reports 1446 and 1447. As I need to run a full build set this will take a day or two before I can test the latest UDISK patches.

There is a udev rule that might be causing some of the eject grief. When I get 1446 and 1447 out of the way I'll try to perform some testing as methodically as possible to pinpoint the root cause.
Comment 22 Darrell 2013-04-18 22:49:14 CDT
Related to comment 20, I see the following in my build logs for tdelibs:

CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_UDISKS
    WITH_UDISKS2
Comment 23 Darrell 2013-04-18 22:52:52 CDT
Yet I also see this in the CMakeCache.txt:

//Enable UDISKS support
WITH_UDISKS:BOOL=ON

//Enable UDISKS2 support
WITH_UDISKS2:BOOL=ON

I'm confused!
Comment 24 Timothy Pearson 2013-04-18 23:22:34 CDT
(In reply to comment #23)
> Yet I also see this in the CMakeCache.txt:
> 
> //Enable UDISKS support
> WITH_UDISKS:BOOL=ON
> 
> //Enable UDISKS2 support
> WITH_UDISKS2:BOOL=ON
> 
> I'm confused!

Well, that was a fairly stupid mistake on my part!  Defining variables but not using them...

Fixed in GIT hash b426419.
Comment 25 Darrell 2013-04-19 16:49:29 CDT
I rebuilt tdebase to the latest GIT.

Optical disks eject fine and the desktop icon disappears after the tray opens.

USB flash drives now seem to behave correctly with the icon disappearing after selecting Safely Remove.

The icon disappears without the aforementioned patched version of the eject command or any modified udev rules.

Observations:

1. Sometimes the desktop icon disappeared immediately, sometimes only after about 30 seconds. The relationship seems to be the first instance requires about 30 seconds and thereafter in the same session disappears immediately. Initially this behavior seemed repeatable as I restarted Trinity and again the first instance required about 30 seconds for the icon to disappear. Thereafter the icon disappeared immediately. After a full reboot and flushing the ksycoca cache I could not repeat the behavior and the icon disappeared immediately on the first instance.

2. I have a floppy drive. I have the Unmounted Floppy and Mounted Floppy device icons enabled. The Unmounted icon appears on my desktop as expected when I start Trinity. Using the popup menu and selecting Mount did not work. Using Mount from the popup menu with a CD works as expected. The desktop icon never changes to Mounted floppy and my desktop response slowed to a crawl. Watching the xsession-errors log using tail did not reveal anything. That said, a full reboot seems to have resolved the behavior. I cannot repeat the problem.

3. Now for a really weird bug that needs attention. I inadvertently selected Refresh Desktop from the desktop popup menu. Thereafter the removable device icon popup menus all changed and none had the Safely Remove, Mount, Eject menu options. I'm attaching screen shots. I have seen this happen occasionally but never investigated. Now I see the connection and cause. Note, I saw the oddball KDiff3 menu option (second picture). I uninstalled that package, restarted Trinity, and again selected Refresh Desktop from the desktop popup menu. Same results, as seen in the third screen grab. We might as well fix this weirdo under this bug report.

After resolving the third problem we can close this report. The first two observations above likely are anomalies and we have them recorded for posterity in case somebody ever observes the same behavior.
Comment 26 Darrell 2013-04-19 16:50:46 CDT
Created attachment 1169 [details]
Screen shots of popup device icon popup menus

Attached are the aforementioned screen shots, 3 shots in one file.
Comment 27 Timothy Pearson 2013-04-20 18:47:26 CDT
(In reply to comment #26)
> Created attachment 1169 [details]
> Screen shots of popup device icon popup menus
> 
> Attached are the aforementioned screen shots, 3 shots in one file.

Fixed in GIT hash 96d0c54.

I'm going to close this report; please reopen if these issues recur.

Thanks for reporting!
Comment 28 Darrell 2013-04-20 19:55:02 CDT
All seems to be working. Thank you!

Note: I again saw the long delay to remove the desktop icon after selecting Safely Remove. The icons disappear immediately thereafter. I don't want to pursue that but just adding a note in case somebody else reports the same thing someday. :)

R14.0.0 is looking better each day. :)