Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] automounting usb drives

251 views
Skip to first unread message

luis jure

unread,
Feb 25, 2011, 8:40:02 PM2/25/11
to

hello list,

i'm old-fashioned and i never cared for this automount thing, but now i
have two pen drives and two usb hard disks that i have to mount and umount
all the time, and doing it by hand every time is beginning to be very
annoying...

i see that distributions like ubuntu and others have this feature by
default: you plug in a pen drive and it creates a mount point under /media
and mounts the device there. but i have no idea to get something like that
working on my gentoo machine. i searched the web, but the documents i
found on the subject are somewhat contradictory and all of them too old
for comfort.

any hints about a standard "gentoo way" to achieve this?

by the way, i use xfce, so i can't use tools specific for kde or gnome, if
they exist.

best,

lj

Dale

unread,
Feb 25, 2011, 8:50:02 PM2/25/11
to

I know what xfce is but not have no experience with it. Would this help?

[I] sys-fs/udisks
Available versions: 1.0.1-r1!t{tbz2} 1.0.2!t{tbz2}
{bash-completion debug doc nls remote-access}
Installed versions: 1.0.2!t{tbz2}(18:36:11 02/25/11)(nls
-bash-completion -debug -doc -remote-access)
Homepage: http://www.freedesktop.org/wiki/Software/udisks
Description: Daemon providing interfaces to work with
storage devices

* xfce-extra/xfce4-mount-plugin
Available versions: 0.5.5 {debug}
Homepage: http://www.xfce.org/
Description: Mount plugin for the Xfce panel

That last one should put you on the right path for sure.

Hope the helps.

Dale

:-) :-)

Nikos Chantziaras

unread,
Feb 25, 2011, 11:10:02 PM2/25/11
to
On 02/26/2011 03:31 AM, luis jure wrote:
>[...]

> i see that distributions like ubuntu and others have this feature by
> default: you plug in a pen drive and it creates a mount point under /media
> and mounts the device there. but i have no idea to get something like that
> working on my gentoo machine.

Make sure you have udev enabled for your desktop environment. Or HAL,
if it doesn't support udev. Then it will just work.

luis jure

unread,
Feb 26, 2011, 6:50:02 AM2/26/11
to
on 2011-02-25 at 19:42 Dale wrote:


>* xfce-extra/xfce4-mount-plugin
> Available versions: 0.5.5 {debug}
> Homepage: http://www.xfce.org/
> Description: Mount plugin for the Xfce panel
>
>That last one should put you on the right path for sure.

hi dale, i do have the mount panel plugin already, but it's just an
interface to what's in fstab. not very useful when you have several usb
disks and pendrives with different file systems on them, that you want to
mount on the fly...

luis jure

unread,
Feb 26, 2011, 6:50:02 AM2/26/11
to
on 2011-02-26 at 06:00 Nikos Chantziaras wrote:


>Make sure you have udev enabled for your desktop environment. Or HAL,
>if it doesn't support udev. Then it will just work.

hi nikos, the only package in xfce that has a flag for udev is
xfce-base/xfce4-session and it is set. i-m afraid it doesn't just work...

Marc Joliet

unread,
Feb 26, 2011, 7:50:02 AM2/26/11
to
Am Fri, 25 Feb 2011 23:31:07 -0200
schrieb luis jure <l...@internet.com.uy>:

> hello list,

Hi,

It seems that for Xfce you want the Thunar Volume Manager plugin
(xfce-extra/thunar-volman):
http://goodies.xfce.org/projects/thunar-plugins/thunar-volman

Otherwise, I know of three modern (i.e. udev or udisks based) desktop
independent ways for auto-mounting:
- uam
A udev based auto-mounter. It doesn't mount CD/DVD/etc. drives (because, well,
it's udev-based), but otherwise worked flawlessly on my machine.
- udiskie
A udisks based auto-mounter, doesn't work properly for me, i.e. one of
my USB sticks wouldn't mount, apparently because udisks flagged it as
non-automountable.
- udisks-glue
A udisks based tool that can execute arbitrary commands on udisks events, e.g.
auto-mount disks.

(My personal preference is currently udisks-glue.)

HTH
--
Marc Joliet

signature.asc

luis jure

unread,
Feb 26, 2011, 8:40:02 AM2/26/11
to

hi marc,


>It seems that for Xfce you want the Thunar Volume Manager plugin

i had already installed this plugin, but it doesn't seem to do much: an
icon for the device appears on the side panel, but no corresponding mount
point is created under /media. when i click on the icon a "Not Authorized"
message appears.

>Otherwise, I know of three modern (i.e. udev or udisks based) desktop
>independent ways for auto-mounting:

thanks for the suggestions. i'm thinking of giving udiskie a try, but i'm
unable to find any documentation about it: what am i supposed to do after
installation? anything to configure, init scripts to run?

alles gute,

lj

luis jure

unread,
Feb 26, 2011, 9:50:01 AM2/26/11
to
on 2011-02-26 at 11:30 luis jure wrote:


>i had already installed this plugin, but it doesn't seem to do much: an
>icon for the device appears on the side panel, but no corresponding mount
>point is created under /media. when i click on the icon a "Not Authorized"
>message appears.

i'm getting somewhat closer, it seems. launching an xfce session as root
i can sure mount the device, but not as normal user. from thunar i get the
message above, and typing udiskie on a console, i get this:

failed to mount device /org/freedesktop/UDisks/devices/sdc1:
org.freedesktop.UDisks.Error.PermissionDenied: Not Authorized

hmmmm.... any hints?

Nikos Chantziaras

unread,
Feb 26, 2011, 10:00:02 AM2/26/11
to

Do you have any entries for those devices in /etc/fstab? If yes, delete
them. They interfere with automounting.

Marc Joliet

unread,
Feb 26, 2011, 10:00:02 AM2/26/11
to
Am Sat, 26 Feb 2011 11:30:45 -0200
schrieb luis jure <l...@internet.com.uy>:

> hi marc,

Hi Luis,



> >It seems that for Xfce you want the Thunar Volume Manager plugin
>
> i had already installed this plugin, but it doesn't seem to do much: an
> icon for the device appears on the side panel, but no corresponding mount
> point is created under /media. when i click on the icon a "Not Authorized"
> message appears.

[...]


> thanks for the suggestions. i'm thinking of giving udiskie a try, but i'm
> unable to find any documentation about it: what am i supposed to do after
> installation? anything to configure, init scripts to run?

Udiskie runs as a user process, so you just need to start it during login.

According to the README file [0], udiskie uses consolekit to obtain necessary
permissions. That means that you need to emerge xfce4-session with the use
flags +consolekit. If you do not already have that use flag set then that is
probably why thunar-volman did not work correctly. If it is not already the
case, you will need to add consolekit to the default runlevel.

> alles gute,
>
> lj

[0] viewable online at
https://bitbucket.org/byronclark/udiskie/src/62047ac3fdaf/README

HTH
--
Marc Joliet

signature.asc

luis jure

unread,
Feb 26, 2011, 10:20:02 AM2/26/11
to
on 2011-02-26 at 16:53 Nikos Chantziaras wrote:


>Do you have any entries for those devices in /etc/fstab? If yes, delete
>them. They interfere with automounting.

i had already deleted them, only after doing so the device icon began to
appear on thunar. but i can't mount it as a normal user, only as root.

luis jure

unread,
Feb 26, 2011, 10:20:01 AM2/26/11
to
on 2011-02-26 at 15:47 Marc Joliet wrote:


>According to the README file [0], udiskie uses consolekit to obtain
>necessary permissions. That means that you need to emerge xfce4-session
>with the use flags +consolekit.

i recompiled xfce4-session with +consolekit, but the situation remains
unchanged.


>If it is not already the case, you will need to add consolekit to the
>default runlevel.

