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 1708 - Trinity cannot mount USB keys without pmount utility
Summary: Trinity cannot mount USB keys without pmount utility
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: tdelibs (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: All Linux
: P5 major
Assignee: Slávek Banko
URL:
Depends on:
Blocks:
 
Reported: 2013-11-11 10:31 CST by Francois Andriot
Modified: 2013-12-21 13:17 CST (History)
6 users (show)

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


Attachments
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (6.02 KB, patch)
2013-11-11 10:32 CST, Francois Andriot
Details | Diff
tdelibs : add support for udisks1 and udisks2 (in file.cc) (3.19 KB, patch)
2013-11-11 11:24 CST, Francois Andriot
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (2) (6.44 KB, patch)
2013-11-11 15:42 CST, Francois Andriot
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (3) (7.58 KB, patch)
2013-11-11 20:19 CST, Slávek Banko
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (4) (8.30 KB, patch)
2013-11-12 10:17 CST, Slávek Banko
Details | Diff
tdelibs : fix tdehw backend media name with UTF8 characters (739 bytes, patch)
2013-11-12 11:40 CST, Slávek Banko
Details | Diff
tdelibs : fix handling paths with UTF8 characters in tdehw storage backend (779 bytes, patch)
2013-11-12 13:16 CST, Slávek Banko
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (5) (8.51 KB, patch)
2013-11-12 15:11 CST, Francois Andriot
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (6) (8.67 KB, patch)
2013-11-12 15:26 CST, Francois Andriot
Details | Diff
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (7) (7.80 KB, patch)
2013-11-13 13:22 CST, Slávek Banko
Details | Diff
tdelibs : add support for udisk1 and udisk2 in tdeioslave/file (3.79 KB, patch)
2013-11-14 19:56 CST, Slávek Banko
Details | Diff
tdelibs : Disable unallowed options for udisks/udisks2 in tdehw storage backend (1008 bytes, patch)
2013-11-20 16:38 CST, Slávek Banko
Details | Diff
tdebase : Fix allowing utf8 mount options in tdehw storage backend (1.50 KB, patch)
2013-11-20 16:55 CST, Slávek Banko
Details | Diff
tdelibs : add '/run' folder to the slow freq polling directories list (515 bytes, patch)
2013-12-08 04:04 CST, Francois Andriot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Andriot 2013-11-11 10:31:18 CST
As the title says, the "pmount" utility is currently harcoded in TDE to mount/unmount removable drives.
Alas, some distributions do not provide pmount.
Comment 1 Francois Andriot 2013-11-11 10:32:03 CST
Created attachment 1623 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives
Comment 2 Slávek Banko 2013-11-11 10:42:11 CST
It looks good!

Just one comment: Instead of hard-coded /sbin:/bin use to add "sbin" paths into environment path method similar to that is in the patch bb36045b?
Comment 3 Francois Andriot 2013-11-11 10:46:43 CST
Yes, this would probably be better.
In fact, I've just copy/paste part of "tdelibs/tdeioslave/file/file.cc" for this code, which also have hardcoded pmount :-(
Comment 4 Francois Andriot 2013-11-11 11:24:26 CST
Created attachment 1624 [details]
tdelibs : add support for udisks1 and udisks2 (in file.cc)
Comment 5 Slávek Banko 2013-11-11 13:29:13 CST
I tested the patch and I came across one little problem. In pmount is utf8 option used only for vfat. In proposed patch is used regardless of the file system => most file systems fail.
Comment 6 Francois Andriot 2013-11-11 13:45:28 CST
Are you still using pmount after applying the patch ? If so, the pmount parameters should not have changed, the pmount related code was not modified !
Comment 7 Francois Andriot 2013-11-11 14:05:00 CST
I confirm the problem using udisks2 and an EXT2 filesystem, it fails saying "iocharset=" option is forbidden.

If you look at my code, you can see that the option is given to the command line ONLY if the "utf8" or "locale" option was given by the calling application. By default, no "iocharset" option is used.

By trying 'pmount' manually from the command line, it looks like it ignores the "-c utf8" option when I mount the EXT2 filesystem. So it works, but it should not.

I think we should fix 2 things:

1) ensure that the calling application (tdebase/tdeioslave/media/mediamanager/tdehardwarebackend.cpp) does NOT asks UTF8 for filesystem that don't support it.

