View previous topic :: View next topic |
Author |
Message |
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Mon Nov 02, 2009 6:48 pm Post subject: udev is ignoring rules, sets firewire /dev/cd* to root:root |
|
|
So, I really like the whole idea of creating device links on the fly (hotswapping is like so *now* or whatever), but udev won't create my firewire cdrw links with the right permissions. Here's what I have:
I have a firewire cdrw/dvdrw that is attached to /dev/sr0. When the device is on, the files /dev/cdrom, /dev/cdrw, /dev/dvd, and /dev/dvdrw are created by udev, linking to it. Trouble is, none of them have permissions that I can use as a normal user. Thus:
Code: | # ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 Nov 2 19:31 /dev/cdrom -> sr0
lrwxrwxrwx 1 root root 3 Nov 2 19:31 /dev/cdrw -> sr0
# ls -l /dev/dv*
lrwxrwxrwx 1 root root 3 Nov 2 19:31 /dev/dvd -> sr0
lrwxrwxrwx 1 root root 3 Nov 2 19:31 /dev/dvdrw -> sr0 |
I have the file /etv/udev/rules-d/10-local.rules, which reads:
Code: | SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="dvd", GROUP=="video"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:06.0-ide-0:0", SYMLINK+="cdrom", GROUP="cdrom", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:06.0-ide-0:0", SYMLINK+="cdrw", GROUP="cdrw", ENV{GENERATED}="1"
BUS=="usb",KERNEL=="sdc",NAME+="sdc1",SYMLINK+="usb",GROUP=="usb" |
but this doesn't seem to work for the cdrom.
What am I doing wrong here? This is really frustrating: it should Just Work, yes? Not just that the permissions should be set, but that I shouldn't have to create a whole config file of custom settings just to use usb or firewire devices. Anyway, can somebody assist me in getting this set properly? And will I need to restart udev to do that?
Thanks,
EE |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Mon Nov 09, 2009 4:02 pm Post subject: |
|
|
you don't seem to understand the difference between == and = , read up on syntax between tests and assignment systax.
This is linked from the Gentoo doc but is a bit out of date. Hwvr, it should explain those mistakes.
http://www.reactivated.net/writing_udev_rules.html#syntax
As a result I'm having as much difficulty as udev in understanding what you are trying to do. Also you post of the code block seems to have line breaks . Unless you just did that to make it a more readable post you should also note that udev does not allow line breaks in a rule.
What udev can't read , udev ignores. That probably explains what you're seeing.
_________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Mon Nov 09, 2009 5:11 pm Post subject: |
|
|
Sorry if some of the code is unclear. The two lines in the middle I added from the default udev rules for cdrom, which is in one of the rules files. But let me clarify exactly what my situation is:
I have a firewire dvd/dvdrw/cdrw drive that is usually turned off. I want to turn it on, and be able to write to the cdrom device (for burning cds), the same for dvds, and also play stuff back. To do that, I need udev to create the device nodes with the proper group ownership.
The usb line is to automatically create the usb mountpoint, so that I can mount any usb block device (camera, stick, etc) when needed.
I believe I said that in my first post: I want udev to create the symlinks with the correct permissions, so that I don't need to be root to burn a cd. Can you tell me what I need to do with this rule to fix that problem?
Thanks for the help,
EE |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Mon Nov 09, 2009 5:19 pm Post subject: |
|
|
I see six lines in your post. So make sure that there are only FOUR lines in your rules. The two you have added are WRONG , read my last post.
If you say "Sorry if some of the code is unclear " to udev he want give a damn. Use the correct syntax.
_________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Mon Nov 09, 2009 5:50 pm Post subject: |
|
|
okay, I've changed the /etc/udev/rules.d/10-local.rules file, so that it contains the following:
Code: | SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="dvd", GROUP="video"
SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="dvdrw", GROUP="dvdrw"
SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="cdrom", GROUP="cdrom"
SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="cdrw", GROUP="cdrw"
BUS=="usb",KERNEL=="sdc",NAME+="sdc1",SYMLINK+="usb",GROUP="usb" |
But, when I turn on the drive, I still see the following permissions on the device:
Code: | $ ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 2009-11-09 18:40 /dev/cdrom -> sr0
lrwxrwxrwx 1 root root 3 2009-11-09 18:40 /dev/cdrw -> sr0 |
And the same for the dvd symlinks. Now, if I understand the syntax correctly, this code is telling udev to match a block device identified as sr0, and add the four symlinks with the concomitant group ownership. But this is not what it's doing.
I'm not sure where you saw six lines of code. The first code block in my first post was my listing the ownership of the cd/dvd devices from a terminal. The second code block - containing four lines with no breaks except between rules - had only the two middle lines copied from a generated rules file. The other two I wrote myself.
Now, can each rules file contain only one rule? The large code block above contains five separate rules; I've not seen it stated anywhere that one cannot do that. Perhaps that is some of the problem?
EDIT: I read the following from that guide you posted:
Quote: | Files in /etc/udev/rules.d/ are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file.
In a rules file, lines starting with "#" are treated as comments. Every other non-blank line is a rule. Rules cannot span multiple lines. |
So I can, in fact, have multiple rules in one file.
Anyway, thanks for the help,
EE |
|
Back to top |
|
|
Monkeh Veteran
Joined: 06 Aug 2005 Posts: 1656 Location: England
|
Posted: Mon Nov 09, 2009 6:31 pm Post subject: |
|
|
Symlinks don't have permissions, they simply point to a file. The permissions on that file are used. |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Mon Nov 09, 2009 7:10 pm Post subject: |
|
|
Okay, well that's a more fundamental problem: /dev/sr0 doesn't exist until I turn on the firewire drive. How do I insure that the device itself has the correct permissions?
Thanks,
EE |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Mon Nov 09, 2009 7:41 pm Post subject: |
|
|
Quote: | Unless you just did that to make it a more readable post you should also note that udev does not allow line breaks in a rule. |
Note I just said you can't have line breaks within a RULE. I did not say you could not have more than one line in a file.
I thought you had split the lines to stop the post getting too wide or that you had split the lines in your rules file. It seems like the forum software has been changed and is now wrapping code blocks! Rather defeats the object of putting something in a code block but I guess so many users post lines five screens wide that the mods decided to wrap everthing.
Fine. So now you're getting closer having sorted out the syntax of = and == and you have your simlinks.
I can't comment on the permissions but I suspect this is plugdev and hal rather than udev.
I have root:root perms on my optical devices and have to start hald if I want user k3b to find them. _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
Monkeh Veteran
Joined: 06 Aug 2005 Posts: 1656 Location: England
|
Posted: Mon Nov 09, 2009 8:12 pm Post subject: |
|
|
ExecutorElassus wrote: | Okay, well that's a more fundamental problem: /dev/sr0 doesn't exist until I turn on the firewire drive. How do I insure that the device itself has the correct permissions?
Thanks,
EE |
udev handles that. The group should be set to 'cdrom' automatically. |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Tue Nov 10, 2009 3:25 am Post subject: |
|
|
Yes, it should, but it, well, isn't. This is what I'm banging my head against
Any suggestions?
Thanks,
EE |
|
Back to top |
|
|
gentoo_ram Guru
Joined: 25 Oct 2007 Posts: 512 Location: San Diego, California USA
|
Posted: Tue Nov 10, 2009 7:35 am Post subject: |
|
|
All you've shown so far are the permissions on the symbolic links. The permissions on the links aren't relevant. The only permissions that are relevant are the permissions on /dev/sr0 itself. You seem to want different links owned by different users. You can't really do that. The permissions on /dev/sr0 itself determine access to the device and it can only have one group. The permission on the symbolic link isn't important.
I suppose you could make different device entries all pointing to the same device number and give each of those device entries different permissions. I'm not sure if udev supports that, though. But, again, you don't want them to be symbolic links. You want them to be actual device nodes pointing to block device 11,0. |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat Nov 14, 2009 8:03 am Post subject: |
|
|
udev has a RUN key that could probably be used to clone the device node and give the copy different permissions before udev renames it. Then udev could be set in the usual way to give the other group required.
_________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Sat Nov 14, 2009 3:40 pm Post subject: |
|
|
So, how do I create a HAL config file (or the udev one; I'm not sure what part of the device-creation chain isn't properly set up) that creates the correctly-configured device (/dev/sr0 is fine: I just care about getting the permissions so I can actually use it) whenever I turn on the drive? If I understand your comments corectly, there are two stages:
I turn on the device, and udev creates the initial device (/dev/sr0 in this case) with root:root ownership
hald creates the device links (/media/cdrom, /media/cdrw, etc.) that mirror the ownership of /dev/sr0
I don't *need* the different symlinks to have different permissions per se: I just need to be able to read CDs, burn them, etc. I've been searching for manuals to do this, but all I've found so far are some out-of-date SuSE HOWTOs.
Presently, the directory /etc/hal/fdi/policy/ is empty.
Thanks,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Sun Nov 22, 2009 8:35 pm Post subject: |
|
|
Can you explain a bit further? Sorry, I'm not used to writing hal rules (actually, I never have), so I don't know what the "usual way" is.
How, even, do I create different device nodes pointing to this device?
Thanks,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Tue Dec 22, 2009 10:51 pm Post subject: |
|
|
I am still having trouble setting up my cd burner so that it has the correct permissions (so that I can actually burn stuff with it). Can you point me to the right hald/udev rule I need to write to fix that?
Thanks. This has been bugging me for some time.
Cheers,
EE |
|
Back to top |
|
|
f4u5t n00b
Joined: 09 Jul 2008 Posts: 45
|
Posted: Wed Dec 23, 2009 12:01 am Post subject: |
|
|
Monkeh wrote: | Symlinks don't have permissions, they simply point to a file. The permissions on that file are used. |
Please post the permissions and ownership info of /dev/sr0. ls -l /dev/sr0 |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Wed Dec 23, 2009 12:22 am Post subject: |
|
|
Code: | # ls -l /dev/sr0
brw-rw---- 1 root cdrom 11, 0 Dec 22 23:35 /dev/sr0
|
But!
Code: | # ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 Dec 22 23:35 /dev/cdrom -> sr0
lrwxrwxrwx 1 root root 3 Dec 22 23:35 /dev/cdrw -> sr0
|
so, whoever said the symlinks just mirror the device permissions is wrong. With the above permissions, k3b cannot find the drive for writing. So, how do I go about fixing this?
Thanks,
EE |
|
Back to top |
|
|
f4u5t n00b
Joined: 09 Jul 2008 Posts: 45
|
Posted: Wed Dec 23, 2009 1:21 am Post subject: |
|
|
ExecutorElassus wrote: | Code: | # ls -l /dev/sr0
brw-rw---- 1 root cdrom 11, 0 Dec 22 23:35 /dev/sr0
|
But!
Code: | # ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 Dec 22 23:35 /dev/cdrom -> sr0
lrwxrwxrwx 1 root root 3 Dec 22 23:35 /dev/cdrw -> sr0
|
so, whoever said the symlinks just mirror the device permissions is wrong. With the above permissions, k3b cannot find the drive for writing. So, how do I go about fixing this?
Thanks,
EE |
No, they are correct. They said "symlinks don't have permissions." That is correct. Try to chmod a symlink. They said "the permissions on the links aren't relevant." That is correct. It is the permission of the device sr0 that are important.
Next question, are you in the group cdrom? Run id |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Wed Dec 23, 2009 5:50 am Post subject: |
|
|
Code: | $ id
uid=1000(elassus) gid=1000(elassus) groups=1000(elassus),10(wheel),18(audio),19(cdrom),27(video),35(games),80(cdrw),85(usb),100(users),1003(scanner),1015(cedega)
|
So, I'm in the cdrom group, as is the cdrom. But I can't actually write to the device. Far out.
Anyway, thanks for the help. This is quite the annoyance.
Cheers,
EE |
|
Back to top |
|
|
f4u5t n00b
Joined: 09 Jul 2008 Posts: 45
|
Posted: Wed Dec 23, 2009 5:02 pm Post subject: |
|
|
ExecutorElassus wrote: | Code: | $ id
uid=1000(elassus) gid=1000(elassus) groups=1000(elassus),10(wheel),18(audio),19(cdrom),27(video),35(games),80(cdrw),85(usb),100(users),1003(scanner),1015(cedega)
|
So, I'm in the cdrom group, as is the cdrom. But I can't actually write to the device. Far out.
|
I'm guessing that in addition to the SCSI raw device (sr0) it needs to write the the SCSI generic device (sg0). Can you run "ls -l /dev/sg*"?
Can you post the error message/log of the CD writing software? |
|
Back to top |
|
|
VoidMage Watchman
Joined: 14 Oct 2006 Posts: 6196
|
Posted: Wed Dec 23, 2009 7:40 pm Post subject: |
|
|
Depends on what you use: cdrkit uses sr* just fine. |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Sat Dec 26, 2009 4:51 pm Post subject: |
|
|
'ls -l /dev/sg*' shows that device as being owned by root:disk. I am a member of that group.
The program in question is k3b, and doesn't keep an error log that I know of (though I could be wrong). All it says is that it can't find a cd/dvd writer device, and asks me to make sure that I have write access to it. Here is the full text:
Quote: | No CD/DVD writer found.
K3b did not find an optical writing device in your system. Thus, you will not be able to burn CDs or DVDs. However, you can still use other K3b features such as audio track extraction, audio transcoding or ISO9660 image creation. |
All I want, really, is a feature-rich burning program. K2b has been pretty good about it, but really doesn't handle this drive very well. I'd be happy with a good replacement program, if you have one.
Thanks,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1467 Location: Berlin, Germany
|
Posted: Sat Dec 26, 2009 6:13 pm Post subject: |
|
|
hrm. So, I tried installing a different burner - xfburn - and got the following error when I ran it from console:
Code: | $ xfburn
** Message: No existing settings file, using default settings
** Message: Thunar-VFS not available, using default implementation
** Message: Using HAL
** (xfburn:9924): WARNING **: Could not get list of devices from HAL: Rejected send message, 1 matched rules; type="method_call", sender=":1.14" (uid=1000 pid=9924 comm="xfburn) interface="org.freedesktop.Hal.Manager" member="GetAllDevices" error name="(unset)" requested_reply=0 destination="org.freedesktop.Hal" (uid=0 pid=2895 comm="/usr/sbin/hald))
Segmentation fault
|
So, perhaps I'm having some problem with my hald setup?
EE |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|