ditto. :-(

Christoph Brendes

unread,
Feb 26, 2011, 10:30:02 AM2/26/11
to
Hi, for me it works (xfce 4.8 with udev and udisk)

please check if you

- enable the volume manager (thunar preferences: "Advanced" tab)
- you are in the plugdev group

On Sat, 26 Feb 2011 11:30:45 -0200
luis jure <l...@internet.com.uy> wrote:

> >It seems that for Xfce you want the Thunar Volume Manager plugin
>
> i had already installed this plugin, but it doesn't seem to do much:
> an icon for the device appears on the side panel, but no
> corresponding mount point is created under /media. when i click on
> the icon a "Not Authorized" message appears.

Regards,
Christoph

luis jure

unread,
Feb 26, 2011, 10:30:02 AM2/26/11
to
on 2011-02-26 at 16:17 Christoph Brendes wrote:


>Hi, for me it works (xfce 4.8 with udev and udisk)
>
>please check if you
>
>- enable the volume manager (thunar preferences: "Advanced" tab)
>- you are in the plugdev group

yes to both... :-(

Nikos Chantziaras

unread,
Feb 26, 2011, 10:40:02 AM2/26/11
to

Another shot:

Make sure your user belongs to these groups:

disk usb plugdev

Christoph Brendes

unread,
Feb 26, 2011, 10:50:01 AM2/26/11
to

Did you use HAL?

Christoph

Marc Joliet

unread,
Feb 26, 2011, 11:50:01 AM2/26/11
to
Am Sat, 26 Feb 2011 13:14:32 -0200
schrieb luis jure <l...@internet.com.uy>:

> on 2011-02-26 at 15:47 Marc Joliet wrote:

Hmm, how do you start your xfce session? I assumed that Xfce comes with it's
own login manager, but I can't find any references to one (except in an email
from 2003 mentioning xfce-mcs-manager). The Gentoo Xfce guide only mentions
SLiM.

My understanding is that the session needs to register with the consolekit
daemon, which is done either by the login/display manager or with the help of
ck-launch-session. If you start Xfce via "startxfce4" then you need to preface
that with ck-launch-session, i.e. "ck-launch-session startxfce4". You can try
starting xfce that way from a shell outside of X.

For comparison, I have the following setup:
- consolekit installed with +pam +policykit
- slim as login manager with per-user .xinitrc
- in ~/.xinitrc, start my window manager with "exec ck-launch-session awesome"

One more random idea: maybe xfce4-session needs the policykit use flag set, too?
I really don't know if it's needed here, but you can try.

HTH
--
Marc Joliet
--

signature.asc

walt

unread,
Feb 26, 2011, 5:50:02 PM2/26/11
to

xfce4-session also recognizes the policykit and consolekit USE flag, and
those two things seem to be the way of the future (until tomorrow, anyway)
for desktop managers like kde and gnome.

xfce has always been closely related to gnome, and it still uses the gnome
USE flag, I see. I'd suggest setting the three USE flags I've mentioned
and see what happens.

luis jure

unread,
Feb 26, 2011, 7:10:02 PM2/26/11
to
on 2011-02-26 at 14:44 walt wrote:

>xfce4-session also recognizes the policykit and consolekit USE flag, and
>those two things seem to be the way of the future (until tomorrow, anyway)
>for desktop managers like kde and gnome.
>
>xfce has always been closely related to gnome, and it still uses the gnome
>USE flag, I see. I'd suggest setting the three USE flags I've mentioned
>and see what happens.

OK, i undid everything i had been trying and decided to try this path. i
recompiled xfce4-session with policykit, consolekit and gnome.

i don't have a graphical login manager, i start X with startx from the
console, and my .xinitrc is simply:

exec ck-launch-session startxfce4

if i start X as root things work in a more or less satisfactory way: pen
drives appear on the side bar on thunar and i can mount and eject them
(not umount).

but if i start X as a normal user, i get a "not authorized" message from
thunar and i can't mount the devices.

now, i belong to just about every group out there:

root disk lp wheel audio cdrom video cdrw usb users lpadmin portage
plugdev lj vboxusers scanner

any ideas why i don't have permissions to mount the usb drives?
(also, after doing these changes i can't shutdown or reboot form xfce)

anyway, it seems i'm getting closer... a big thank you to all that have
been following this thread, i hope i'll be able to resolve this last
issue...


best,

lj

Paul Colquhoun

unread,
Feb 26, 2011, 7:40:02 PM2/26/11
to


If it involved PolicyKit, that may be the cause. Look in
/etc/PolicyKit/PolicyKit.conf and see if that is blocking your access. I had
to add/modify mine to allow user mounts. This is the relevent section I had to
change:


<match action="org.freedesktop.hal.storage.*">
<return result="yes" />
</match>


--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Before you criticize someone, you should walk a mile in their shoes.
Then, when you do, you'll be a mile away, and you'll have their shoes.

luis jure

unread,
Feb 26, 2011, 9:20:01 PM2/26/11
to
on 2011-02-27 at 11:32 Paul Colquhoun wrote:


>If it involved PolicyKit, that may be the cause. Look in
>/etc/PolicyKit/PolicyKit.conf and see if that is blocking your access.

mmm... i don't have this file (or the /etc/PolicyKit directory, for that
matter). i only have the /etc/polkit-1 directory, belonging to
sys-auth/polkit.

the PolicyKit.conf file should already be there? which package provides
it? or can i just create it from scratch?

best,

lj

Paul Colquhoun

unread,
Feb 26, 2011, 10:00:01 PM2/26/11
to


Hmmm. "equery b" for /etc/PolicyKit/PolicyKit.conf or just /etc/PolicyKit
doesn't return any packages on my system.

I suspect that they belong to some part of KDE, as the permission errors I was
tracking down came from the Dolphin file manager, and they could thus control
how KDE uses the policykit framework. They may also be leftovers from when
KDE/Gentoo used to use policykit, and have since stopped. It's sometimes hard
to keep up with these changes.

It's possible that I created the file and directory by hand, after finding
instructions via Google search, such as
https://bbs.archlinux.org/viewtopic.php?id=65070

In case you want to risk this, the full content of my file is:

#####################
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">

<!-- See the manual page PolicyKit.conf(5) for file format -->

<config version="0.1">

<define_admin_auth group="wheel"/>

<match user="root">


<return result="yes"/>
</match>

<match action="org.freedesktop.hal.storage.*">
<return result="yes" />
</match>

</config>
#####################

Dale

unread,
Feb 26, 2011, 10:10:01 PM2/26/11
to

I don't have those either. According to eix, policykit is no longer in
portage either. The package polkit is there tho. I have it installed
here which is pulled in by KDE. According to the dev mailing list,
policykit is gone:

> # Samuli Suominen<ssuo...@gentoo.org> (25 Jan 2011)
> # Replaced by sys-auth/polkit. Removal in 30 days.
> # Bug 340331.
> sys-auth/policykit
>
>
>
> Maybe things will get a little bit less confusing now...;-)
>