2) imitate pmount behaviour in tdelibs: strips the invalid/unsupported options for filesystems that don't support it.
Comment 8 Slávek Banko 2013-11-11 15:33:02 CST
(Odpověď na komentář #7)
> I confirm the problem using udisks2 and an EXT2 filesystem, it fails saying
> "iocharset=" option is forbidden.
> 
> If you look at my code, you can see that the option is given to the command
> line ONLY if the "utf8" or "locale" option was given by the calling
> application. By default, no "iocharset" option is used.
> 
> By trying 'pmount' manually from the command line, it looks like it ignores the
> "-c utf8" option when I mount the EXT2 filesystem. So it works, but it should
> not.
> 
> I think we should fix 2 things:
> 
> 1) ensure that the calling application
> (tdebase/tdeioslave/media/mediamanager/tdehardwarebackend.cpp) does NOT asks
> UTF8 for filesystem that don't support it.
> 
> 2) imitate pmount behaviour in tdelibs: strips the invalid/unsupported options
> for filesystems that don't support it.

I would chose this point of view: Option "utf8" or "locale" is not equivalent to option "iocharset". Therefore, should be "translated" to options depending on the file system type => a similar way as it does pmount.

By adjusting options specifically by file system could be also used other options that seem to be ignored for now - journaling (ext3, 4), shortname (vfat).

It appears that the preparation mount options could be common for udisk and udisks2, to avoid duplicating code in at least one file.
Comment 9 Francois Andriot 2013-11-11 15:42:29 CST
Created attachment 1625 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (2)

Updated patch: now it filters out the "iocharset=" option for filesystems that do not support it.

I have an USB key containing 2 partitions (FAT32 + EXT2) and now I can mount and unmount both of them, using udisks2.
I confirm that the FAT32 has "utf8" mount option, whereas EXT2 has not.
Comment 10 Francois Andriot 2013-11-11 15:46:14 CST
(En réponse au commentaire 8)
> (Odpověď na komentář #7)
> I would chose this point of view: Option "utf8" or "locale" is not equivalent
> to option "iocharset". Therefore, should be "translated" to options depending
> on the file system type => a similar way as it does pmount.
> 
> By adjusting options specifically by file system could be also used other
> options that seem to be ignored for now - journaling (ext3, 4), shortname
> (vfat).
> 
> It appears that the preparation mount options could be common for udisk and
> udisks2, to avoid duplicating code in at least one file.

From what I see, among the 3 mount programs we have, only pmount does not support all options.
In fact, in udisks and udisks2, all options are passed directly to the "mount" command. So it should be easy to implement the current disabled options, like shortname ...
Comment 11 Slávek Banko 2013-11-11 20:19:55 CST
Created attachment 1627 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (3)

I tried revise your patch, as I mentioned in a comment. Please your opinion. And if you agree with the adjustment, please test it.
Comment 12 Francois Andriot 2013-11-12 00:05:58 CST
Not tested your patch yet, but looks good.
But for mount, the code looks for: udisks2/udisks/pmount, whereas for unmount we look for pumount/udisks2/udisks .
I think the utilities order should be consistent.

E.g. with your patch, if pmount is installed on my computer, TDE will use "udisks2" for mounting and "pumount" for unmouting !
Comment 13 Slávek Banko 2013-11-12 10:17:25 CST
Created attachment 1629 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (4)

Patch updated:
1) reoder programs in umount
2) add journaling option for ext3, ext4
3) I am concerned the use command.ascii(), because the command may contain device name or mount point => data with utf8. That's why I changed it to command.local8Bit().

Please, test it :)
Comment 14 Slávek Banko 2013-11-12 11:40:15 CST
Created attachment 1630 [details]
tdelibs : fix tdehw backend media name with UTF8 characters

I tested the patch for mount and I have another patch to fix media name with utf8 characters
Comment 15 Francois Andriot 2013-11-12 13:01:12 CST
I've tested both patches and it looks like everything is fine. Well done for the UTF8 media names :-)
Comment 16 Slávek Banko 2013-11-12 13:06:26 CST
On my test machine with Ubuntu 13.10 (Saucy) I could try all mount options - pmount, udisks and udisk2. Pmount and udisks work fine. Udisks2 on vfat partition not work:

GDBus.Error:org.freedesktop.UDisks2.Error.OptionNotPermitted: Mount option `utf8' is not allowed

I also noticed that the utf8 option is also supported filesystems ntfs and iso9660. We should add this option for these file systems?
Comment 17 Slávek Banko 2013-11-12 13:16:45 CST
Created attachment 1631 [details]
tdelibs : fix handling paths with UTF8 characters in tdehw storage backend

I have one more patch for tde storage backend, but do not know where it is possible to test behavior before / after the patch.
Comment 18 Francois Andriot 2013-11-12 13:27:43 CST
Ah sorry, on my current PC (not the same as yesterday), I had "utf8 charset" checkbox disabled in TDE mounting preferences for vfat, so it worked but I had no utf8 mount option.
When mounting using "udisksctl" from the command line, I see the same error message as you.
In my previous patch, I did not use the "utf8" option, only the "iocharset=utf8" option. Are you sure they are really different ?

And yes, I think we should add "utf8" option where possible, so OK to add it for iso9660 and ntfs...
Comment 19 Darrell 2013-11-12 14:50:40 CST
Are these patches ready to test? Slackware does not come with pmount as a stock package but does support udisks(2). I would like to test.

Will these patches be merged into one patch?
Comment 20 Francois Andriot 2013-11-12 15:11:13 CST
Created attachment 1632 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (5)

After further testing, looks like "udisksctl" always add "utf8" option to the VFAT filesystem mounting. This is probably why it does not want "utf8" again as an option.

Updated patch so that "utf8" flag is set for UDISKS1 but not UDISKS2.
Comment 21 Francois Andriot 2013-11-12 15:26:58 CST
Created attachment 1633 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (6)

Adds 'utf8' option for iso9660 and ntfs, UDISKS1 only.
Comment 22 Slávek Banko 2013-11-13 13:22:53 CST
Created attachment 1637 [details]
tdelibs : add support for udisks1 and udisks2 to mount/unmount removable drives (7)

I have a few comments:

1) Place, to which was moved handling utf8 option has two problems:

+ is after "optionString.remove(0, 1);" which remove the leading comma - if utf8 was the first / only one settings leading comma will be undesirable.

+ is after "mountOptions.contains("filesystem")" - would cause confusion in the options

2) For ntfs udisk and udisks2 assume ntfs-3g => does not allow options utf8 and iocharset.

3) I checked the source code udisks and udisk2 and both internally use utf8. It seems that for fat, ntfs and iso9660 we do not need to handle utf8 whatsoever. A preparation of options can be shared again.

Updated patch attached.

I tested pmount, udisks and udisks2 along with fat, ext3 and ntfs.
All combination has worked fine.
Please test it also. :)

Note: I have observed that the eject on usb disk reports problems for udisks2 and also udisks function. However, I'll leave that for a separate bug message.
Comment 23 Francois Andriot 2013-11-13 13:40:42 CST
Your latest patch works for me (ext2, FAT32).
I have no problem with neither umount nor eject function, using udisks1 and udisks2.
Comment 24 Slávek Banko 2013-11-13 15:50:25 CST
(Odpověď na komentář #23)
> Your latest patch works for me (ext2, FAT32).
> I have no problem with neither umount nor eject function, using udisks1 and
> udisks2.

May be related to file system name (and mount point) contain utf8 characters.
May be related to test drive had two partitions.

In any case, I received such a message:

[tdehwlib] Failed to eject drive '/dev/sdb2' via udisks2, falling back to alternate mechanism
[ERROR] org.freedesktop.DBus.Error.ServiceUnknown
[tdehwlib] Failed to eject drive '/dev/sdb1' via udisks, falling back to alternate mechanism
[tdehwlib] Failed to eject drive '/dev/sdb1' via 'eject' command
Comment 25 Slávek Banko 2013-11-14 19:56:26 CST
Created attachment 1641 [details]
tdelibs : add support for udisk1 and udisk2 in tdeioslave/file

I modified the patch for tdeioslave/file to use also order
udisks2 / udisks / pmount.

Since the function is otherwise unchanged, I assume that all the patches can be pushed to Git. Since the original work for udisks patches belongs to you, François, I bring you as an author.
Comment 26 Francois Andriot 2013-11-15 00:02:04 CST
Looks good => I think you can push all patches to GIT.
Comment 27 Slávek Banko 2013-11-15 19:22:20 CST
Patches pushed to GIT:

+ attachment 1630 [details] in hash 337146de
+ attachment 1631 [details] in hash 24b097d1
+ attachment 1637 [details] and attachment 1641 [details] in hash 990c3797
  (with small adjustments)
Comment 28 Slávek Banko 2013-11-16 19:21:24 CST
Note: In commit 7a8b0da2 (tdebase) were added the conditions that allow to pass mount options to tdehw storage backend.
Comment 29 Darrell 2013-11-18 20:16:13 CST
Francois, Slavek,

Today I built and installed a fresh package set that includes the patches from this bug report. Removable devices are working here without pmount. Thank you and job well done!
Comment 30 Francois Andriot 2013-11-20 13:17:37 CST
New side-effect when using UDISKS2 to mount EXT4 partition:
udisks2 complains that I cannot pass option "data=ordered"...

E.g, in command line:
$ udisksctl mount -b /dev/sdb1 -o data=ordered
Error mounting /dev/sdb1: GDBus.Error:org.freedesktop.UDisks2.Error.OptionNotPermitted: Mount option `data=ordered' is not allowed
Comment 31 Slávek Banko 2013-11-20 16:38:50 CST
Created attachment 1657 [details]
tdelibs : Disable unallowed options for udisks/udisks2 in tdehw storage backend

Oops. As I see none of mount backends (pmount/udisks/udisks2) have support for "data=" for ext3/ext4.

I'm afraid that due to the fact that for JFS has no extra options, it would be a problem also with iocharset=utf8 for JFS.
Comment 32 Slávek Banko 2013-11-20 16:55:53 CST
Created attachment 1658 [details]
tdebase : Fix allowing utf8 mount options in tdehw storage backend

I adjusted allowing utf8 option depending on the file system.
It would be incorrect display option for all unknown file systems.
Comment 33 Slávek Banko 2013-11-20 21:11:29 CST
Patches pushed to GIT:
+ attachment 1657 [details] in hash 58852c67
+ attachment 1658 [details] in hash eb091e7d

I assume that the problem should be solved again.
Comment 34 Timothy Pearson 2013-12-03 01:32:27 CST
I just had a user report that TDE (or at least the media:/ tdeioslave) doesn't seem to properly read the path udisks mounted the flash drive on; this leads to strange file not found errors when deleting files from a flash drive, as the tdeioslave attempts to remove the file from an incorrect path (e.g. /media/Flash) instead of where the flash drive is actually mounted (e.g. /media/user/Flash).
Comment 35 Francois Andriot 2013-12-04 00:07:49 CST
I confirm some strange behaviour here.
Running Mageia 3, USB drives mounted through udisks2 appear under /run/media/<username>/<medianame>

I can click the device icon to mount it and open in Dolphin.
The access path looks correct here.
But then, in Dolphin, when I double-click in a subfolder inside the drive, the URL changes to something like "//sdb1" and Dolphin displays a message such as "the specified folder does not exist".

When browsing folders through the "root filesystem" menu (red folder icon), it works well. When browsing through the "removable media", it fails.
Comment 36 Francois Andriot 2013-12-08 04:04:42 CST
Created attachment 1705 [details]
tdelibs : add '/run' folder to the slow freq polling directories list
Comment 37 Francois Andriot 2013-12-08 04:23:52 CST
Currently, I have both dolphin and konqueror installed.

I have no problem when using Konqueror as file manager.
When I open the "Devices" view, then open my USB drive, the Konqueror URL is "system:/media/sdb1", and the actual mount point is "/run/media/francois/sdb1".
I can browse folders/copy/move/delete item. The URL bar always show the "system:/media" URL, e.g. "system:/media/sdb1/subfolder1/subfolder2" ...

When using Dolphin: I open manually dolphin, by default, I'm in home directory. On the left "bookmarks" pane, I click "Storage Devices" (translation may be inaccurate), Now the URL bar shows "Storage Devices" but I guess I'm in the "system:/media" URL. I double-click my USB drive, then I'm redirected to the entire URL "/run/media/francois/<medianame>", and the bookmark pane switches to 
"root filsystem". I can browse, copy, delete, no problem.
=> Not the same behaviour as Konqueror, but still works.

