You are not logged in.

#1 2011-11-05 07:44:51

aviynw
Member
Registered: 2009-04-01
Posts: 26

Can't mount or read cd drive as normal user.

Hi, my problem is that only root can mount my cd drive.  And if root mounts it, only root can read it
I found a few recent topics on these forums related to my issue, but none of the solutions worked for me.  My user is a member of optical, disk, and storage (security isn't important to me), I tried setting up udiskie (https://wiki.archlinux.org/index.php/Udiskie).  I tried adding udev rules to /etc/udev/rules.d/82-cdrom.rules as described here (https://bbs.archlinux.org/viewtopic.php?id=129044) and I tried adding policy kit rules as described here https://bbs.archlinux.org/viewtopic.php?id=122761.

Some useful outputs

[avi2@Avi-ArchLinux-Desktop ~]$ ls -l /dev/sr0
brw-rw---- 1 root optical 11, 0 Nov  4 23:18 /dev/sr0
[avi2@Avi-ArchLinux-Desktop ~]$ ls -l /dev/sr1
brw-rw---- 1 root optical 11, 1 Nov  4 23:19 /dev/sr1
[avi2@Avi-ArchLinux-Desktop ~]$ cat /etc/udev/rules.d/82-cdrom.rules 
SUBSYSTEMS=="scsi", KERNEL=="sr0", GROUP="optical", SYMLINK+="cdrom dvd"
 [Storage Permissions]
 Identity=unix-group:storage
 Action=org.freedesktop.udisks.*;org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.inhibit-polling;org.freedesktop.udisks.drive-set-spindown
 ResultAny=yes
 ResultActive=yes
 ResultInactive=no
***my xinitrc***
exec ck-launch-session bash -c "udiskie & startkde" 
***I also tried killing the udiskie process post-boot, made no difference***

Also, in regards to a similar problem a developer said "1) your cdrom drive should be in the "optical" group, if it is not this is a bug (in kernel or udev). Please open a report and I'll look into it." (https://bbs.archlinux.org/viewtopic.php?id=129044)

I don't even have a cdrom drive user on my system so I don't know how I would go about adding it to the optical group.  I'm not sure if I'm misunderstanding something or if I am in fact witnessing this bug

Don't know much about how udev works.  In my attempts to fix it I've mostly just been copying and pasting, so don't know what else to try.

I appreciate any help, thanks

Also, its worth mentioning, I haven't needed to access my cd-drive in a while so don't know when I started having this problem.  I know it worked at some point.  I tried downgrading udev 174-1 to 173-3 and it made no difference

Last edited by aviynw (2011-11-05 07:46:36)

Offline

#2 2011-11-05 08:18:22

rayjgu3
Member
From: Chicago IL usa
Registered: 2004-07-04
Posts: 695

Re: Can't mount or read cd drive as normal user.

how to ad user to optical group
https://wiki.archlinux.org/index.php/CD … ermissions

or it could be this
https://bbs.archlinux.org/viewtopic.php?id=129688

Last edited by rayjgu3 (2011-11-05 08:20:35)

Offline

#3 2011-11-05 08:52:11

aviynw
Member
Registered: 2009-04-01
Posts: 26

Re: Can't mount or read cd drive as normal user.

"My user is a member of optical, disk, and storage"

Offline

#4 2011-11-05 08:55:57

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Can't mount or read cd drive as normal user.

Well you can try pmount. It works nicely for unpriviledged users.

Offline

#5 2011-11-05 22:37:37

aviynw
Member
Registered: 2009-04-01
Posts: 26

Re: Can't mount or read cd drive as normal user.

Thanks, but I'd like to know why the methods I've tried haven't worked, rather than try another one.

Offline

#6 2011-11-06 23:43:41

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

Re: Can't mount or read cd drive as normal user.

aviynw wrote:

Also, in regards to a similar problem a developer said "1) your cdrom drive should be in the "optical" group, if it is not this is a bug (in kernel or udev). Please open a report and I'll look into it." (https://bbs.archlinux.org/viewtopic.php?id=129044)

I don't even have a cdrom drive user on my system so I don't know how I would go about adding it to the optical group.  I'm not sure if I'm misunderstanding something or if I am in fact witnessing this bug

That was me. I was unclear. I meant "the cdrom drive should be owned by the 'optical' group". It looks like it is for you.

I'm not sure what your bug is, but I'll add my two cents:

The simplest way to make stuff like this work is to set up consolekit correctly. If you use GDM or KDM this will be done for you, otherwise it might need some manual setup (I always suggest trying with GDM first to see that it works before fiddling with manual setup of startx).

You should not need any udev rules, no polkit rules, and you should not need to be a member of any groups (though any of those solutions should also work).

Are you able to mount the drive from your DE (which I assume will be using udisks, which I assume will "do the right thing")?

Offline

#7 2011-11-07 00:30:13

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Can't mount or read cd drive as normal user.

Upstream bug: http://www.spinics.net/lists/hotplug/msg05188.html

I expect that Tom will be backporting this but note that the group is 'cdrom' and not 'optical'.

Last edited by falconindy (2011-11-07 00:31:35)

Offline

#8 2011-11-07 05:01:27

aviynw
Member
Registered: 2009-04-01
Posts: 26

Re: Can't mount or read cd drive as normal user.

tomegun wrote:
aviynw wrote:

Also, in regards to a similar problem a developer said "1) your cdrom drive should be in the "optical" group, if it is not this is a bug (in kernel or udev). Please open a report and I'll look into it." (https://bbs.archlinux.org/viewtopic.php?id=129044)

I don't even have a cdrom drive user on my system so I don't know how I would go about adding it to the optical group.  I'm not sure if I'm misunderstanding something or if I am in fact witnessing this bug

That was me. I was unclear. I meant "the cdrom drive should be owned by the 'optical' group". It looks like it is for you.

I'm not sure what your bug is, but I'll add my two cents:

The simplest way to make stuff like this work is to set up consolekit correctly. If you use GDM or KDM this will be done for you, otherwise it might need some manual setup (I always suggest trying with GDM first to see that it works before fiddling with manual setup of startx).

You should not need any udev rules, no polkit rules, and you should not need to be a member of any groups (though any of those solutions should also work).

Are you able to mount the drive from your DE (which I assume will be using udisks, which I assume will "do the right thing")?

So, I actually was trying to mount in my DE the whole time.  I use kdm and kde and was assuming that when I was mounting through dolphin (kde's file manager) that it was using the consolekit/policykit rules I was setting up, but now I see I may have been wrong.  I recently modified my kdm config file at /usr/share/config/kdm/kdmrc for other reasons and may have removed some needed sections, might this be the cause of my problems?  If so do you know what that file should contain?

I'd also like to understand how this all works.  I don't quite understand what the relationship is between policykit, consolekit, udev rules, and how kdm and gdm setup permissions.

thanks.

Offline

#9 2011-11-07 07:10:05

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

Re: Can't mount or read cd drive as normal user.

aviynw wrote:

So, I actually was trying to mount in my DE the whole time.  I use kdm and kde and was assuming that when I was mounting through dolphin (kde's file manager) that it was using the consolekit/policykit rules I was setting up, but now I see I may have been wrong.  I recently modified my kdm config file at /usr/share/config/kdm/kdmrc for other reasons and may have removed some needed sections, might this be the cause of my problems?  If so do you know what that file should contain?

Ah, I missed that you are using KDE. That should make your life considerably easier than what I feared. I don't think you could have made any mistakes related to this in kdmrc. However, if you want to make sure you could just reinstall the package and it should give you the original kdmrc as kdmrc.pacnew (I think).

Two suggestions:
1) Remove udiskie, auto-mounting can be done by solid (part of KDE), and I don't know whether or not udiskie might be messing things up.
2) Use KDM. This should set up a few things properly (i.e. consolekit). Once you have everything working you could try going back to startkde.

aviynw wrote:

I'd also like to understand how this all works.  I don't quite understand what the relationship is between policykit, consolekit, udev rules, and how kdm and gdm setup permissions.

Firstly: forget all about groups. Modern programs use ACL's (through the programs you mentioned above) to give you permissions to perform the actions you want. You should be able to remove yourself from all groups (except "users' I guess). Also, this should work out of the box (if you use KDM), so any manual setup that you have done to make this work should not be needed.

udev: Tags the devices that should be controlled by consolekit.
ConsoleKit: keeps track of who is the current active user of the machine, and gives this user permissions to access all the devices tagged by udev (through the use of ACL).
PolicyKit: gives users permissions to perform certain operations (dbus calls), for instance based on whether or not the user is "local" and "active", as it can find out from ConsoleKit.
udisks: creates a mountpoint in /media and mounts the device. It uses helpers run as root, so does not care if your current user has permissions to access the device being mounted. However, the user needs to be allowed to perform the mount action by PolicyKit (which will be given if you are the local, active user according to ConsoleKit (you are)).

I would ask two things:

1) Can you paste the exact error message given by Dolphin?
2) My guess is that the problem is with /media could you paste the output of "ls -lah /media" right after boot before you try to mount anything, and also after you try to mount the cdrom.

Offline

#10 2011-11-08 06:12:14

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

Re: Can't mount or read cd drive as normal user.

falconindy wrote:

Upstream bug: http://www.spinics.net/lists/hotplug/msg05188.html

I expect that Tom will be backporting this but note that the group is 'cdrom' and not 'optical'.

I was hesitating whether or not to backport. Luckily Kay made my life easier by making a new release. So for anyone experiencing this problem: get the newest udev from [testing], it should not contain any other surprises (just bugfixes this time around).

Offline

Board footer

Powered by FluxBB