Might want to check into polkit instead.

Dale

:-) :-)

Duong "Yang" Ha Nguyen

unread,
Feb 26, 2011, 10:30:01 PM2/26/11
to

Hal is deprecated. Try avoiding it as much as possible.

Best regards,
--
Dương "Yang" Hà Nguyễn
Web log: http://cmpitg.wordpress.com/
"Life is a hack"

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT/C/ED/L d++ s-:-(:) !a C+++(++++) ULU++++>$ P-- L+++>$ E+++
W++>+++ N+ o+ K w--- O- M@ V- PS+ PE++ Y+>++ PGP++ t+ 5 X+ R-
tv+ b+++ DI+++ D++ G+++ e* h* r* y-
-----END GEEK CODE BLOCK-----

luis jure

unread,
Feb 27, 2011, 6:20:02 AM2/27/11
to
on 2011-02-27 at 10:20 Duong "Yang" Ha Nguyen wrote:

>Hal is deprecated. Try avoiding it as much as possible.

that's what i'm doing, for sure!

Stéphane Guedon

unread,
Feb 27, 2011, 7:50:02 AM2/27/11
to

I have read all the discussion, and, unfortunately, I can't help you Luis.
But I am asking the way to assign mountpoint like hal did.

As it is said, Hal is deprecated. But it was easy to say "when you plug
6566-3243 flash drive, the mountpoint should be my_usbdisk".

Now, automounting works good and great for me with udev/udisks, no problem,
except that I would like to have the same behavior : having my drives to the
mount point I want (having good icons rather than just a usual folder icon
would be a plus !).

I am right now on KDE 4.6, and so...

--
Stéphane Guedon
page web : http://www.22decembre.eu/
carte de visite : http://www.22decembre.eu/downloads/Stephane-Guedon.vcf
clé publique gpg : http://www.22decembre.eu/downloads/Stephane-Guedon.asc

signature.asc

luis jure

unread,
Feb 27, 2011, 8:00:01 AM2/27/11
to
on 2011-02-27 at 13:51 Paul Colquhoun wrote:

>Hmmm. "equery b" for /etc/PolicyKit/PolicyKit.conf or
>just /etc/PolicyKit doesn't return any packages on my system.

from what i could find on the web, it seems to me
that /etc/PolicyKit/PolicyKit.conf belongs to a deprecated policykit
package, superseded (at least on my system) by polkit, the configuration
files of which are under /etc/polkit-1

now, i found lots of examples on the web how to configure the old
PolicyKit.conf file to allow normal users mount usb devices, but it took
some time to find out how to configure the polkit files. here's what i
found, and it works:


/etc/polkit-1/localauthority.conf.d/50-localauthority.conf :

[Configuration]
AdminIdentities=unix-group:wheel


/etc/polkit-1/localauthority/50-local.d/11-my-polkit-udisks.pkla

[udisks full access]
Identity=unix-user:<your username>
Action=org.freedesktop.udisks.*
ResultAny=yes

[http://forums.gentoo.org/viewtopic-t-858965-postdays-0-postorder-asc-start-25.html]

i guess that in the second file i could also use unix-group:wheel (or users
or whatever) instead of unix-user, but i'm the only one using this machine,
so it's just as well.

now automounting "just works", without needing anything else, like udev
rules or additional automonting packages.

PENDING ISSUE: on thunar (and xfce, the other file manager i occasionally
use) i can eject the drive but no umount it (i mean the ability to umount
the file system but not delete the mount point under /media)

a big thank you (und vielen dank) to everybody!

lj

Stéphane Guedon

unread,
Feb 27, 2011, 12:10:02 PM2/27/11
to
On Sunday 27 February 2011 13:39:49 Stéphane Guedon wrote:
> On Sunday 27 February 2011 12:13:21 luis jure wrote:
> > on 2011-02-27 at 10:20 Duong "Yang" Ha Nguyen wrote:
> > >Hal is deprecated. Try avoiding it as much as possible.
> >
> > that's what i'm doing, for sure!
>
> I have read all the discussion, and, unfortunately, I can't help you Luis.
> But I am asking the way to assign mountpoint like hal did.
>
> As it is said, Hal is deprecated. But it was easy to say "when you plug
> 6566-3243 flash drive, the mountpoint should be my_usbdisk".
>
> Now, automounting works good and great for me with udev/udisks, no problem,
> except that I would like to have the same behavior : having my drives to
> the mount point I want (having good icons rather than just a usual folder
> icon would be a plus !).
>
> I am right now on KDE 4.6, and so...

solved using mlabel...
I needed to look upon ubuntu doc ! This is a little bit crap !

but thanks ! :-)

signature.asc

walt

unread,
Feb 27, 2011, 2:30:02 PM2/27/11
to
On 02/27/2011 04:54 AM, luis jure wrote:

> PENDING ISSUE: on thunar (and xfce, the other file manager i occasionally
> use) i can eject the drive but no umount it (i mean the ability to umount
> the file system but not delete the mount point under /media)

The auth/policy landscape has changed so quickly in the last few months
that I can't keep up, but I can tell you that you might want to play with
the command-line tools from consolekit and polkit when root-versus-user
problems occur.

For example, look through the output of pkaction --verbose for this:

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

Look at the last three lines for 'any' 'inactive' and 'active'. What do
they mean?

They refer to your 'console session', which you can list with ck-list-sessions:

Session1:
unix-user = '1001'
realname = '(null)'
seat = 'Seat1'
session-type = ''
active = FALSE <====== NOTE
x11-display = ''
x11-display-device = ''
display-device = '/dev/tty1'
remote-host-name = ''
is-local = TRUE
on-since = '2011-02-27T14:05:03.842279Z'
login-session-id = '1'
idle-since-hint = '2011-02-27T14:05:40.005781Z'
Session2:
unix-user = '1001'
realname = '(null)'
seat = 'Seat1'
session-type = ''
active = TRUE <======= NOTE
x11-display = ':0'
x11-display-device = '/dev/tty7'
display-device = '/dev/tty1'
remote-host-name = ''
is-local = TRUE <======= NOTE
on-since = '2011-02-27T14:05:16.819654Z'
login-session-id = '1'

Session1 is my original login on tty1, from which I typed 'startx'.

That session is not active because I'm writing this from inside the
gnome desktop, i.e. Session2, which *is* active (note the tty7).

The old defunct policykit also dictated whether a session had to be
'local' to do certain things, but that may have vanished, dunno.

The old policykit came with very simple and understandable tools to
set and edit policies, and the defunct gnome-policykit gave you a
simple gui frontend so you could tell WTF you were doing.

Alas, no more, and the new system is virtually opaque. Not well done,
IMHO.

My point is (almost forgot it) that automounting stopped working for
many months in gnome because consolekit claimed that my ck-session
was *not* active and *not* local even though obviously it was both.

Some recent update finally fixed that bug, thankfully, but I have
no idea which update.

0 new messages