2

I run Lubuntu 14.04 (without a display manager). When I connect a USB disk it is not automatically mounted and it doesn't show up in the file manager PCManFM. What daemon do I need to run to enable automatic mounting of USB disks?

5
  • I use sleep 5s && udisksctl mount -b /dev/sdb1 in my autostart where sdb1 is my USB disk.
    – DK Bose
    Aug 17, 2014 at 14:43
  • @DK Bose Thanks for the tip but in my case I want to have USB storage automatically mounted when it's connected to the computer Aug 17, 2014 at 14:53
  • Did you look under Edit, Preferences, Volume Management? There, have you ticked "Mount removable media automatically when they are mounted"?
    – DK Bose
    Aug 18, 2014 at 1:39
  • Yes, it's ticked (all options in PCManFM are at the default settings). If I run Lubuntu with the display manager (LightDM) removable media is mounted in PCManFM, so there must be some service/daemon started by LightDM that enables the automatic mounting. Aug 18, 2014 at 17:57
  • If I start my window manager (or just PCManFM) with dbus-launch the icons for removable media show up in PCManFM. However, when I try to access/mount such a disk I get the error message "Not authorized to perform operation." Any clues? Aug 21, 2014 at 14:22

2 Answers 2

0

The following two steps are required:

  1. Start the window manager with dbus-launch in ~/.xinitrc:

    exec dbus-launch --exit-with-session <your-wm>
    

    This makes the disks show up in PCManFM.

  2. Add a file named (e.g.) udisks.pkla to /etc/polkit-1/localauthority/50-local.d/ with the content:

    [Allow mounting removable media]
    Identity=unix-group:plugdev
    Action=org.freedesktop.udisks2.filesystem-mount
    ResultActive=yes
    ResultInactive=yes
    ResultAny=yes
    

Though this also allows unmounting of removable media I still get a (false) error message from PCManFM saying "Not authorized to perform operation".

0

In addition to August's answer, the following. When rightclicking on the mounted removable media in pcmanfm serveral actions to choose from show up. Two of those are Umount Volume and Eject Removable media. When Unmount Volume is chosen the volume will be unmounted without warning. If on the other hand Eject Removable media is chosen, the volume will be unmounted but not ejected and a "Not authorized to perform operation" message will appear. For permission to eject the media, another rule has to be added to /etc/polkit-1/localautority/50-local.d. In this directory create a file called udisks.drive-eject.pkla and add the following code to it:

[Allow ejecting removable media] Identity=unix-group:plugdev Action=org.freedesktop.udisks2.eject-media ResultActive=yes ResultInactive=yes ResultAny=yes

Now the removable media is ejectable. There will be no more warnings. Leftclicking on the mounted removable media in pcmanfm tells pcmanfm to eject the media, hence the warning before adding the second rule.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .