[SOLVED] usb automount in thunar as unprivileged user

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
eat64sgs
Saltimbocca-Roller
Posts: 15
Joined: Sat Jan 02, 2016 1:37 pm

[SOLVED] usb automount in thunar as unprivileged user

Unread post by eat64sgs » Sat Jan 09, 2016 5:16 pm

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
Last edited by eat64sgs on Thu Jan 14, 2016 7:01 pm, edited 2 times in total.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Sat Jan 09, 2016 5:46 pm

You need 1) consolekit installed
and 2) a magic line in your xinitrc:

exec dbus-launch startxfce4 --with-ck-launch
..gnutella..

eat64sgs
Saltimbocca-Roller
Posts: 15
Joined: Sat Jan 02, 2016 1:37 pm

Re: usb automount in thunar as unprivileged user

Unread post by eat64sgs » Sat Jan 09, 2016 7:18 pm

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

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Sat Jan 09, 2016 7:51 pm

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
..gnutella..

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: usb automount in thunar as unprivileged user

Unread post by simgin » Sat Jan 09, 2016 10:07 pm

Sorry
/offtopic
Seriously Julius how can you all this o.O
Mightily impressed!

/offtopic

cheerio
simon
Someone told me that I am delusional, I almost fell off my unicorn.

eat64sgs
Saltimbocca-Roller
Posts: 15
Joined: Sat Jan 02, 2016 1:37 pm

Re: usb automount in thunar as unprivileged user

Unread post by eat64sgs » Sun Jan 10, 2016 8:37 am

Oh yeah,

a lot of work.

I will see how I solve it and rewrite.

eat64sgs

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Sun Jan 10, 2016 10:52 am

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.
..gnutella..

User avatar
Theo
CLIt Licker
Posts: 394
Joined: Wed Nov 11, 2015 10:19 pm
Location: Nieuw-Buinen, Netherlands

Re: usb automount in thunar as unprivileged user

Unread post by Theo » Sun Jan 10, 2016 10:43 pm

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).

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Mon Jan 11, 2016 4:22 am

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.
..gnutella..

User avatar
Theo
CLIt Licker
Posts: 394
Joined: Wed Nov 11, 2015 10:19 pm
Location: Nieuw-Buinen, Netherlands

Re: usb automount in thunar as unprivileged user

Unread post by Theo » Mon Jan 11, 2016 7:29 am

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 ;)

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by wuxmedia » Mon Jan 11, 2016 8:19 am

^ likely something to do with the apt prefs. --no-install-recommends as default in BBQ. ;)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by rhowaldt » Mon Jan 11, 2016 12:27 pm

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.
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: usb automount in thunar as unprivileged user

Unread post by pidsley » Mon Jan 11, 2016 2:05 pm

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.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Mon Jan 11, 2016 4:05 pm

"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 ;)
..gnutella..

User avatar
Theo
CLIt Licker
Posts: 394
Joined: Wed Nov 11, 2015 10:19 pm
Location: Nieuw-Buinen, Netherlands

Re: usb automount in thunar as unprivileged user

Unread post by Theo » Mon Jan 11, 2016 11:39 pm

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.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Tue Jan 12, 2016 5:12 am

no worries.
..gnutella..

eat64sgs
Saltimbocca-Roller
Posts: 15
Joined: Sat Jan 02, 2016 1:37 pm

Re: usb automount in thunar as unprivileged user

Unread post by eat64sgs » Wed Jan 13, 2016 7:39 pm

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

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Wed Jan 13, 2016 7:43 pm

Is policykit-1-gnome is installed?

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

eat64sgs
Saltimbocca-Roller
Posts: 15
Joined: Sat Jan 02, 2016 1:37 pm

Re: usb automount in thunar as unprivileged user

Unread post by eat64sgs » Thu Jan 14, 2016 5:46 am

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

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: usb automount in thunar as unprivileged user

Unread post by machinebacon » Thu Jan 14, 2016 6:35 am

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
..gnutella..

Post Reply