Page 1 of 2

[SOLVED] usb automount in thunar as unprivileged user

Posted: Sat Jan 09, 2016 5:16 pm
by eat64sgs
Hi there,

my new system is installed and it runs fine.

So only one question is unsolved.

How does the filemanager thunar automount usb devices for unprivileged users?

Usbmount, udisks2, gvfs-packages are installed.

Thank you for an answer.

eat64sgs

Re: usb automount in thunar as unprivileged user

Posted: Sat Jan 09, 2016 5:46 pm
by machinebacon
You need 1) consolekit installed
and 2) a magic line in your xinitrc:

exec dbus-launch startxfce4 --with-ck-launch

Re: usb automount in thunar as unprivileged user

Posted: Sat Jan 09, 2016 7:18 pm
by eat64sgs
Hello machinebacon,

thanks for your answer.

Unfortunately it doesn't work.

I get following message:

'Not authorized to perform operation
(polkit authority not available and caller is not uid 0).'

Openbox is my windowmanager. The magig line in my .xinitrc is:

'exec dbus-launch --with-ck-launch --exit-with-session openbox-session'

What can I do?

eat64sgs

Re: usb automount in thunar as unprivileged user

Posted: Sat Jan 09, 2016 7:51 pm
by machinebacon
Hi eat62sgs,

then you need the magic in /etc/polkit-1 and in /usr/share/polkit-1/actions

http://crunchbang.org/forums/viewtopic.php?id=34355 (achtung achtung, long read)

Before you waste your time, try adding thunar-volman (and log in again) -- maybe this fixes it already. Though, I remember it was a serious PITA to fool policykit/consolekit/dbus/whatchacallit

If this also fails, you have four alternatives:
- use "sudo automount" to mount them all
- create entries in your /etc/fstab for you USB drives
- install pmount and run it as root like "sudo pmount /dev/sdc"
- install systemd and let it take care of the elevated privileges
- use a login manager (lightdm), however, I don't remember/know if this will fix it (still)

I would simply do it manually with pmount. If the USB drive is one you often use, stick its entry into /etc/fstab

Re: usb automount in thunar as unprivileged user

Posted: Sat Jan 09, 2016 10:07 pm
by simgin
Sorry
/offtopic
Seriously Julius how can you all this o.O
Mightily impressed!

/offtopic

cheerio
simon

Re: usb automount in thunar as unprivileged user

Posted: Sun Jan 10, 2016 8:37 am
by eat64sgs
Oh yeah,

a lot of work.

I will see how I solve it and rewrite.

eat64sgs

Re: usb automount in thunar as unprivileged user

Posted: Sun Jan 10, 2016 10:52 am
by machinebacon
It has always been problematic, if you check google and enter the error message you'll see that it happens everywhere from Arch to Zenwalk.

Re: usb automount in thunar as unprivileged user

Posted: Sun Jan 10, 2016 10:43 pm
by Theo
machinebacon wrote:
I would simply do it manually with pmount. If the USB drive is one you often use, stick its entry into /etc/fstab
^ This and I *personally* wouldn't use Thunar on a non-bloated system.
Thunar comes *standard* with things like the XFCE4 Panel etc.
Sure you can disable some things, but if you're in doubt you could be hooked up with some stuff that you don't need.
I don't mean to be offensive, but Thunar isn't that lightweight compared to other graphical alternatives (pcmanfm or rox-filer).

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 4:22 am
by machinebacon
To each his own, but we have to get a fact straight: Thunar has ho dependency on xfce4-panel or any other 'module' of the xfce4 desktop, apart from a shared library (that is needed for a optional integration of notification daemon or volume management applet)

Code: Select all

user@grill:~$ depends thunar
thunar
  Depends: libatk1.0-0
  Depends: libc6
  Depends: libcairo2
  Depends: libdbus-1-3
  Depends: libdbus-glib-1-2
  Depends: libexo-1-0
  Depends: libgdk-pixbuf2.0-0
  Depends: libglib2.0-0
  Depends: libgtk2.0-0
  Depends: libgudev-1.0-0
  Depends: libice6
  Depends: libnotify4
  Depends: libpango-1.0-0
  Depends: libsm6
  Depends: libthunarx-2-0
  Depends: libxfce4ui-1-0
  Depends: libxfce4util7
  Depends: libxfconf-0-2
  Depends: thunar-data
  Depends: desktop-file-utils
  Depends: shared-mime-info
  Depends: exo-utils

user@grill:~$ depends pcmanfm
pcmanfm
  Depends: libatk1.0-0
  Depends: libc6
  Depends: libcairo2
  Depends: libfm-gtk4
  Depends: libfm4
  Depends: libfontconfig1
  Depends: libfreetype6
  Depends: libgdk-pixbuf2.0-0
  Depends: libglib2.0-0
  Depends: libgtk2.0-0
  Depends: libpango-1.0-0
  Depends: libpangocairo-1.0-0
  Depends: libpangoft2-1.0-0
  Depends: libx11-6
Of course the best is to simply use coreutils.

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 7:29 am
by Theo
I'm glad that it isn't so with linuxbbq, but I'm 100% sure that you'll get the xfce4-panel with the standard 'sudo apt-get install thunar' in a netinstall with Ubuntu ;)

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 8:19 am
by wuxmedia
^ likely something to do with the apt prefs. --no-install-recommends as default in BBQ. ;)

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 12:27 pm
by rhowaldt
well at least this is a good example of the amount of additional stuff dumped on your system as soon as you step away from the commandline, even for something as simple as file management. to each his own, indeed, and you use what makes you most comfortable.

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 2:05 pm
by pidsley
wux is right. xfce4-panel is a recommended package for thunar in both ubuntu and debian.

http://packages.ubuntu.com/wily/thunar
https://packages.debian.org/jessie/thunar

One more reason to disable recommends.

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 4:05 pm
by machinebacon
"apt-cache depends thunar" shows the full list. BBQ is set up to not install recommends. This is the BBQ forums, so I was under the impression the OP will use LinuxBBQ ;)

Re: usb automount in thunar as unprivileged user

Posted: Mon Jan 11, 2016 11:39 pm
by Theo
My apologies, it was more that I stay away from such things because of the dependencies that other ditros seems to like ;)
Ofcourse it's each of his/her own (that's why I put a *personally* in the first message), but I tried to be helpfull to the OP.
Thunar isn't bad, but I thought it can be handy to call other lighter graphical filemanagers.
I don't expect that a Nautilus or Thunar user to go straight to the coreutils (there are exeptions), that was more or less the idea behind the post.

Re: usb automount in thunar as unprivileged user

Posted: Tue Jan 12, 2016 5:12 am
by machinebacon
no worries.

Re: usb automount in thunar as unprivileged user

Posted: Wed Jan 13, 2016 7:39 pm
by eat64sgs
Hello all,

thank you for your posts.

I think, my problem is not Thunar. I get the same message when I try to mount a usb stick with gvfs-mount or gigolo.

I can't also shutdown my system without password or with the login manager lightdm. I have always no permissions. So I can only shutdown with sudo.

Perhaps I need a special Policykit rule?

Have anybody ideas?

eat64sgs

Re: usb automount in thunar as unprivileged user

Posted: Wed Jan 13, 2016 7:43 pm
by machinebacon
Is policykit-1-gnome is installed?

Also see https://gist.github.com/wooptoo/4013294 ... 92d6a2bddb

Re: usb automount in thunar as unprivileged user

Posted: Thu Jan 14, 2016 5:46 am
by eat64sgs
Yes, it is.

On another Unstable system om my desltop PC there is no polkit rule, no udev rule and usbmount is not installed. And mounting works and shutdown from login manager (lightdm) too.

I also edited /etc/sudoers, /etc/shutdown.allow and created a rule in /etc/sudoers.d. But nothing helped to solve the problem.

eat64sgs

Re: usb automount in thunar as unprivileged user

Posted: Thu Jan 14, 2016 6:35 am
by machinebacon
Okay, so this is the (working) result - on top of a noX base install I first

Code: Select all

sudo apt-get install dbus dbus-x11 xorg xinit xauth x11-xserver-utils xfwm4 xfce4-panel xfce4-session consolekit stterm # just wanted a quick unbloated terminal emulator
and added this line at the bottom of ~/.xinitrc:

Code: Select all

exec dbus-launch startxfce4 --with-ck-launch
With startx I got to an ugly desktop, XFCE4 asked me if I want a panel, I picked the default one and opened a terminal:

Code: Select all

sudo apt-get install thunar thunar-volman libpam-ck-connector policykit-1 libpam-mount udisks2 upower gvfs gvfs-bin gvfs-backends policykit-1-gnome
opened Thunar, clicked Edit -> Preferences -> Advanced -> Enable Volume Management -> Clicked the blue
"Configure" (this opens thunar-volmand) and ticked the boxes for automatic mount etc.

then I rebooted, logged in, used startx again, and got to the desktop. Plugged in the USB drive and this happened:
2016-01-14-132354_1280x800_scrot.png
I did not install xfdesktop4 and icons because I just wanted to make this shit work quickly. Adding it will make no difference in function. Power management (shutdown, reboot, hibernate, suspend) all work perfectly from the menu. No problems on the way. Good luck.

Nota bene:

xfce4-session needs x11-xserver-utils that pulls in gcc5
ck-launch-session is coming from consolekit
libpam-ck-connector needs libpam-runtime
policykit-1 needs dbus and also pulls in systemd via libpam-systemd
gvfs-* pulls in libgtk-3-0, just like policykit-1-gnome

There is no need for a lightdm, but it would work if you add one on top, for whatever reason.

A personal note:

Quite a lot of rubbish for something that can be scripted in bash and executed automatically. But that's just my opinion. And the reason we made LinuxBBQ.
I would also appreciate if you - as sign of respect and friendliness towards other users on this forums - post an introduction here: http://www.linuxbbq.org/bbs/viewforum.php?f=7