SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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:
create link to /dev/hdc using /dev/dvd-rom
create link to /dev/hdd using /dev/dvd-rw
create link from /dev/ttyS4 to /dev/modem
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.
Is this the page you've been looking at? To quote from it:
Default udev rules are stored in /etc/udev/rules.d/50-udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly.
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.
In order to preserve the standard /dev layout, your own rules will typically leave the NAME alone but create some SYMLINKs and/or perform other assignments.
KERNEL=="hdc", SYMLINK+="cdrom cdrom0"
The above rule is probably more typical of the types of rules you might be writing. It creates two symbolic links at /dev/cdrom and /dev/cdrom0, both of which point at /dev/hdc. Again, no NAME assignment was specified, so the default kernel name (hdc) is used.
That should be pretty much all you need to know for what you want to do. If there are any differences between this and slack you should be able to figure them out pretty easily.
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.
Last edited by swampdog2002; 11-16-2006 at 11:53 AM.
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
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:
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.