This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Unable to umount device unless I insert the root password

Tags: None
(comma "," separated)
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
Hello,

I am not able to umount any USB disk drive unless I insert the root password. Indeed I am prompted for the password request every time I try to umount the disk using the eject button from the notify area.
Image

I think that this is a configuration issue as regard my user, (i.e. something broken within the ~/.kde dir) and it has something to do with udisks.
If I try to umount using udisks1 (or simply umount /dev/xxx by command line) the password is not requested while udisks2 requires the password to be inserted. If KDE would use udisks1 it would be better in this case.

Do you have any suggestion to fix this problem since I am facing with this since few months?

I use kde-4.10.4 on Gentoo Linux - Kernel 3.10.0.

Thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
KDE will use UDisks2 if present, otherwise it will fallback to UDisks (the original). The order of precedence usually is not noticed - as most systems only have one or the other.

With regards to why you are being prompted for authentication - this is a change in behaviour imposed by UDisks2 - which KDE has no control over. You should file a bug report against UDisks2 with your distribution.

In regards to temporarily fixing it - if you expand "Details" it should give an "Action" called "org.freedesktop....". Open System Settings and use the "Actions Policy" control module to ensure the "Active console" has permission to perform the action.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
Thank you for replying

Actually, I would try to fix it following your suggestion, and I see this:
Image

unfortunately I see that the message which appears hovering the mouse on "Umount a device mounted by another user" it wants me to modify the org.freedesktop.udisks2.filesystem-umount-others file, but I don't have it on my filesystem. If I click on it, nothing happens.

I don't find the "Actions policy" module on my System settings. It looks like it is missing. And I see (just googling a little bit) that many other people are experiencing the same issue.

