udev rules Slackware 11
Hello all,
I've been reading the document that many here have referred others to when creating udev rules. I have looked at this myself, but am somewhat confused as to how to apply this to Slackware 11. Basically, what I want to accomplish is the following:
I am not sure where the main file that creates these udev rules in Slackware 11 is located, or if I have to create a new one to use. I would like to edit the existing one using the above links. Each time I create a symbolic link manually, it is gone after rebooting, which is something that I suppose udev does. Any information is appreciated. Thanks. |
Writing udev rules
Is this the page you've been looking at? To quote from it: Quote:
and Quote:
Good luck. |
Thanks for the reply. When I originally utilized this document, I did not have a 50-udev.rules file on my machine in the place that was specified within the document. I was going to look in there to see how the rules were setup prior to creating my own. I thought that rules that were already set up might collide with the ones that I was trying to create. Before 11, I did not bother with udev, but it seems to be an integral part of this new release. It seems pretty straightforward enough, so I'll see what I can come up with. Thanks.
|
That "Writing udev rules" site gets cited pretty often here in threads discussing udev, and for good reason.
One thing that bothers me a little though is the repeated reference to the statement that udev rules are in /etc/udev/rules.d/50-udev.rules. In slackware, they're not. At least they haven't been in udev-064, udev-071, or (the current version) udev-097. They are in /etc/udev/rules.d/udev.rules. So, if you want to bring your slack in line with the udev rules site, you need to move /etc/udev/rules.d/udev.rules to /etc/udev/rules.d/50-udev.rules and then write your own /etc/udev/rules.d/10-udev.rules. |
If I create my own udev rules in /etc/udev/rules.d and call the file 10-udev.rules as cited within the document, will udev still continue to load the original /etc/udev/rules.d/udev.rules as well, thereby overwriting the udev rules that were created by me? This is something that concerns me, but when I get the opportunity I shall find out with a trial-and-error session on my machine. I can always create a backup of the original udev.rules file and edit this directly, although this appears to be frowned upon by the documentation.
|
I was able to successfully create my own udev rules by creating a file in /etc/udev/rules.d/10-udev.rules as the document explained and, for the most part, it seemed to work as expected. I had to manually edit the main udev.rules file for the floppy drive since, for some reason, I was receiving a message at startup stating that the link /dev/fd0 could not be created since it already existed. I don't know exactly how udev works, but other links for optical drives seemed to worked w/o any problems, but just commenting out a specific line (don't remember offhand) in udev.rules and creating my own rule seem to resolve this. The rules that I created were:
KERNEL=="fd0", SYMLINK+="floppy" KERNEL=="hdc", SYMLINK+="dvd-rom" KERNEL=="hdd", SYMLINK+="dvd-rw" I don't know if these are necessarily ideal, but they seem to work for me. |
Glad to hear you got it to work.
As for the file names, AIUI, the primer page states that udev reads the config files in lexical order. so 10-udev.rules will be read before 50-udev.rules, and 50-udev.rules will be read before udev.rules. But every .rules file in the directory will be scanned in the end. So you slack users can rename the udev.rules if you want, or not, since either way it won't affect the loading order as long as you ensure that the local rules file has a lower alphanumeric sequence than the main one. As for the floppy problem, perhaps the fact that the system needs a floppy drive at boot has something to do with it. I'm guessing the bootup process creates the fd0 device even before udev starts, so it naturally freaks out when it tries to create a device that's already there. Did udev go ahead and create the symlink in that case, or did the rule fail completely? |
Before I created my own udev rule for the floppy drive, and commented out the line in /etc/udev/rules.d/udev.rules, I would get a message stating that creation of /dev/fd0 failed due to the fact that this link already existed. I actually deleted both /dev/fd0 while logged in, and then rebooted. I still received the same message at startup, so perhaps something else was creating the /dev/fd0 link prior to udev, as you mentioned. However, with the rule that I created, it seems to be working alright, so I believe that I'll just leave it as is unless something else needs to be done.
|
Put this in you 10-udev.rules
# Floppy KERNEL=="fd0", BUS=="platform", NAME="%k", SYMLINK+="floppy", GROUP="floppy", MODE="0660", OPTIONS+="last_rule" Ciao |
If you want to create a link from /dev/ttyS4 to /dev/modem at boot up, add a symlink in the /lib/udev/devices directory using this command.
ln -s /dev/ttyS4 modem ls -l modem should then give an output like this. lrwxrwxrwx 1 root root 10 2006-11-02 00:49 modem -> /dev/ttyS4 |
All times are GMT -5. The time now is 03:21 AM. |