Automount External USB Drive/Flash - KDE desktop

Hallo,
I try to make that thing called policy-kit to work with my setup.
The setup: OS 12.1/KDE 4.8.2
All USB drives are mounted and the device notifier mounts the drives only when I enter the root password. And the same is true for the umount option. I have added the “appropriate” options with the polkit-auth as follows:

polkit-auth --grant org.freedesktop.hal.storage.mount-removable --user <username>
polkit-auth --grant org.freedesktop.hal.storage.eject --user <username>

But, the USB drives (or DVD, CDs etc) are still NOT automounted…
Any ideas?

All USB drives are mounted and the device notifier mounts the drives only when I enter the root password.

Are you sure?
Because this is not normal.
There are auto mount settings in the kde ‘system settings’

This sounds like leftovers from an older openSUSE installation. Did you upgrade? HAL has not been required since openSUSE 11.3, and PolicyKit packages should also no longer be present. I think it would be a good idea to check your configured repos.

zypper lr -d

If that checks out okay, then check for deprecated packages

rpm -qa |grep hal
rpm -qa |grep PolicyKit

I have to correct something in the original post. Removable media are NOT mounted, they are just shown on the Devide Notifier area. In order to mount them, I have to press the “Mount” button and then enter the root password. Now, regarding your clarifications.

Yes, I did upgrade the system with zypper dup from 11.4

Today, I cannot check if HAL is installed but yes, PolicyKit IS installed (check and see the commands I used).
What do I miss here? Isn’t PolicyKit installed by default?

Regarding the KDE, I have set it to automount everything.

Yes, I did upgrade the system with zypper dup from 11.4

Today, I cannot check if HAL is installed but yes, PolicyKit IS installed (check and see the commands I used).
What do I miss here? Isn’t PolicyKit installed by default?

I would expect that you should have the newer ‘polkit’ packages installed.

For reference, I have 11.4 installed, but upgraded to KDE4.6.5, and have

# rpm -qa |grep polkit
polkit-kde-kcmmodules-1-0.98.1-3.2.x86_64
libpolkit0-0.99-5.6.1.x86_64
polkit-default-privs-0.1_201102151742-1.2.1.noarch
libpolkit-qt-1-1-0.99.1-12.9.x86_64
polkit-0.99-5.6.1.x86_64
gconf-polkit-2.32.1-4.1.x86_64
polkit-kde-agent-1-0.99.0-3.1.x86_64

Any hal or PolicyKit packages (leftover from previous a OS version perhaps) should be removed. That is why I mentioned about checking configured repos etc.

What is reported by

pkaction --action-id org.freedesktop.udisks.filesystem-mount --verbose

I get

org.freedesktop.udisks.filesystem-mount:
  description:       Mount a device
  message:           Authentication is required to mount the device
  vendor:            The udisks Project
  vendor_url:        http://udisks.freedesktop.org/
  icon:              drive-removable-media
  implicit any:      no
  implicit inactive: no
  implicit active:   yes

Which allows me to mount external media without root credentials.

This PolicyKit documentation (applicable to 12.1 as well) could be useful to you
Chapter
In particular, sections 9.3.1 -9.3.3 deal with the newer commands and how to check or set privileges, and how to reset to default privileges if required.

I am on the PC now, so, let’s see what I have:


rpm -qa | grep -i hal
hal-devel-0.5.14-78.1.i586
hal-0.5.14-78.1.i586

~ zypper rm hal-devel hal

and HAL is not installed anymore.

Now, I have the PolicyKit installed:


pm -qa | grep -i poli
PolicyKit-0.9-36.1.3.i586
PolicyKit-doc-0.9-36.1.2.i586

And newer versions of polkit:


rpm -qa | grep -i polkit
polkit-default-privs-12.2-116.1.noarch
libpolkit-qt-1-1-0.99.1-35.1.i586
polkit-0.102-2.2.1.i586
libpolkit0-0.102-2.2.1.i586
polkit-kde-kcmmodules-1-debuginfo-0.98.1+git20110929-19.2.i586
polkit-kde-agent-1-0.99.0-28.1.i586
polkit-kde-kcmmodules-1-0.98.1+git20110929-19.2.i586

And now the most frustrating thing:


pkaction --action-id org.freedesktop.udisks.filesystem-mount --verbose
org.freedesktop.udisks.filesystem-mount:
  description:       Mount a device
  message:           Authentication is required to mount the device
  vendor:            The udisks Project
  vendor_url:        http://udisks.freedesktop.org/
  icon:              drive-removable-media
  implicit any:      no
  implicit inactive: no
  implicit active:   yes

So, according to you, having the above output from pkaction I should see the USB devices be mounted automatically, without any authentication…

I rebooted the system in order to get rid of any HAL-related issues, or due to the old PolicyKit, but the situation is the same. USB HDD/Key is recognized, Konqueror has it in the devices list, but when I click on it, it requests root password.