I would open a bug report against UDisks2, but I guess this is happening because something within my kde configuration has been messed up (not directly by me, since I didn't touch anything).
wolfi323
Registered Member
Posts
1129
Karma
11
OS
Well, how did you mount the drive in the first place?

If you mounted it with something other than udisks2, you have to specify the root password for unmounting with udisks2, I think.

Mounting and unmounting works fine using udisks2 on my system without root password. And I haven't changed any polkit rules. I'm pretty sure that org.freedesktop.udisks2.filesystem-umount-others (which is no file btw. ;) ) is set to auth_admin (can't check at the moment).

That "Actions policy" module doesn't really work anyway because it changes wrong files. That's why it got removed in openSUSE.
See https://bugs.kde.org/show_bug.cgi?id=308934 f.e.

bcooksley wrote:KDE will use UDisks2 if present, otherwise it will fallback to UDisks (the original). The order of precedence usually is not noticed - as most systems only have one or the other.
AFAIK this is decided at compile time.
If your KDE is compiled against UDisks2 it won't use UDisks and vice versa...
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
Hi,

I mounted the device without doing anything particular. When I plug in the usb drive, the popup appears on top of the clock/icon/notification area and it is automatically mounted.
So, just the "eject" button is available. I also noticed some strange behaviour in this case because automatic mounting is not enabled in System Settings and it automatically mounts the devices anyway.

If I do this by command line:
Code: Select all
/usr/sbin/umount.udisks

I am able to umount as user

while this:
Code: Select all
/usr/sbin/umount.udisks2

makes the password request window visible.

So, I guess the device gets mounted with udisks1 and KDE is trying to umount it using udisks2.
But at this point: why is KDE using udisks1 to mount and udisks2 to umount? :o
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fbcyborg wrote:Hi,

I mounted the device without doing anything particular. When I plug in the usb drive, the popup appear on top of the clock/icon/notification area and it is already mounted.
So, just the "eject" button is available. I also noticed some strange behaviour in this case because automatic mounting is not enabled in System Settings and it automatically mounts the devices anyway.

If I do this by command line:
Code: Select all
/usr/sbin/umount.udisks

I am able to umount as user

while this:
Code: Select all
/usr/sbin/umount.udisks2

makes the password request window visible.

So, I guess the device gets mounted with udisks1 and KDE is trying to umount it using udisks2.
But at this point: why is KDE using udisks1 to mount and udisks2 to umount? :o

That's not KDE4, that must be something else then.

But I have no experience with Gentoo, so I have no idea what that could be.

Maybe udisks-glue? AFAIK that's for automounting with udisks1.
You could try to uninstall udisks, then it should work. At least you would see what requires udisks on your system...
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
Well,

I can answer your question right away:
Code: Select all
sys-fs/udisks-1.0.4-r5 pulled in by:
    app-emulation/wine-1.4.1 requires sys-fs/udisks:0
    gnome-base/libgdu-3.0.2 requires =sys-fs/udisks-1.0*:0
    sys-fs/udisks-glue-1.3.4 requires sys-fs/udisks:0

  sys-fs/udisks-2.1.0 pulled in by:
    kde-base/kdelibs-4.10.3-r2 requires sys-fs/udisks:2


I don't think it would be appropriate to remove udisks1.
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fbcyborg wrote:Well,

I can answer your question right away:
Code: Select all
sys-fs/udisks-1.0.4-r5 pulled in by:
    app-emulation/wine-1.4.1 requires sys-fs/udisks:0
    gnome-base/libgdu-3.0.2 requires =sys-fs/udisks-1.0*:0
    sys-fs/udisks-glue-1.3.4 requires sys-fs/udisks:0

  sys-fs/udisks-2.1.0 pulled in by:
    kde-base/kdelibs-4.10.3-r2 requires sys-fs/udisks:2


I don't think it would be appropriate to remove udisks1.

Well, then I think udisks-glue is automounting your drive as I already mentioned.

I guess you have the following choices:

- disable automounting with udisks-glue (or uninstall it completely)

- recompile KDE to use udisks-1.0 (AFAIK udisks2 support is enabled by defining WITH_SOLID_UDISKS2=TRUE when building kdelibs)

- set the polkit rule 'org.freedesktop.udisks2.filesystem-umount-others' to yes.
on openSUSE you would add the following line to /etc/polkit-default-privs.local :
Code: Select all
org.freedesktop.udisks2.filesystem-umount-others yes
and call "set_polkit_default_privs" for this to take effect.
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
OK, I think the two best solutions for me are 1 and 3.
I would try solution 3 replacing the following piece of code in /usr/share/polkit-1/actions/org.freedesktop.udisks.policy:

Code: Select all
  <action id="org.freedesktop.udisks.filesystem-unmount-others">
    <description>Unmount a device mounted by another user</description>
    <message>Authentication is required to unmount devices mounted by another user</message>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
  </action>


with this:

Code: Select all
  <action id="org.freedesktop.udisks.filesystem-unmount-others">
    <description>Unmount a device mounted by another user</description>
    <message>Authentication is required to unmount devices mounted by another user</message>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
  </action>


But I don't have the executable you mentioned: "set_polkit_default_privs".

To be honest, I remeber that I've already tried to do this, but it didn't work. Let's try again then.

As for the solution 1, I don't know how to do it.

Thank you!
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fbcyborg wrote:But I don't have the executable you mentioned: "set_polkit_default_privs".
That may be openSUSE specific then.

What polkit-related things do you have in /etc?
Code: Select all
ls -lR /etc/polkit*


And which polkit version do you have? There were massive changes between versions.

To be honest, I remeber that I've already tried to do this, but it didn't work. Let's try again then.
You shouldn't change the defaults in /usr/share/polkit-1/actions/. Your changes there would get lost if you reinstall/update udisks2.
They get overridden by the settings in /etc/ anyway.

And you showed the wrong one in your last post. That was for udisks-1.0...
For udisks2 it should have been /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy.
And you should especially change <allow_active> to yes. That's the one that affects you.
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
wolfi323 wrote:
fbcyborg wrote:But I don't have the executable you mentioned: "set_polkit_default_privs".
That may be openSUSE specific then.

What polkit-related things do you have in /etc?
Code: Select all
ls -lR /etc/polkit*


Code: Select all
/etc/polkit-1:
total 4
drwx------ 2 polkitd root 4096 Jul 28 17:04 rules.d

/etc/polkit-1/rules.d:
total 4
-rw-r--r-- 1 polkitd root 321 Mar 16 19:30 50-default.rules

And this is the content of /etc/polkit-1/rules.d/50-default.rules:
Code: Select all
/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */

// DO NOT EDIT THIS FILE, it will be overwritten on update
//
// Default rules for polkit
//
// See the polkit(8) man page for more information
// about configuring polkit.

polkit.addAdminRule(function(action, subject) {
    return ["unix-user:0"];
});


wolfi323 wrote:And which polkit version do you have? There were massive changes between versions.

Code: Select all
[I]gnome-extra/polkit-gnome (0.105@02/20/2012)
[I] sys-auth/polkit (0.110@03/16/2013)
[I] sys-auth/polkit-kde-agent (0.99.0-r1(4)@04/07/2013)
[I] sys-auth/polkit-qt (0.103.0@04/11/2012)

wolfi323 wrote:You shouldn't change the defaults in /usr/share/polkit-1/actions/. Your changes there would get lost if you reinstall/update udisks2.
They get overridden by the settings in /etc/ anyway.

OK, yes, I know indeed. It was just an attempt, and it didn't work, even after a reboot.


wolfi323 wrote:And you showed the wrong one in your last post. That was for udisks-1.0...
For udisks2 it should have been /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy.

Ops, this may explain why my attempt was unsuccessful. I try with the right file now.

But this is the related piece of xml:
Code: Select all
  <action id="org.freedesktop.udisks2.filesystem-unmount-others">
    <description>Unmount a device mounted by another user</description>
    <description xml:lang="en_GB">Unmount a device mounted by another user</description>
    <message>Authentication is required to unmount a filesystem mounted by another user</message>
    <message xml:lang="en_GB">Authentication is required to unmount a filesystem mounted by another user</message>
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>

How should this be changed for testing? Do I set yes to them all?
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fbcyborg wrote:
wolfi323 wrote:
fbcyborg wrote:But I don't have the executable you mentioned: "set_polkit_default_privs".
That may be openSUSE specific then.

What polkit-related things do you have in /etc?
Code: Select all
ls -lR /etc/polkit*


Code: Select all
/etc/polkit-1:
total 4
drwx------ 2 polkitd root 4096 Jul 28 17:04 rules.d

/etc/polkit-1/rules.d:
total 4
-rw-r--r-- 1 polkitd root 321 Mar 16 19:30 50-default.rules

...
Ok, so you don't have specific rule settings in /etc.
In openSUSE there's /etc/polkit-default-privs.standard and /etc/polkit-default-privs.restrictive with the distributions default privilege settings, and /etc/polkit-default-privs.local where the local administrator can override those.
"set_polkit_default_privs" then generates the file /etc/polkit-1/rules.d/90-default-privs.rules out of them, which then contains the actual polkit rules config.

But this is the related piece of xml:
...
[/code]
How should this be changed for testing? Do I set yes to them all?

Yes.
Like this:
Code: Select all
  <action id="org.freedesktop.udisks2.filesystem-unmount-others">
    <description>Unmount a device mounted by another user</description>
    <description xml:lang="en_GB">Unmount a device mounted by another user</description>
    <message>Authentication is required to unmount a filesystem mounted by another user</message>
    <message xml:lang="en_GB">Authentication is required to unmount a filesystem mounted by another user</message>
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

Well, actually the last one should suffice since when you are logged into KDE you should have an "active" console...
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
The change did work!!! ;D

Now, according to this Wiki, I should find the right rule to be added in the /etc/polkit-1/rules.d/50-default.rules file in order to override the default setting in the file I've changed for testing.

EDIT: I must not edit that file.. as mentioned in it xD
wolfi323
Registered Member
Posts
1129
Karma
11
OS
fbcyborg wrote:The change did work!!! ;D

Now, according to this Wiki, I should find the right rule to be added in the /etc/polkit-1/rules.d/50-default.rules file in order to override the default setting in the file I've changed for testing.

EDIT: I must not edit that file.. as mentioned in it xD

Create a file /etc/polkit-1/rules.d/10-udisks2.rules with the following content:
Code: Select all
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-unmount-others") {
        return "yes";
    }
});

Then all users on your system should be able to unmount drives other users (or other programs than udisks2) mounted.
Of course you could restrict that for certain users or certain groups as explained in that Wiki article.
http://wiki.gentoo.org/wiki/Polkit#Rules

On openSUSE "set_polkit_default_privs" does create similar javascript snipplets in /etc/polkit-1/rules.d/90-default-privs.rules.
User avatar
fbcyborg
Registered Member
Posts
31
Karma
0
OS
Thank you so much. This solved the problem.

Great! ;)


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]