Kernel Korner - udev—Persistent Device Naming in User Space

Whether you're plugging a camera and scanner in to your laptop or adding another SCSI drive to your company server, it's time to end the current mess of major and minor numbers.
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

What about Garrick?

Anonymous's picture

After reading this fine article, I'm still confused about Garrick. Did he respond and is the font I'm seeing already the small one, or did he utterly ignore all requests directed at him? Would be great if somebody could provide some insight. Thanks.

Changing device order and modprobe.d

Anonymous's picture

I think I have been under the misapprehension that it is possible to change device order or allocation using udev rules. I wanted to make dsp dsp1 and dsp1 dsp, but it seems to me that that is impossible without changing the boot order first. Assigning names to devices only identifies them regardless of the boot order. However it is not possible to reassign those devices following startup, it's all locked up in /sys.
Also, how does /etc/modprobe.d fit into the scheme of aliases/device naming in light of udev. How is the modalias file in /sys applied to /etc/modprobe.d.

Writing udev rules is quite easy with...

VilleWitt's picture

I recently needed some custom stuff in /dev on my GNU/Linux Gentoo. Somehow I cam across this wounderfull article about how to actually implement some of all this stuff - and it works, is easy and very customizable.

http://www.reactivated.net/writing_udev_rules.html

Most of the problems people tend to smoke about would be solved by reading that document. These problems are
"They should be named with this syste: ...",
"I want a copy of a device node at ...",
"XXX application can't find /dev/YYY - udev is bad!",
...
...
udev rocks!

udev ruined Mepis

Anonymous's picture

I had to switch from Mepis to SUSE 10.0 because of problems with udev. As far as I can see it's not ready for prime time. THe fact of the matter is it wrecked a lot of previously good Linux distributions. Try managing an iPod SUffle with udev. It's as good as impossible.

udev and why I will not use the 2.6 kernel

Anonymous's picture

I am a gentoo user with to installations, one based on the 2.4 kernel and the other on the 2.6 kernel. I decided to do a system upgrade over the new year. What a mistake. I no longer have a useable modem, DRI still does not function and I suspect the problem may, in fact, be udev, which I have yet to determine how to correctly set rules for even with the docs currently available. Add to this that I once was able to view movies under linux I am no longer able to do so.

I am willing to admit I just do not have the big picture on this, but at the same time I have misgivings as to why such a system is really necessary. IF it is the default for th 2.6 kernel I can be sure of one thing...I will never use that kernel further.

Nice try, but no cigar.

.I will never use that kernel further.

Bill Savoie's picture

It is not good to smoke Cigars. You are quick to judgement and that makes you closed off to change. The mind is like a parachute, it only functions when it is open. Your attitude is like a child who throws a tantrum. udev is a great improvement and these people work for free. How about a bit more grace. Make peace and love your path..

auto-load drivers a la devfs

Arioch's picture

FAQ says that driver autoloading is not possible with udev and will not be implemented by ydev maintainer.

But i think there still are projects to achieve this.
For example in AltLinux.com it is done by tmpfs + modules_lookup script

I wonder, if there is somewhere a list of such a projects?

Program field

phorm's picture

Well, you could try ysing the program field in udev to fire off an event to another program that could do driver lookups?

BUS="scsi", PROGRAM="/sbin/checkdrv", RESULT="somevalue" might be a start?

Trying sysfs with a USB memory stick

Anonymous's picture

Maybe it's more of a sysfs question, but I immediately tried Greg's suggestion with a USB memory stick. I have several of them, and they always appear at another /dev/sdx or /dev/sdx[1-3] device so this is a proper candidate for udev.

But nothing seems to appear in /sys/class/usb. An entry does appear in /sys/block/sda, but there's no identifying information like a serialno there, and there are suddenly 4 subdirs underneath: sda[1-4].

Is my sysfs set up correctly? How do I figure out the right partition (if any) to mount on such a 'pseudo disk' device?

Re: Kernel Korner: Kernel Korner: udev--Persistent Device Naming

Anonymous's picture

Given that the probe function for every registered USB driver will be called when a device is detected on the USB, what prevents the current lp driver from always choosing the same minor number for the same device regardless of location within the USB. Creating lp1 before or without an lp0 would not cause any problems, would it ?

Re: Kernel Korner: Kernel Korner: udev--Persistent Device Naming

Anonymous's picture

what prevents the current lp driver from always choosing the same minor number for the same device regardless of location within the USB

You are proposing that the kernel device driver should maintain a database for the every device it has handled over the time? This sounds like a really bad idea. A lot of devices are very difficult to distinguish from another, e.g. EPSON has the same USB ID's for a lot of printer models and you need to query the printer information with a vendor specific protocol, which surely belongs to userspace.

Thanks,
Kay

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix