Troubleshooters.Com and T.C Linux Library Present

Udev Universe

Copyright (C) 2008 by Steve Litt, All rights reserved. Material provided as-is, use at your own risk. 

Steve Litt is the author of the Universal Troubleshooting Process Courseware,
which can be presented either by Steve or by your own trainers.

He is also the author of Troubleshooting Techniques of the Successful Technologist,
Rapid Learning: Secret Weapon of the Successful Technologist, and Samba Unleashed.



This document contains information, procedures and exercises to modify your udev configuration. Doing so can change your drives, possibly causing loss or corruption of data, and/or loss of ability to boot. There may be other risks.

You use this document at your own risk. I am not responsible for any damage or injury caused by your use of this document, or caused by errors and/or omissions in this document. If that's not acceptable to you, you may not use this document. By using this document you are accepting this disclaimer.

Udev Overview

Udev is Linux's powerful and versatile way to instantiate devices. You can give devices easily remembered names, set their owner, group or permissions, and set it up so a given physical device always maps to the same device name, even if booted in a different order. Windows, and many other operating systems. If your thumb drives don't automatically mount when you plug them in, udev can do that for you. If you have multiple network adapters, udev can help you make sure they don't get mixed up.

Udev is new for Linux version 2.6. Former versions used devfs to do similar things, and before that simply hardlinked all possible device names into the /dev directory.

Here is some udev vocabulary:
udevLinux 2.6's method of populating the /dev directory with the necessary devices, using the desired filenames with the desired owner, group and permission. The udev system is configurable via the /etc/udev tree (at least on Mandriva). Udev does its magic whenever a new physical device comes online, whether during boot or by virtue of being plugged in (usb etc).
udev actionsDuring boot, or whenever a new physical device comes on line, udev can take many actions on the devicename within the /dev directory, including:
  • Set device ownership
  • Set device group
  • Set device permissions
  • Set device name
  • Run a program or script
  • Create a symlink to the device
udev rulesThe way udev knows which actions to perform on what device name is by the use of rules that can match (or not) a new physical device coming online. In the Mandriva 2007 distro, the rules are kept in directory /etc/udev/rules.d. Each file in that directory can contain many rules. Here's an example of a rule:
BUS=="ide", KERNEL=="hd*", NAME="%k", GROUP="disk"
In the preceding rule, the first two comma-delimited key-value pairs are values to be matched, while the latter two are actions to be taken. This rule should means that: If the device is on an IDE bus AND if the device's name begins with hd, then its name should be its normal name (%k is a string substitution that plugs in the name, like hda5 for a device that by default would be /dev/hda5), and it should be in the disk group.
Match keysThe main keys for matches are:
  • KERNEL -- match against the device's or its ancestors' kernel name
  • SUBSYSTEM -- match against the device's or ancestors' subsystem
  • DRIVER -- match against the device's or ancestors' driver name
  • ATTR -- ???
  • BUS -- Match the bus that the device is on.
ActionsThe main keys for actions are:
  • NAME -- Give the device a name (not including the /dev)
  • GROUP -- Assign the device's filename to a group
  • OWNER -- Assign the device's filename to an owner
  • RUN -- Run a program???
  • SYMLINK -- Create a symlink to this device filename
  • PROGRAM -- Run a program and assign its name to %c
String substitutionsHere are some of the main string substitutions:
  • %n -- the kernel number for the device (for /dev/hda2, %n is 2)
  • %k - the kernel name (for /dev/hda2, %n is hda2)
  • %M - the kernel major number
  • %m -- the kernel minor number for
  • %b -- the bus id
  • %c -- the return value for the program named in PROGRAM.
  • $env{variable} the content of an environment variable
  • %% the literal percent sign (%)

Grub From the Ground Up

This is where you learn the theory and simple practice of grub. It explains the concept of "root" from the grub perspective and from the linux perspective, and the fact that they are not the same. This page is a prerequisite to all other grub related pages on Troubleshooters.Com.

Grub Special Boots and Other Tips

This page discusses the grub configuration for dual booting.

Making a Dedicated Grub Partition

This contains the hows and whys of making a small (usually less than a single megabyte) partition dedicated to Grub. On multi-OS setups, especially those that change frequently, especially on experimental boxes, this can save a fortune in time.

Back to Troubleshooters.Com * Back to Linux Library*