Skip to contentSkip to conversation

UDEV permissions and LFS

DISCUSSION Andrew 2 participants 2 messages Aug 31, 2006

lore
Share & tools
lore

Andrew

author
#0 lore raw

After trying to follow the advice on
http://www.reactivated.net/writing_udev_rules.html, I am still finding it impossible to get group access to dvd on /dev/hdc and cdrom on /dev/hdd.

My system is a LinuxFromScratch (LFS) version 6.1.1 using udev-056 attached.

I have added this two line file to /etc/udev/rules

BUS=="ide", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom" BUS=="ide", KERNEL=="hdd", SYMLINK+="cdrom", GROUP="cdrom"

This file is saved as 10-local.rules and on failure as 60-local.rules. Restarting udev using LFS bootscripts (where $e is an exported link to the /etc/rc.d/init.d folder) I get

root@lfs-6:/etc/udev/rules.d# ls -l
total 24
-rw-r--r--  1 root root  120 2006-08-31 12:05 10-local.rules
-rw-r--r--  1 root root  486 2006-08-30 00:42 15-alsa.rules
-rwxr-xr-x  1 root root 5380 2006-02-07 17:09 25-lfs.rules
-rw-r--r--  1 root root 1527 2006-08-31 11:17 50-udev.rules
-rw-r--r--  1 root root  120 2006-08-31 12:18 60-local.rules
root@lfs-6:/etc/udev/rules.d# $e/udev start
Populating /dev with device
nodes...                                                             [ 
OK  ]
root@lfs-6:/etc/udev/rules.d# echo $e
/etc/rc.d/init.d
root@lfs-6:/etc/udev/rules.d# ls /dev/d* -l
crw-rw----  1 root audio 14,  3 2006-08-31 12:18 /dev/dsp
crw-rw----  1 root audio 14, 19 2006-08-31 12:18 /dev/dsp1
lrwxrwxrwx  1 root root       3 2006-08-31 12:18 /dev/dvd -> hdc
root@lfs-6:/etc/udev/rules.d# ls -l /dev/c*
lrwxrwxrwx  1 root root    3 2006-08-31 12:18 /dev/cdrom -> hdd
crw--w--w-  1 root tty  5, 1 2006-08-31 12:18 /dev/console
lrwxrwxrwx  1 root root   11 2006-08-31 12:18 /dev/core -> /proc/kcore

As you see the device creates the symlink but refuses to belong to group cdrom (or any ther group I care to name).

I am looking to use KDiskFree for mounting and unmounting these drives

I have two questions:
a) How do I permanently change the group ownership?
b) If I need to safely reinstall udev from source (to 07x or 098),
what precautions should I take without destroying my system? (other than a giant tar ball?)

=======================================================================================

(LFS udev instructions if attachment kicked off)
6.58.1. Installation of Udev

Compile the package:
make udevdir=/dev
udevdir=/dev
This tells udev in which directory devices nodes are to be created. To test the results, issue: make test.

Install the package:
make DESTDIR=/ udevdir=/dev install

The meaning of the make option:
DESTDIR=/
This prevents the Udev build process from killing any udevd processes
that may be running on the host system.
Udev's configuration is far from ideal by default, so install the
configuration files here:
cp -v ../udev-config-4.rules /etc/udev/rules.d/25-lfs.rules

Run the udevstart program to create our full complement of device nodes.
/sbin/udevstart

6.58.2. Contents of Udev
Installed programs: udev, udevd, udevsend, udevstart, udevinfo, and udevtest Installed directory: /etc/udev

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Andrew

I have added this two line file to /etc/udev/rules

BUS=="ide", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom" BUS=="ide", KERNEL=="hdd", SYMLINK+="cdrom", GROUP="cdrom"

I assume you mean /etc/udev/rules.d, right?

Quoted 1 line

This file is saved as 10-local.rules and on failure as 60-local.rules.

"On failure"? Not sure what that means... You should only need one copy of this file, and 10-local.rules should be good enough.

Quoted 11 lines

I get
<...>

root@lfs-6:/etc/udev/rules.d# ls /dev/d* -l
crw-rw----  1 root audio 14,  3 2006-08-31 12:18 /dev/dsp
crw-rw----  1 root audio 14, 19 2006-08-31 12:18 /dev/dsp1
lrwxrwxrwx  1 root root       3 2006-08-31 12:18 /dev/dvd -> hdc
root@lfs-6:/etc/udev/rules.d# ls -l /dev/c*
lrwxrwxrwx  1 root root    3 2006-08-31 12:18 /dev/cdrom -> hdd
crw--w--w-  1 root tty  5, 1 2006-08-31 12:18 /dev/console
lrwxrwxrwx  1 root root   11 2006-08-31 12:18 /dev/core -> /proc/kcore
Quoted 2 lines

As you see the device creates the symlink but refuses to belong to group cdrom (or any ther group I care to name).

Um, the owner/group/permissions on a symlink have no effect whatsoever. I'm not even sure if you *can* change them, but even if so, it won't do you any good.

The rules you posted above will cause udev to change the GID on the /dev/hdc and /dev/hdd device files, not the symlinks. But the kernel will not apply the permissions of the symlinks, only the permissions on their targets, so this is fine.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel