You are not logged in.

#1 2012-07-10 22:29:57

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Automount and Mount permission issue

Hellow,

Problem: Can't mount optical disks, usb thumb drives, internal drives and usb hdd drives at all as a normal user in a file manager (Ex. using nautilus you double click on a drive in computer:/// and it mounts and opens <--- doesn't work)
Problem2: No automount is happening except the one in fstab if "noauto,comment=systemd.automount" is NOT in it (With "noauto,comment=systemd.automount" it's only happening if I reinstall udev)
Problem3: If I double click on a harddrive or usb thumb drive I get in nautilus: "Unable to mount location" Not authorized to perform operation
Problem4: CD/DVD Drives and card readers are not automounted when changing disk/card

This is a freshly installed archlinux

What I use atm:
- linux-lts-ck <- 3.0.33-1
- systemd (systemd-sysvcompat, system-tools, systemd, libsystemd) <- 185-4
- udisks2 (Since gvfs wants it) <- 1.94.0-2
- nautilus-elementary <- 171-4
- udev <- 185-4
- polkit <- 0.105-1 with systemd support
- polkit-gnome <- 0.105-1
- dbus-core <- 1.6.2-2
- dbus <- 1.6.2-1
- dbus-glib <- 0.100-1
- desktop-privileges from AUR <- 0.3.2
- Fluxbox (Will be replaced) <- 1.3.2-1 (Now some other WM)

What I tried to get it to work:
- Starting the session with and without consolekit (ck-launch-session) (deprecated since I compiled since I use system user sessions (polkit with --enable-systemd); I think)
- Installing desktop-privileges
- Trying all udisks2 in AUR (udisks2-mount, udisks2-systemd, udisks2-git)
- Rebooting like crazy :-P
- Trying some polkit rules
- Trying different WM (fluxbox, openbox and xorg-twm)
- Modifying udisks2-internal.pkla
- autofs
- Trying udisks2 wrapper (udisksvm, some ther ones; Don't remember atm)
- ldm(-git) (this one does NOTHING at all)
- Trying other file managers (thunar and spacefm)
- Some other stuff I don't remember atm (will be added)


The custom .pkla file:

[Override udisks2 filesystem-mount-system rule]
Identity=unix-user:arch
Action=org.freedesktop.udisks2.filesystem-mount-system
ResultAny=auth_admin
ResultInactive=auth_admin
ResultActive=yes

/etc/conf.d/ldm

USER_GID=4
USER_UID=1000

relevant parts of my .xinitrc (all others a commented out)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    # Do not launch dbus before ConsoleKit (FS#25031)
    #[ -x "$f" ] && . "$f"
    [ "$f" -ne "/etc/X11/xinit/xinitrc.d/30-dbus" ] && [ -x "$f" ] && . "$f"
  done
  unset f
fi

export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

eval $(dbus-launch --sh-syntax --exit-with-session)

/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

exec startfluxbox

"exec ck-launch-session startfluxbox" makes no difference with installed consolekit.

My groups:

adm disk lp wheel log dbus video audio optical floppy storage scanner power users

What can I do to make automount and user mount in my file manager work??
I'm at wits end atm, please help me...
What other info is needed?

P.S: I'm no good with words so please forgive me if it sounds crude sad

Last edited by Angeldeath (2012-07-12 07:39:01)

Offline

#2 2012-07-11 10:13:48

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: Automount and Mount permission issue

The custom .pkla file:

[Override udisks2 filesystem-mount-system rule]
Identity=unix-user:arch
Action=org.freedesktop.udisks2.filesystem-mount-system
ResultAny=auth_admin
ResultInactive=auth_admin
ResultActive=yes

I don't know if this is the answer to your problem, but this .pkla concerns only a user named 'arch' and mount-system actions, ie non external devices.
Be sure it is the right user name, and you could try:

[Override udisks2 filesystem-mount-system rule]
Identity=unix-user:the right user name
Action=org.freedesktop.udisks2.*
ResultAny=no
ResultInactive=no
ResultActive=yes

And where is this .pkla file placed? what is its full name?
Also have you undone/reversed all the changes tried, when you saw them not working as expected? Otherwise it will be a mess with your configuration.

Are you sure you need that in .xinitrc :

/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

You could try to not use a login manager at all, and use startx instead after logging in, with this in .xinitrc:

#eval $(dbus-launch --sh-syntax --exit-with-session)
exec ck-launch-session dbus-launch --exit-with-session startfluxbox

the 'eval' is commented out.

Last edited by berbae (2012-07-11 10:25:22)

Offline

#3 2012-07-11 10:25:32

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Re: Automount and Mount permission issue

My username is "arch" so it is the right one.

The file is located in /etc/polkit-1/localauthority/50-local.d/ and is named: 50-filesystem-mount-system-internal.pkla
I made some changes to it since i don't want too many permissions floating around:

[Override udisks2 filesystem-mount-system rule]
Identity=unix-user:arch
Action=org.freedesktop.udisks2.filesystem-*;org.freedesktop.udisks2.eject-*
ResultAny=auth_admin
ResultInactive=auth_admin
ResultActive=yes

With this ruleset it finally asks for my password, but automount is still a no-go (I'm still testing if this ruleset works 100%) (Had one issue once till now: After inserting a USB stick those rules change back)

About "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &":
Well... I don't know for sure, will test it...

And yes I removed the changes and rebooted after every change.
I also tried different combinations and rebooted after most changes.

Offline

#4 2012-07-11 15:05:10

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: Automount and Mount permission issue

Welcome to the pleasures of freedesktop madness where every time mounting as a user works, it stops working after a month or so.

But can you try thunar, pcmanfm or spacefm to see if those work?

Offline

#5 2012-07-11 15:21:14

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Automount and Mount permission issue

Since you are using systemd, consolekit will not set ACL's on your devices, but leave this in the hands of systemd-logind.

This requires a proper pam session to be created for your graphical login (having a pam session for tty1 and then starting X using xinit on tty7 will not work, as logind will monitor tty1 and observe that it becomes inactive (as you moved to tty7) and hence rip away all the permissions).

To verify that this is indeed your problem, you can use "loginctl" from both your console and your graphical login. They should have one session each, which should be marked as active/inactive depending on which tty you are on.

The simplest way to make this "just work" is to use a desktop manager. I would try with GDM first as that is known to work well. Once you verify that this works, you could try different ones.

Offline

#6 2012-07-11 20:26:25

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Re: Automount and Mount permission issue

Thunar, spacefm and other say the same as nautilus: no permission...

"loginctl list-sessions" lists me with 1 sessions with seat0 when i login with my .xinitrc and startx from tty.
And well with systemd I don't move to tty7 I move up to the next tty (Ex. I login at tty1 and type "startx" and am now at tty2 with my X screen).

As I don't want to use a desktop manager it's no option for me. And installing gdm installs way to many unecessary packages so no option there, since space is a bit limited (^^")
How can I try loginctl? What do I need to have listed in the end for sessions? (Ok, I hope it's understandable my english writing is a little rusty :-P )

Last edited by Angeldeath (2012-07-11 20:47:42)

Offline

#7 2012-07-11 21:09:58

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Automount and Mount permission issue

The first column of "loginctl list-session" is your sesison ID, I'll assume it is "1". To get more info about it you can do "loginctl show-session 1". For you to get access to various hardware devices, you need it to say "Active=yes".

I guess what happens is that if you do "loginctl show-session 1 | grep Active" from tty1 (the console) you get "yes", but from tty2 (the graphical one) you get "no". The reason is that no new session was opened as you called xinit directly.

In the future what you'll want is to use the systemd user session bus and this should work nicely. However, that is not ready yet, and I don't know how to get graphical sessions working without some form of desktop manager (I have lost track of which ones are supported, but I think they all should be).

Offline

#8 2012-07-11 21:31:07

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Re: Automount and Mount permission issue

So basically I have to use a desktop manager for user sessions to work with X? Great...
Will that also fix my automounting issue?
And yes it says "Active=no" when I'm in X.

Btw.: also tried this: https://wiki.archlinux.org/index.php/Sy … r_sessions
And added the necessary parts to "login" <- Is that what's meant to get it to work without an desktop manager?

I will try to get a very slick desktop manager installed, in hope it fixes at least one issue...

Offline

#9 2012-07-11 21:34:09

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Automount and Mount permission issue

At least I don't know how to do it without a DM (but I never had any reason to try, so maybe there is a way). If this will fix all your issues I don't know, but I'd say it's a good bet.

By adding the pam_systemd stuff to login that's why you have the one session you do have. You need xinit to also hook into pam to create a second session (as I said I don't know how to do this without a DE).

Offline

#10 2012-07-11 21:53:48

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Re: Automount and Mount permission issue

Well I tried slim and permissions seem now to work, I got and active session. (Although I really hate this "solution", but at least it's one)
That leaves the automount issue which also needs to be fixed...

Offline

#11 2012-07-11 23:00:43

mich04
Member
From: Illinois - United States
Registered: 2011-10-25
Posts: 390

Re: Automount and Mount permission issue

I just set up my fluxbox today after a hard drive failure here is what I did, my install was able to mount and unmount within seconds. I just use the autologin and you do not even notice.

PCMANFM

 sudo nano ~/.xinitrc 
exec startfluxbox 

slim

/etc/inittab
#id:3:initdefault:
id:5:initdefault:
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
/etc/slim.conf
login_cmd           exec dbus-launch /bin/bash -login ~/.xinitrc %session

Note: slim is ConsoleKit capable since version 1.3.3. Unless you happen to run an old version, you must no longer include ck-launch-session in your .xinitrc or slim.conf login_cmd. You should still have dbus-launch in your login_cmd, see #SLiM_and_Gnome_Keyring, since this gives subprocesses of your session the correct permissions (e.g. to mount something with gvfs-mount, like Pcmanfm does).


I love computers, networking and Arch Linux. Sometimes I might ask a stupid question, but please have grace with me like I would with you.

Offline

#12 2012-07-12 07:35:54

Angeldeath
Member
Registered: 2012-07-10
Posts: 6

Re: Automount and Mount permission issue

@mich04
You use Sys V, I use a native systemd setup.
ck-launch-session is not necessary in a native systemd setup if you compile polkit with systemd support which is described here:
https://wiki.archlinux.org/index.php/Sy … r_sessions
And autologin is absolutely no solution. (^^)

And the permission issue is solved, (although I don't like the solution, since I don't want to use a desktop manager, and it uses extra space) just the automount on insert and changing discs is still present.

But thanks to all who tried to help me till now!
Now I just need someone who and help me get automount to work and the best would be an udev rule. (I don't have any knowledge in writing those...)

Last edited by Angeldeath (2012-07-12 07:56:35)

Offline

#13 2012-07-15 10:50:12

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

Re: Automount and Mount permission issue

If I may add, polkit configuration changes are applied immediately, no service restart needed.

Offline

#14 2012-08-03 08:13:51

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: Automount and Mount permission issue

I'm having the same problem as @Angeldeath. Would this help in this situation? It sounds like running

systemctl enable user-session@joe.service

with this unit set installed would remove the requirement for a DM. Thoughts?


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#15 2012-08-03 11:11:27

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Automount and Mount permission issue

dcc24 wrote:

I'm having the same problem as @Angeldeath. Would this help in this situation? It sounds like running

systemctl enable user-session@joe.service

with this unit set installed would remove the requirement for a DM. Thoughts?

Eventually it should, yes. However, this stuff is still under active (early) development, and will likely not work out-of-the-box. As far as I know some patches are needed to dbus, and maybe other things.

Offline

#16 2012-08-03 11:18:08

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: Automount and Mount permission issue

NVM: See next post.

Last edited by dcc24 (2012-08-03 15:26:48)


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#17 2012-08-03 12:34:27

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: Automount and Mount permission issue

@tomegun: I've created a dbus-core package with the dbus activation patch. Should systemd-user-session-units depend on this?

In any case, I'll test this configuration later today and see if I can make it work without a DM.


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#18 2012-08-03 15:25:06

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: Automount and Mount permission issue

Edit: It works! Turns out there was an FS problem with the USB drive I was testing with. Using the packages below, everything works just fine. No need for slim or any other DM smile

Here's the user session unit running:
8LEP4.png
----------------------------------
Original post:
It works! Sort of...

Using dbus-core-systemd-users-sessions and systemd-user-session-units from AUR I get the following:

$ loginctl show-session 1 | grep Active
Active=yes

Automount works (though it worked prior to this as well) but permissions are still not correct. Assuming my username is "foo", it gets automounted with:

dr-x------ foo users

So I still can't write to the device. Now what?

Last edited by dcc24 (2012-08-04 07:26:55)


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#19 2012-08-04 21:31:09

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Automount and Mount permission issue

dcc24 wrote:

Edit: It works! Turns out there was an FS problem with the USB drive I was testing with. Using the packages below, everything works just fine. No need for slim or any other DM smile

Here's the user session unit running:
http://i.imgur.com/8LEP4.png
----------------------------------
Original post:
It works! Sort of...

Using dbus-core-systemd-users-sessions and systemd-user-session-units from AUR I get the following:

$ loginctl show-session 1 | grep Active
Active=yes

Automount works (though it worked prior to this as well) but permissions are still not correct. Assuming my username is "foo", it gets automounted with:

dr-x------ foo users

So I still can't write to the device. Now what?

I had another look at this. It seems to me that the remaining issue is that when using the user session, we don't get a consolekit session, only a logind one. That would be fine if all our stuff (polkit, networkamnager, ...) was compiled with logind support rather than consolekit. However, it is not...

Offline

#20 2012-08-05 06:38:24

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: Automount and Mount permission issue

tomegun wrote:

we don't get a consolekit session, only a logind one. That would be fine if all our stuff (polkit, networkamnager, ...) was compiled with logind support rather than consolekit. However, it is not...

In .xinitrc I have

ck-launch-session startxfce4

Doesn't this launch the consolekit session as well?


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#21 2012-11-01 06:10:16

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: Automount and Mount permission issue

I was having the same problem too. Here is a little workaround which may help you
if you start X with the "startx" command alias it like :

alias startx='xinit -- /usr/bin/X -nolisten tcp vt1 &> ~/.xlog'

this will start X on 1st tty.

and if you want to start X automatically . Here is my .bash_profile

if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then
  while true; do
    read -p 'Do you want to start X? (y/n): '
    case $REPLY in
      [Yy]) exec xinit -- /usr/bin/X -nolisten tcp vt1 &> ~/.xlog ;;
      [Nn]) break ;;
      *) printf '%s\n' 'Please answer y or n.' ;;
    esac
  done
fi

Just for a note : I have 'ck-launch-session' in my xinitrc.


EDIT: Sorry I did not see that this thread is little bit old. But since the issue was not solved , I thought that this workaround would prove helpful to someone.

Last edited by illusionist (2012-11-01 06:22:48)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

Board footer

Powered by FluxBB