Next step will be to check with a new user.

Now, I have the PolicyKit installed:

The ‘PolicyKit’ packages should NOT be present. This could be the tip of the iceberg (with other packages prior to the upgrade leaving your system in an inconsistent state). It may not be a simple situation to resolve, depending on what else may have gone awry. As I’ve suggested previously, you should check and/or post your configured repos to make sure they’re all approriate.

So, according to you, having the above output from pkaction I should see the USB devices be mounted automatically, without any authentication…

Not quite. It only controls authorization, not automatic mounting - that is a function of the desktop configuration.

You could check the following too (as outlined in 9.3.2.1 in the guide I linked to previously)

YaST>System>/etc/sysconfig Editor. Navigate to System>Security>PolicyKit>POLKIT_DEFAULT_PRIVS
*Make sure that ‘restrictive’ is not set. It should be blank, or ‘standard’. If it needs to be changed, then once done and saved, run ‘set_polkit_default_privs’ (as root) to activate your settings.

The /etc/sysconfig/security has no restrictions:


CHECK_PERMISSIONS="set"
PERMISSION_SECURITY="secure local"
CHECK_SIGNATURES="yes"
CHECK_POLKIT_PRIVS=""
POLKIT_DEFAULT_PRIVS=""

The repos I have are:


#  | Alias                                   | Name                                    | Enabled | Refresh | URI                                                                                                         
---+-----------------------------------------+-----------------------------------------+---------+---------+-------------------------------------------------------------------------------------------------------------
 1 | Java                                    | Java                                    | Yes     | Yes     | http://download.opensuse.org/repositories/Java:/packages/openSUSE_12.1                                      
 2 | KDE 4.8 - Core                          | KDE 4.8 - Core                          | Yes     | No      | http://download.opensuse.org/repositories/KDE:/Release:/48/openSUSE_12.1/                                   
 3 | KDE 4.8 - Extra                         | KDE 4.8 - Extra                         | Yes     | No      | http://download.opensuse.org/repositories/KDE:/Extra/KDE_Release_48_openSUSE_12.1/                          
 4 | KDE 4.8 - Telepathy                     | KDE 4.8 - Telepathy                     | Yes     | No      | http://download.opensuse.org/repositories/KDE:/Unstable:/Playground:/Telepathy/KDE_Release_48_openSUSE_12.1/
 5 | KDE3                                    | KDE3                                    | Yes     | Yes     | http://download.opensuse.org/repositories/KDE%3a/KDE3/openSUSE_12.1                                         
 6 | LibreOffice                             | LibreOffice                             | Yes     | No      | http://widehat.opensuse.org/repositories/LibreOffice:/Unstable/openSUSE_12.1/                               
 7 | Main_Repository_(NON-OSS)               | Main Repository (NON-OSS)               | Yes     | Yes     | http://download.opensuse.org/distribution/12.1/repo/non-oss/                                                
 8 | Main_Repository_(OSS)                   | Main Repository (OSS)                   | Yes     | Yes     | http://download.opensuse.org/distribution/12.1/repo/oss/                                                    
 9 | Main_Update_Repository                  | Main Update Repository                  | Yes     | Yes     | http://download.opensuse.org/update/12.1                                                                    
10 | Mozilla 11.4                            | Mozilla                                 | Yes     | No      | http://download.opensuse.org/repositories/mozilla/openSUSE_12.1                                             
11 | Muzlocker                               | Muzlocker                               | Yes     | No      | http://download.opensuse.org/repositories/home:/muzlocker/openSUSE_12.1/                                    
12 | OSS_Source                              | OSS Source                              | No      | No      | http://download.opensuse.org/source/distribution/11.4/repo/oss/                                             
13 | Packman_Repository                      | Packman Repository                      | Yes     | Yes     | http://packman.inode.at/suse/12.1/                                                                          
14 | Playground                              | Playground                              | Yes     | No      | http://download.opensuse.org/repositories/KDE:/Unstable:/Playground/openSUSE_12.1_KDE_Unstable_SC/          
15 | SubPixel                                | SubPixel                                | No      | No      | http://opensuse-community.org/subpixel/openSUSE_11.3_Update/                                                
16 | User_muzlocker_-_Subpixel               | User muzlocker - Subpixel               | Yes     | Yes     | http://download.opensuse.org/repositories/home:/muzlocker/openSUSE_12.1                                     
17 | VideoLan_Repository                     | VideoLan Repository                     | No      | No      | http://download.videolan.org/pub/videolan/vlc/SuSE/11.4/                                                    
18 | download.opensuse.org-database_1        | openSUSE BuildService - Database        | Yes     | No      | http://download.opensuse.org/repositories/server:/database/openSUSE_12.1                                    
19 | download.opensuse.org-mozilla_2         | openSUSE BuildService - Mozilla         | Yes     | Yes     | http://download.opensuse.org/repositories/mozilla/openSUSE_12.1                                             
20 | openSUSE_BuildService_-_Database_1      | openSUSE BuildService - Database        | No      | No      | http://download.opensuse.org/repositories/server%3a/database/openSUSE_11.4/                                 
21 | openSUSE_BuildService_-_KDE:Extra       | openSUSE BuildService - KDE:Extra       | No      | No      | http://download.opensuse.org/repositories/KDE:/Extra/openSUSE_11.4/                                         
22 | openSUSE_BuildService_-_KDE:UpdatedApps | openSUSE BuildService - KDE:UpdatedApps | No      | No      | http://download.opensuse.org/repositories/KDE:/UpdatedApps/openSUSE_11.4/                                   
23 | openSUSE_BuildService_-_PHP_1           | openSUSE BuildService - PHP             | No      | No      | http://download.opensuse.org/repositories/server%3a/php/openSUSE_11.4/                                      
24 | server:php:applications                 | server:php:applications                 | Yes     | Yes     | http://download.opensuse.org/repositories/server:/php:/applications/openSUSE_12.1