Now, when using the TDE tray icon for removable media, I click on my USB drive icon, then choose the first item "open in new window".
Case 1: the USB drive was already mounted => Dolphin opens in "/run/media/francois/<medianame>" folder, no problem.
Case 2: the USB was NOT mounted. It is mounted, then Dolphin opens with "media:/sdb1" URL, NOT "system:/media/sdb1" ! I can see my drive content. But when double-clicking on a subfolder, I'm redirected to "/sdb1/<subfolder>" URL, which is obviously invalid.

Another scenario: this time I unplug/plug again my USB key. I have a "TDE Daemon" popup which asks me what action I want. I choose "open in new window".
This time it opens Dolphin with "system:/media/sdb1", and I can see my drive content. But when opening a subfolder, I'm redirected to "/media/sdb1/<subfolder>", which does not exist.
Comment 38 Francois Andriot 2013-12-08 04:31:12 CST
Now I've uninstalled Dolphin entirely.

Using Tray icon "open in new window":
1) If USB key was already mounted, Konqueror opens "/run/media/francois/<medianame>", and it works normally.
2) if USB key was NOT mounted, Konqueror opens "media:/sdb1", and it works normally.

Using the "TDE Daemon" popup when plugging USB key:
"Open in new window" opens "system:/media/sdb1" and it works normally.


So, it looks like only Dolphin file manager is having problems, so maybe we should investigate it.
Still, depending on the circumstances, there are different URL for using the same media, which may cause confusion, even though they should all work.
Comment 39 Francois Andriot 2013-12-08 04:38:49 CST
I think that Dolphin in fact does not like the "system:/" and "media:/" URL at all, or is cheating somewhere to make it work when media are mounted under "/media".

Open dolphin, manually type URL "system:/media/sdb1" . It opens correctly.
Double click a subfolder. It should open "system:/media/sdb1/<subfolder>" but simply opens "/sdb1/<subfolder>". Where has the "system:/media" part of the URL gone ?

Manually type URL "media:/sdb1". Double-click a subfolder => fail to open "/sdb1/<subfolder>".

Manually type URL "media:/sdb1/<subfolder>". Double click a subfolder inside the subfolder => fail to open
Comment 40 Timothy Pearson 2013-12-14 16:49:37 CST
(In reply to comment #34)
> I just had a user report that TDE (or at least the media:/ tdeioslave) doesn't
> seem to properly read the path udisks mounted the flash drive on; this leads to
> strange file not found errors when deleting files from a flash drive, as the
> tdeioslave attempts to remove the file from an incorrect path (e.g.
> /media/Flash) instead of where the flash drive is actually mounted (e.g.
> /media/user/Flash).

This should be fixed in GIT hash 23006ee.  I don't know if this fixes Dolphin or not, but it might.
Comment 41 Slávek Banko 2013-12-14 18:57:37 CST
Comment on attachment 1705 [details]
tdelibs : add '/run' folder to the slow freq polling directories list

Pushed to GIT in hash 47bbb9e4.
Comment 42 Darrell 2013-12-14 20:48:28 CST
Do all of the changes made here mean Trinity no longer can be built to use pmount? Some folks might prefer pmount over udisks(2)?
Comment 43 Timothy Pearson 2013-12-15 02:11:52 CST
(In reply to comment #42)
> Do all of the changes made here mean Trinity no longer can be built to use
> pmount? Some folks might prefer pmount over udisks(2)?

TDE will simply prefer udisks(2) if it is available.  It will still fall back to using pmount if needed.

Tim
Comment 44 Francois Andriot 2013-12-17 14:27:23 CST
With today's git, the problem with Dolphin I mentionned above is gone.
I guess you fixed the issue in tdelibs.
Comment 45 Timothy Pearson 2013-12-17 14:33:29 CST
Sounds like this is resolved then.  If not please reopen this report.

Thanks for reporting, and for all the debugging!
Comment 46 Darrell 2013-12-21 13:17:32 CST
>TDE will simply prefer udisks(2) if it is available.  It will still fall back
>to using pmount if needed.
How do we force compiling with and using pmount rather than udisks?