From 539876083d15cef50f284f54a6b0cd6b7c911afa Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 18 May 2005 23:37:22 -0700 Subject: [PATCH 1/1] add Red Hat/Fedora html documenation Signed-off-by: Greg Kroah-Hartman --- docs/fedora_udev.html | 258 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 docs/fedora_udev.html diff --git a/docs/fedora_udev.html b/docs/fedora_udev.html new file mode 100644 index 000000000..5d5048766 --- /dev/null +++ b/docs/fedora_udev.html @@ -0,0 +1,258 @@ + + + + + Fedora Project, sponsored by Red Hat + + + + + + + + + + + +
+ + +
+ +  Download +  Projects +  FAQ +
+
+ +
+ + + +
+
Site Navigation:
+
+ + + + +
+
 
+
 
+
+ +

Udev on Fedora

+

by Harald Hoyer

+

+ This document tries to reveal the secrets of udev and how it works on Fedora. +

+

+ udev was developed by Greg Kroah-Hartman <greg@kroah.com> with much + help from Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, + and many others. +

+

+ The udev homepage and the + Linux-hotplug-devel mailing list https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel are the main development sources. +

+

+ +

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. +

+

Current Problems on Fedora

+

+ All open bugs for udev +

+

Nvidia

+

Quick solution: If you do not need rhgb, just load the nvidia module in /etc/rc.local +

+ If you have udev >= 032-5, load the nvidia module: +

+
+
+cp -a /dev/nvidia* /etc/udev/devices
+chown root.root /etc/udev/devices/nvidia*
+
+ +

The Bugzilla for this problem is 133900.

+

Palm Pilot

+

+ If you have udev >= 032-5, execute the command: +

+
+
+ln -s ttyUSB1 /etc/udev/devices/pilot
+
+ +

ISDN

+

+ If you have udev >= 032-5: +

+
+
+/sbin/MAKEDEV -d /etc/udev/devices isdn
+
+ + + + + +
+
 
+
 
+
+ + + + + + + + -- 2.30.2