I’m not surprised you’re having problems! You have a number of 11.4 repos which need removing. This could be causing all sorts of problems for your system.

12 | OSS_Source                              | OSS Source                              | No      | No      | http://download.opensuse.org/source/distribution/11.4/repo/oss/
20 | openSUSE_BuildService_-_Database_1      | openSUSE BuildService - Database        | No      | No      | http://download.opensuse.org/repositories/server%3a/database/openSUSE_11.4/                                 
21 | openSUSE_BuildService_-_KDE:Extra       | openSUSE BuildService - KDE:Extra       | No      | No      | http://download.opensuse.org/repositories/KDE:/Extra/openSUSE_11.4/                                         
22 | openSUSE_BuildService_-_KDE:UpdatedApps | openSUSE BuildService - KDE:UpdatedApps | No      | No      | http://download.opensuse.org/repositories/KDE:/UpdatedApps/openSUSE_11.4/                                   
23 | openSUSE_BuildService_-_PHP_1           | openSUSE BuildService - PHP             | No      | No      | http://download.opensuse.org/repositories/server%3a/php/openSUSE_11.4/        

This one is for 11.3!

15 | SubPixel                                | SubPixel                                | No      | No      | http://opensuse-community.org/subpixel/openSUSE_11.3_Update/   

They need removing immediately. I can’t guarantee getting your system into a consistent state, but once you’ve removed the inappropriate repos, you may get lucky with

zypper up

or perhaps

zypper ve

On 2012-05-03 12:06, deano ferrari wrote:
>
> I’m not surprised you’re having problems! You have a number of 11.4
> repos which need removing. This could be causing all sorts of problems
> for your system.

They are disabled, they can not affect.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On 2012-05-03 11:46, tpe wrote:
>
> The /etc/sysconfig/security has no restrictions:
>
> Code:
> --------------------
>
> CHECK_PERMISSIONS=“set”
> PERMISSION_SECURITY=“secure local”
> CHECK_SIGNATURES=“yes”
> CHECK_POLKIT_PRIVS=""
> POLKIT_DEFAULT_PRIVS=""
>
> --------------------

You do have restrictions. You have it set it to “secure”.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

The PERMISSION_SECURITY has nothing to do with PolicyKit, as far as I understand it.

On 2012-05-03 16:36, tpe wrote:
>
> The PERMISSION_SECURITY has nothing to do with PolicyKit, as far as I
> understand it.

I would not be so sure of it. Try.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

They are disabled, they can not affect.

Not any more, but not a good idea to keep anyway, and they definitely have been enabled at some point, because hal and PolicyKit packages should not be present in the OP’s system

On 2012-05-04 11:36, deano ferrari wrote:
>
>> They are disabled, they can not affect.
> --------------------
>
> Not anymore, but not a good idea to keep anyway, and they definitely
> have been enabled at some point, because hal and PolicyKit packages
> should not be present in the OP’s system

It is possible that he upgraded from an older system, and old repos were
simply disabled. I do that myself as a reminder of which repos I might want
to re-enable after editing the version.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I was sure that the problem was not that, but anyway, I removed the “secure” from Permissions’ policy and replace it with the easy local and added the Standard in the polkit.


CHECK_PERMISSIONS="set"
PERMISSION_SECURITY="easy local"
CHECK_SIGNATURES="yes"
CHECK_POLKIT_PRIVS=""
POLKIT_DEFAULT_PRIVS="standard"

So, in effect, I have no progress… Any other idea? It is really annoying all that thing…

On 2012-05-09 13:56, tpe wrote:
>
> I was sure that the problem was not that, but anyway, I removed the
> “secure” from Permissions’ policy and replace it with the easy local and
> added the Standard in the polkit.

You also need to apply it. Previous to 12.1 it was SuSEconfig.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Of course I did.
And a few more reboots too.