UDEV

1. From webpages.charter.net:

If this is a new install and configuring it for a Pure UDEV system, or you get an error when you finally reboot after installing udev and setting it correctly like this:

    WARNING: Unable to open an initial console
It is because there is no /dev/console and /dev/null. What is happening is that /dev/console is needed before UDEV is populating the /dev/ folder. You can try this by manually deleting all static devices in /dev folder from another system, then rebooting to the UDEV system. You will get the console error. You will also notice that it is faulting at a time before it normally loads UDEV. If you just make /dev/console though it will then fail for /dev/null. So it needs both of those static in /dev, at least for the time being. The fix for now is to manually create them in your /dev folder:
    cd /dev
    mknod -m 660 console c 5 1
    mknod -m 660 null c 1 3
This will create the /dev/console and /dev/null statically in your /dev folder.

2. From fedora.redhat.com

by Harald Hoyer

What Does Udev Do?

udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files usually located in the /dev/ directory, or it renames network interfaces.

As part of the hotplug subsystem, udev is executed if a kernel device is added or removed from the system. On device creation, udev reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. These attributes may be used as keys to determine a unique name for the device. udev maintains a database for devices present on the system. On device removal, udev queries its database for the name of the device file to be deleted.

udev gets called by hotplug, if a module is loaded, and a device is added or removed. udev looks in /sys/, if the driver provides a "dev" file, which contains the major and minor number for a device node to communicate with the driver. After looking in the udev rules (in the /etc/udev/rules.d/ directory), which specify the device node filename and symlinks, a device node is created in /dev/ with the permissions, which are specified in /etc/udev/permissions.d/. After device node creation, removal, or network device renaming, udev executes the programs in the directory tree under /etc/dev.d/. The name of a program must end with the .dev suffix, to be recognized. In addition to the hotplug environment variables, DEVNAME is exported to make the name of the created node or the name the network device is renamed to, available to the executed program. The programs in every directory are sorted in lexical order, while the directories are searched in the following order:

    * /etc/dev.d/$(DEVNAME)/*.dev
    * /etc/dev.d/$(SUBSYSTEM)/*.dev
    * /etc/dev.d/default/*.dev

How is Udev Integrated on Fedora?

initrd/initfs

mkinitrd copies /sbin/udev.static to the initrd /sbin/udev and symlinks it to /sbin/udevstart.

After the kernel boots, it executes the nash script of the initrd. This mounts a tmpfs filesystem on /dev/. Instead of hotplug /sbin/udev is called in the initrd phase. udevstart creates all device nodes for the devices, which are compiled in the kernel and for the modules, which are loaded by nash.

Problems

The whole udev and hotplug infrastructure is not available in initrd. Thus no hotplug scripts, udev rules, and permissions and no /etc/dev.d/ scripts are executed for any hotplug event, which is sent from the kernel. rc.sysinit

First, if SELinux is loaded and enabled, the context of /dev/ is set. rc.sysinit calls /sbin/start_udev. start_udev mounts a tmpfs filesystem on /dev/, if there is none already mounted. Then it creates some device nodes, which need module autoloading, or where there is no kernel module. After that /sbin/udevstart is called again, which simulates the hotplug events in the initrd phase, to apply the whole udev rules and permissions. After that rc.sysinit parses the ouput of /sbin/kmodule and loads every module. This should provide device nodes for all hardware found on your computer.

Console User Permissions

/etc/dev.d/default/pam_console.dev is called whenever a device node is created and calls /sbin/pam_console_setowner with the filename (and an optional symlink) of the device node. This sets the permissions for console users like specified in /etc/security/console.perms.

Customizing Udev on Fedora

Read the manpage of udev and udevinfo. Please try not to modify the files of RPM packages.

New Rules

New rules should be placed in a file, which ends in .rules in /etc/udev/rules.d/. Please do not use 50-udev.rules. The supported and preferred way is to create rules without the "NAME" tag and only create "SYMLINK"s.

A nice document describing how to write rules can be found on http://www.reactivated.net/udevrules.php.

Permissions

New permissions should be placed in a file, which ends in .permissions in /etc/udev/permissions.d/. Please do not use 50-udev.permissions.

But I Really Want My Device Node!

Put them in /etc/udev/devices/, and they will get copied to /dev/. File a bugzilla entry, if you think that should be done per default.

Updating to udev Without /dev/

The steps to upgrade without Anaconda or a rescue CD are (NOT recommended):

    * start from a kernel-2.6
    * Make sure /sys/ is mounted
    * Install the latest initscripts package
    * Install the latest udev package
    * Execute /sbin/start_udev
    * Install the latest mkinitrd package
    * Install the latest kernel package
    * Or execute mkinitrd for your existing kernel(s) 

Udev without initrd

Install Fedore Core as usual and reboot. Execute the following commands

  mkdir /tmp/dev
  mount --move /dev /tmp/dev
  sbin/MAKEDEV null console zero
  mount --move /tmp/dev /dev
Install your kernel without an initrd. Reboot.

You will get some SELinux errors, and syslogd will not work as expected.