Skip to contentSkip to conversation

udev for dummies

DISCUSSION J.A. Magallon 6 participants 7 messages Dec 11, 2003 – Dec 14, 2003

lore
Share & tools
lore
#0 lore raw

Hi all...

I am starting to use 2.6, and I really would like to use udev. But I can't find a doc about how to move from taditional heavily populated /dev to new method.

Any pointer ?

I have installed udev and hotplug utils, and have hotplug enabled in kernel.
As I undestand it, I should do now something like
- run udev for the first time, so it populates /udev
- check that basic dev files are there
- move /dev to /dev.old, and ln -s /udev /dev (or real-move it and change udev.conf to write directly on /dev)

Or just create and empty /dev, and let hotplug call hotplug scripts on boot which in turn call udev. Is this correct ? Will hotplug call udev for the built-in drivers ?
Could it also work without hotplugging, ie, can I use udev to just create a minimal /dev for my system ?

After installing udev, I run /sbin/udev and nothing appears on /udev.

What am I missing / misunderstanding ?

TIA

Signature · 4 lines
J.A. Magallon <jamagallon()able!es>     \                 Software is like sex:
werewolf!able!es                         \           It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.6.0-test11-jam1 (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-4mdk))
#1 lore raw
Quoted 22 lines · J.A. Magallon

Hi all...

I am starting to use 2.6, and I really would like to use udev. But I can't find a doc about how to move from taditional heavily populated /dev to new method.

Any pointer ?

I have installed udev and hotplug utils, and have hotplug enabled in kernel.
As I undestand it, I should do now something like
- run udev for the first time, so it populates /udev
- check that basic dev files are there
- move /dev to /dev.old, and ln -s /udev /dev (or real-move it and change udev.conf to write directly on /dev)

Or just create and empty /dev, and let hotplug call hotplug scripts on boot which in turn call udev. Is this correct ? Will hotplug call udev for the built-in drivers ?
Could it also work without hotplugging, ie, can I use udev to just create a minimal /dev for my system ?

Quoted 6 lines

After installing udev, I run /sbin/udev and nothing appears on /udev.

What am I missing / misunderstanding ?

TIA

You may be overthinking it a bit. I just set up udev on my box and it's working quite well. It's not really intending to completely replace /dev, rather it provides a dynamic device structure based on hotplugged devices. When you plug in some new device (USB thing, firewire, whatever), hotplug is run. hotplug winds up calling udev which is able to use it's defined rules and permissions to create a device node in /udev (NOTE: not /dev). These device nodes are perfectly valid for use by anything (/dev is really just a convention. There isn't much/any other real significance to it). The big win with udev is I can create my own rules so that certain things always have a device node that I want. For example, I have a San Disk Cruzer USB storage device. I don't want that to show up as /dev/sdX (where X can vary based on other things I have plugged in). I tell udev to always create it's device as /udev/cruzer. This way I can easily have entries in fstab to mount it, etc etc. Ditto for my other USB storage devices.

In short, don't start deleting your /dev directory just yet!

#2 lore raw
Quoted 8 lines · David T Hollis
Quoted 1 line · J.A. Magallon

What am I missing / misunderstanding ?

You may be overthinking it a bit. I just set up udev on my box and it's working quite well. It's not really intending to completely replace /dev, rather it provides a dynamic device structure based on hotplugged devices.

Greg can speak to this better than I, but udev is most certainly intended to completely replace /dev. The thing is that not everything exports the required information in /sys just yet.

If you start up udev and then run the script that comes with it that parses all the pre-existing /sys entries, it will build a pretty decent set of device nodes. Eventually it is intended that this will be mounted at /dev, which could be an on-disk filesystem or else a tmpfs-based one.

Once all the information is in /sys, then static /dev will go away forever. (Which is good, since device numbers will be random in 2.7.)

Chris

Signature · 4 lines
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: [email protected]
#3 lore raw
Quoted 5 lines · Chris Friesen
Quoted 3 lines · David T Hollis
Quoted 1 line · J.A. Magallon

What am I missing / misunderstanding ?

Quoted 8 lines
Quoted 4 lines

You may be overthinking it a bit. I just set up udev on my box and it's working quite well. It's not really intending to completely replace /dev, rather it provides a dynamic device structure based on hotplugged devices.

Greg can speak to this better than I, but udev is most certainly intended to completely replace /dev. The thing is that not everything exports the required information in /sys just yet.

Yes, this is true.

thanks,

greg k-h

#4 lore raw
In reply to David T Hollis
Quoted 11 lines · David T Hollis
Quoted 8 lines · J.A. Magallon

Hi all...

I am starting to use 2.6, and I really would like to use udev. But I can't find a doc about how to move from taditional heavily populated /dev to new method.

Any pointer ?

Do you may mean heavily **over-populated** /dev? Learning more about devfs would make it easier to transition to udev. I'm going through this now for myself.

You could learn how to strip out non-existent devices from /dev by using /etc/devfs/compat_symlinks
by using regular expressions there to make symlinks for standard device names like udev uses but only permit devfsd to make device entries for devices you have on your system.

Here is my /etc/devfs/compat_symlinks. At the top I don't use anything but devfs naming, then at the bottom I add a few symlinks both to limit naming to real devices(see md*) and to make conventional sd* hd* to make transition to udev simpler.

-Bob

# Enable full compatibility mode for old device names. You may comment these

# out if you don't use the old device names. Make sure you know what you're
# doing!
#########REGISTER	.*		MKOLDCOMPAT
UNREGISTER	.*		RMOLDCOMPAT

# You may comment out the above and uncomment the following if you've

# configured your system to use the original "new" devfs names or the really
# new names
#####REGISTER	^vc/.*		MKOLDCOMPAT
UNREGISTER	^vc/.*		RMOLDCOMPAT
#####REGISTER	^pty/m0  	MKOLDCOMPAT
######REGISTER	^pty/s0  	MKOLDCOMPAT
UNREGISTER	^pty/.*		RMOLDCOMPAT
######REGISTER	^misc		MKOLDCOMPAT
UNREGISTER	^misc		RMOLDCOMPAT

# You may comment these out if you don't use the original "new" names
######REGISTER .* MKNEWCOMPAT
UNREGISTER .* RMNEWCOMPAT

# Create compatibility links for broken USB serial driver
REGISTER ^usb/tts/([0-9]+) CFUNCTION GLOBAL symlink $devname ttyUSB\1
#######UNREGISTER ^usb/tts/([0-9]+) CFUNCTION GLOBAL unlink ttyUSB\1

# Create compatibility link for broken misc/net/tun driver (must uncomment the # MKOLDCOMPAT for misc above if you want to use this)
######REGISTER ^misc/net/tun$ CFUNCTION GLOBAL unlink net/tun
######REGISTER ^misc/net/tun$ CFUNCTION GLOBAL symlink /dev/$devname net/tun

# Bob removes non-existent /dev/md's, adds old conventional devices

# to aid transition to udev as this percolates through /etc/init.d
# scripts for fsck and mount--
REGISTER	^md/[0-4]		             MKOLDCOMPAT
UNREGISTER	^md/[5-9][0-9]*	                     RMOLDCOMPAT
REGISTER        ^ide/host[0-2]/.*                    MKOLDCOMPAT
REGISTER        ^scsi/host[0-2]/bus0/target[0-3]/.*  MKOLDCOMPAT
REGISTER        ^snd/.*                              MKOLDCOMPAT
REGISTER        ^sound/.*                            MKOLDCOMPAT
REGISTER        ^misc/rtc                            MKOLDCOMPAT
#5 lore raw
In reply to J.A. Magallon
Quoted 7 lines · J.A. Magallon

Hi all...

I am starting to use 2.6, and I really would like to use udev. But I can't find a doc about how to move from taditional heavily populated /dev to new method.

Any pointer ?

Did you read the README in udev's package?

Anyway, I don't really recommend using udev for management of your /dev at this moment in time. In order to do this we need some more intregration of udev into the early boot process. People are working on this, but it will be a bit of time before it works properly, sorry.

thanks,

greg k-h

#6 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · J.A. Magallon

Hi all...

I am starting to use 2.6, and I really would like to use udev. But I can't find a doc about how to move from taditional heavily populated /dev to new method.

Quoted 9 lines
Quoted 1 line

Any pointer ?

Did you read the README in udev's package?

Anyway, I don't really recommend using udev for management of your /dev at this moment in time. In order to do this we need some more intregration of udev into the early boot process. People are working on this, but it will be a bit of time before it works properly, sorry.

It does work nicely to manage /dev if /dev is well populated as you would have for a non-devfs system (yes, it does sort of defeat the point, but the extra functionality of udev like changing the name of a specific usb device, etc, makes up for the current 'bloat of this approach).

Signature · 1 line
Martin Schlemmer