Udev

From LQWiki
Jump to navigation Jump to search

udev manages the /dev directory and creates device files for devices that actually exist in the system.

The /dev directory

The /dev directory in a unix system contains device files. These are very important, whenever you read from the keyboard or write to the printer, you do it via file access. For example, to read from the keyboard via the device file handles, you can do in a console:

$ cat /dev/tty
I type this on the keyboard.
I type this on the keyboard.

In this case, /dev/tty is the file representing the system's keyboard. Now, this file node has been created by udev.

Configuration

All the configuration files are normally located in /etc/udev. The naming policies are configured in /etc/udev/rules.d. The udev.conf is the main config file, where the used rules and permissions can be configured. For example, you can define what network device gets what name, eth0 and eth1.

To enable stable naming schemes (e.g. when USB devices are plugged in changing order, but the device(s) shall be accessible under the same name / link) the file /etc/udev/static_devices.txt will be used.

Look also for subdirectories in /etc/udev which may contain further files for configuration and udev-information.

TroubleShooting

You can realize that you have problems with udev by the following symptomes:

  • You cannot switch to another console (CTRL_ALT_F2)
  • Your /dev folder does not contain /dev/sda although it is attached

To continue your work, you can mount a disk like that:

duffman:/ # cat /proc/partitions
major minor  #blocks  name 

   8     0   58605120 sda
   8     1   58597056 sda1
   8    16   78150744 sdb
   8    17   39070048 sdb1
   8    18     514080 sdb2
   8    19   38564032 sdb3
   8    32  117220824 sdc
   8    33   39070048 sdc1
   8    34     514080 sdc2
   8    35   38564032 sdc3
   8    36          1 sdc4
   8    37   15631213 sdc5
   8    38   23438803 sdc6
duffman:/ # mknod /dev/sdc2 b 8 33

To fix your udev problem, have a look at /etc/init.d/boot.udev

See Also

External links