Tips & How-To's

[How-To] Enable Auto-Mounting of External Drives In openSUSE 11

Due to weird-ass PolicyKit rules, you may not be able to mount external drives – such as USB Hard drives, Pen drives, or other mass storage drives. while the drive gets recognised, on trying to mount you’ll end up with this error:

org.freedesktop.hal.storage.mount-removable no <– (action, result)

This is because of a PolicyKit rule, which prevents external media from being mounted. To get around this, you’ll have to edit the policy. So first open the terminal. Switch to root by typing

su root

Next, open the PolicyKit config file corresponding to Storage. This file is located at

/usr/share/PolicyKit/policy/org.freedesktop.hal.storage.policy

Open this file for editing, by typing
kate /usr/share/PolicyKit/policy/org.freedesktop.hal.storage.policy
Next, search for this section

<action id="org.freedesktop.hal.storage.mount-removable">
<description>Mount file systems from external drives.</description>
<message>System policy prevents mounting external media</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

And replace it with

<action id="org.freedesktop.hal.storage.mount-removable">
<description>Mount file systems from external drives.</description>
<message>System policy prevents mounting external media</message>
<defaults>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

Save the file, and then restart the HAL subsystem by typing

rchal restart

From now on, your external drives should be mounted with full access.

17 Comments

  1. Does it work for RHEL?
    As there is no file as /usr/share/PolicyKit/policy/org.freedesktop.hal.storage.policy in RHEL, there should be some other file. There is an XML file simillar to one in SUSE at ./usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi could be.

    Also does it have any security threat involved?

  2. @RD I don’t think this is needed for RHEL. The XML file you’ve mentioned is for the way the external/removable drives behave(ie, Sync transfer on/off etc).

    Given that a user needs to be logged on for a removable device to be mounted, there isn’t any security threat per-se

  3. Hi Sathya,
    Your fix is the only one that has worked for me amongst many I have tried. I am using OpenSuse 11 KDE 3.5.9 release 49.1. I still find that it seems a hit & miss situation so that the USB sticks sometimes seem to time out rather than mount. Still it is better than previously when I could only mount them using console as root.
    I also have PCLinux on the same computer as it is multiple boot, and using it the USB sticks mount without fail so it does not seem to be a hardware problem. Thanks for your advice. Frank

  4. Hi Frank,
    I’m happy that the above post could help you somehow. I don’t quite know why you’re getting the timeout, as on my system the USB drive has been connected for like > 6hours and still had no time outs. And as you mention, PCLinux works fine, so hardware problem is ruled out. I guess its some problem with openSUSE itself. If oyu do manage to find a fix, please do comment back here, it might be helpful for others.
    Thanks!

  5. I just moved from openSUSE 10.3 to 11.0 and was surprised to see that the automount feature didn’t work out “of the box.” Your fix worked great.

    Thanks.

  6. To avoid editing files, I think this can be done in two lines.
    Some openSUSE forum posts suggested:

    # sudo polkit-auth --grant org.freedesktop.hal.storage.mount-removable --user your_user_name

    # sudo polkit-auth --grant org.freedesktop.hal.storage.eject --user your_user_name

  7. Thanks a heap for this, I’ve been Googling it all day. I couldn’t get any love from the openSUSE forums either. First I tried your way, which works. Then i restored the file and did the second way as suggested above. The only thing I had to change was to make it ‘mount-fixed’ since removable drives can be set to automount with a GUI app. Kind of baffling why openSUSE would be set up this way. BTW, I’m on openSUSE 11.3, KDE. Don’t have this problem in Gnome.

Leave a Reply

Your email address will not be published. Required fields are marked *