from small one page howto to huge articles all in one place
 

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

46564

userrating:

average rating: 1.5 (4 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Misc

Gentoo udev Guide


1. What is udev?


The /dev Directory


When Linux-users talk about the hardware on their system in the vicinity of people who believe Linux is some sort of virus or brand of coffee, the use of "slash dev slash foo" will return a strange look for sure. But for the fortunate user (and that includes you) using /dev/hda1 is just a fast way of explaining that we are talking about the primary master IDE, first partition. Or aren't we?
We all know what a device file is. Some even know why device files have special numbers when we take a closer look at them when we issue ls -l in /dev. But what we always take for granted is that the primary master IDE disk is referred to as /dev/hda. You might not see it this way, but this is a flaw by design.
Think about hotpluggable devices like USB, IEEE1394, hot-swappable PCI, ... What is the first device? And for how long? What will the other devices be named when the first one disappears? How will that affect ongoing transactions? Wouldn't it be fun that a printing job is suddenly moved from your supernew laserprinter to your almost-dead matrix printer because your mom decided to pull the plug of the laserprinter which happened to be the first printer?


Enter udev. The goals of the udev project are both interesting and needed:
- Runs in userspace
- Dynamically creates/removes device files
- Provides consistent naming
- Provides a user-space API
To provide these features, udev is developed in three separate projects: namedev, libsysfs and, of course, udev.

namedev


Namedev allows you to define the device naming separately from the udev program. This allows for flexible naming policies and naming schemes developed by separate entities. This device naming subsystem provides a standard interface that udev can use.
Currently only a single naming scheme is provided by namedev; the one provided by LANANA, used by the majority of Linux systems currently and therefore very suitable for the majority of Linux users.
Namedev uses a 5-step procedure to find out the name of a given device. If the device name is found in one of the given steps, that name is used. The steps are:
- label or serial number
- bus device number
- bus topology
- statically given name
- kernel provided name

The label or serial number step checks if the device has a unique identifier. For instance USB devices have a unique USB serial number; SCSI devices have a unique UUID. If namedev finds a match between this unique number and a given configuration file, the name provided in the configuration file is used.
The bus device number step checks the device bus number. For non-hot-swappable environments this procedure is sufficient to identify a hardware device. For instance PCI bus numbers rarely change in the lifetime of a system. Again, if namedev finds a match between this position and a given configuration file, the name provided in that configuration file is used.
Likewise the bus topology is a rather static way of defining devices as long as the user doesn't switch devices. When the position of the device matches a given setting provided by the user, the accompanying name is used.
The fourth step, statically given name, is a simple string replacement. When the kernel name (the default name) matches a given replacement string, the substitute name will be used.
The final step (kernel provided name) is a catch-all: this one takes the default name provided by the kernel. In the majority of cases this is sufficient as it matches the device naming used on current Linux systems.

libsysfs


udev interacts with the kernel through the sysfs pseudo filesystem. The libsysfs project provides a common API to access the information given by the sysfs filesystem in a generic way. This allows for querying all kinds of hardware without having to make assumptions on the kind of hardware.

udev


Every time the kernel notices an update in the device structure, it calls the /sbin/hotplug program. Hotplug runs the applications linked in the /etc/hotplug.d/default directory where you will also find a symlink to the udev application. Hotplug directs the information given by the kernel to the udev application which performs the necessary actions on the /dev structure (creating or deleting device files).

2. Using udev on Gentoo


Requirements


udev is meant to be used in combination with a 2.6 kernel (like development-sources or gentoo-dev-sources). If you're using such a kernel then you just have to make sure that you have a recent sys-apps/baselayout version. That's all you need.
Code Listing 2.1: Installing udev
# emerge udev

udev will install hotplug-base as one of it's dependencies. You do not need to install hotplug unless you want your modules automatically loaded when you plug devices in. hotplug also handles the automated bringup of network devices and firmware downloading.
Code Listing 2.2: Installing optional hotplug scripts
# emerge hotplug

If you want modules loaded for devices that have been plugged in before you boot, use the coldplug package:
Code Listing 2.3: Installing the coldplug package
# emerge coldplug

Kernelwise, if you're using the default set by genkernel then you're all set. Otherwise be sure to activate the following options:
Code Listing 2.4: Required kernel options
General setup --->   
[*] Support for hot-pluggable devices

File systems --->
Pseudo filesystems --->
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)

You can leave the /dev file system support (OBSOLETE) active if you wish but you have to make sure that "Automatically mount at boot" is disabled:
Code Listing 2.5: Don't automatically mount devfsd
File systems --->   
Pseudo Filesystems --->
[*] /dev file system support (OBSOLETE)
[ ] Automatically mount at boot

Configuration


If you want to use the udev-tweaks Gentoo added to make your life comfortable, then read no more. Gentoo will use udev but keep a static /dev so that you will never have any missing device nodes. The Gentoo init scripts won't run the devfsd daemon and will deactivate devfs when you boot up.

But if you are a die-hard and want to run a udev-only, no-tweaked system as is intended by the udev development (including the difficulties of missing device nodes because udev doesn't support them yet), by all means, read on :)

We'll deactivate the rules that save the device file nodes: edit the RC_DEVICE_TARBALL variable in /etc/conf.d/rc and set it to no:
Code Listing 2.6: /etc/conf.d/rc
RC_DEVICE_TARBALL="no"

If you have included devfs support in your kernel, you can deactivate it in the bootloader configuration: add gentoo=nodevfs as a kernel parameter. If you want to use devfs and deactivate udev, add gentoo=noudev as kernel parameter.

3. Known Issues


Missing device node files at boot


If you can't boot successfully because you get an error about /dev/null not found, or because the initial console is missing, the problem is that you lack some device files that must be available before /dev is mounted and handled by udev. This is common on Gentoo machines installed from old media.

If you run sys-apps/baselayout-1.8.12 or later, this problem is alleviated since the boot process should still manage to complete. However, to get rid of those annoying warnings, you should create the missing device nodes as described below.

To see which devices nodes are present before the /dev filesystem is mounted, run the following commands:
Code Listing 3.1: Listing device nodes available at boot
# mkdir test   
# mount --bind / test
# cd test/dev
# ls

The devices needed for a successful boot are /dev/null and /dev/console. If they didn't show up in the previous test, you have to create them manually. Issue the following commands in the test/dev/ directory:
Code Listing 3.2: Creating necessary device node files
# mknod -m 660 console c 5 1   
# mknod -m 660 null c 1 3

When you're finished, don't forget to unmount the test/ directory:
Code Listing 3.3: Unmounting the test/ directory
# cd ../..   
# umount test
# rmdir test

udev and nvidia


If you use the proprietary driver from nVidia and the X server fails to start on a udev-only system, then make sure you have:

the nvidia module listed in /etc/modules.autoload.d/kernel-2.6
a version of nvidia-kernel equal to or greater than media-video/nvidia-kernel-1.0.5336-r2
a version of baselayout equal to or greater than sys-apps/baselayout-1.8.12

LVM2 Names Disappear


When you use udev and LVM2 together, you might notice that your created volume groups and logical volumes have disappeared. Well, they haven't, but they are unfortunately named /dev/dm-# with # being 0, 1, ...

To fix this, edit /etc/udev/rules.d/50-udev.rules and uncomment the following line:
Code Listing 3.4: Uncomment this line from /etc/udev/rules.d/50-udev.rules
KERNEL="dm-[0-9]*",     PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c"

No Consistent Naming between DevFS and udev


Even though our intention is to have a consistent naming scheme between both dynamical device management solutions, sometimes naming differences do occur. One reported clash is with a HP Smart Array 5i RAID controller (more precisely the cciss kernel module). With udev, the devices are named /dev/cciss/cXdYpZ with X, Y and Z regular numbers. With devfs, the devices are /dev/hostX/targetY/partZ or symlinked from /dev/cciss/cXdY.

If this is the case, don't forget to update your /etc/fstab and bootloader configuration files accordingly.

Other issues


If device nodes are not created when a module is loaded from /etc/modules.autoload.d/kernel-2.6 but they appear when you load the module manually with modprobe then you should try upgrading to sys-apps/baselayout-1.8.12 or later.

Support for the framebuffer devices (/dev/fb/*) comes with the kernel starting from version 2.6.6-rc2.

For kernels older than 2.6.4 you have to explicitly include support for the /dev/pts filesystem.
Code Listing 3.5: Enabling the /dev/pts filesystem
File systems --->   
Pseudo filesystems --->
[*] /dev/pts file system for Unix98 PTYs

4. Resources & Acknowledgements


The udev talk on the Linux Symposium (Ottawa, Ontario Canada - 2003) given by Greg Kroah-Hartman (IBM Corporation) provided a solid understanding on the udev application.

Decibel's UDEV Primer is an in-depth document about udev and Gentoo.

Writing udev rules by fellow Gentoo developer Daniel Drake is an excellent document to learn how to customize your udev installation.
rate this article:
current rating: average rating: 1.0 (5 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2019-06-25
aws-sam-translator - 1.11.0
Ebuild name:

dev-python/aws-sam-translator-1.11.0

Description

A library that transform SAM templates into AWS CloudFormation

Added to portage

2019-06-25

aws-xray-sdk-python - 2.4.2
Ebuild name:

dev-python/aws-xray-sdk-python-2.4.2

Description

AWS X-Ray SDK for Python

Added to portage

2019-06-25

backports-tempfile - 1.0
Ebuild name:

dev-python/backports-tempfile-1.0

Description

Backport of new features in Python's tempfile module

Added to portage

2019-06-25

backports-weakref - 1.0_p1
Ebuild name:

dev-python/backports-weakref-1.0_p1

Description

Backport of new features in Python's weakref module

Added to portage

2019-06-25

cfn-python-lint - 0.21.6
Ebuild name:

dev-python/cfn-python-lint-0.21.6

Description

CloudFormation Linter

Added to portage

2019-06-25

docker-compose - 1.24.1
Ebuild name:

app-emulation/docker-compose-1.24.1

Description

Multi-container orchestration for Docker

Added to portage

2019-06-25

elixir - 1.9.0
Ebuild name:

dev-lang/elixir-1.9.0

Description

Elixir programming language

Added to portage

2019-06-25

emacs-common-gentoo - 1.6-r2
Ebuild name:

app-emacs/emacs-common-gentoo-1.6-r2

Description

Common files needed by all GNU Emacs versions

Added to portage

2019-06-25

f3 - 7.2
Ebuild name:

sys-block/f3-7.2

Description

Utilities to detect broken or counterfeit flash storage

Added to portage

2019-06-25

gamestat - 0
Ebuild name:

acct-group/gamestat-0

Description

Group for shared high-score and game state files

Added to portage

2019-06-25

grub - 2.02-r4
Ebuild name:

sys-boot/grub-2.02-r4

Description

GNU GRUB boot loader

Added to portage

2019-06-25

imagemagick - 6.9.10.50
Ebuild name:

media-gfx/imagemagick-6.9.10.50

Description

A collection of tools and libraries for many image formats

Added to portage

2019-06-25

imagemagick - 7.0.8.50
Ebuild name:

media-gfx/imagemagick-7.0.8.50

Description

A collection of tools and libraries for many image formats

Added to portage

2019-06-25

intel-microcode - 20190618_p20190623
Ebuild name:

sys-firmware/intel-microcode-20190618_p20190623

Description

Intel IA32/IA64 microcode update data

Added to portage

2019-06-25

jsondiff - 1.1.2
Ebuild name:

dev-python/jsondiff-1.1.2

Description

Diff JSON and JSON-like structures in Python

Added to portage

2019-06-25

jsonpickle - 1.2
Ebuild name:

dev-python/jsonpickle-1.2

Description

Python library for serializing any arbitrary object graph into JSON

Added to portage

2019-06-25

latexdiff - 1.3.0
Ebuild name:

dev-tex/latexdiff-1.3.0

Description

Compare two latex files and mark up significant differences

Added to portage

2019-06-25

librdkafka - 1.1.0
Ebuild name:

dev-libs/librdkafka-1.1.0

Description

Apache Kafka C/C++ client library

Added to portage

2019-06-25

moto - 1.3.8
Ebuild name:

dev-python/moto-1.3.8

Description

Mock library for boto

Added to portage

2019-06-25

nss - 3.44.1
Ebuild name:

dev-libs/nss-3.44.1

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2019-06-25

phpBB - 3.2.7
Ebuild name:

www-apps/phpBB-3.2.7

Description

An open-source PHP-based bulletin board package

Added to portage

2019-06-25

postfix - 3.5_pre20190621
Ebuild name:

mail-mta/postfix-3.5_pre20190621

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2019-06-25

prboom-plus - 2.5.1.4
Ebuild name:

games-fps/prboom-plus-2.5.1.4

Description

A Doom source port developed from the original PrBoom project

Added to portage

2019-06-25

python-jose - 3.0.1
Ebuild name:

dev-python/python-jose-3.0.1

Description

A JavaScript Object Signing and Encryption (JOSE) implementation in Py

Added to portage

2019-06-25

radare2 - 3.6.0
Ebuild name:

dev-util/radare2-3.6.0

Description

unix-like reverse engineering framework and commandline tools

Added to portage

2019-06-25

thunderbird - 60.7.2
Ebuild name:

mail-client/thunderbird-60.7.2

Description

Thunderbird Mail Client

Added to portage

2019-06-25

thunderbird-bin - 60.7.2
Ebuild name:

mail-client/thunderbird-bin-60.7.2

Description

Thunderbird Mail Client

Added to portage

2019-06-25

vanilla-sources - 4.14.130
Ebuild name:

sys-kernel/vanilla-sources-4.14.130

Description

Full sources for the Linux kernel

Added to portage

2019-06-25

vanilla-sources - 4.19.56
Ebuild name:

sys-kernel/vanilla-sources-4.19.56

Description

Full sources for the Linux kernel

Added to portage

2019-06-25

vanilla-sources - 5.1.15
Ebuild name:

sys-kernel/vanilla-sources-5.1.15

Description

Full sources for the Linux kernel

Added to portage

2019-06-25

2019-06-24
HTTP-Headers-Fast - 0.220.0
Ebuild name:

dev-perl/HTTP-Headers-Fast-0.220.0

Description

Faster implementation of HTTP

Added to portage

2019-06-24

TAP-Parser-SourceHandler-pgTAP - 3.350.0
Ebuild name:

dev-perl/TAP-Parser-SourceHandler-pgTAP-3.350.0

Description

Stream TAP from pgTAP test scripts

Added to portage

2019-06-24

Test-CleanNamespaces - 0.240.0
Ebuild name:

dev-perl/Test-CleanNamespaces-0.240.0

Description

Check for uncleaned imports

Added to portage

2019-06-24

apel - 10.8_p20190407
Ebuild name:

app-emacs/apel-10.8_p20190407

Description

A Portable Emacs Library is a library for making portable Emacs Lisp

Added to portage

2019-06-24

cudnn - 7.6.0.64
Ebuild name:

dev-libs/cudnn-7.6.0.64

Description

NVIDIA Accelerated Deep Learning on GPU library

Added to portage

2019-06-24

deutex - 5.2.0
Ebuild name:

games-util/deutex-5.2.0

Description

WAD composer for Doom, Heretic, Hexen, and Strife

Added to portage

2019-06-24

dotenv - 2.7.3
Ebuild name:

dev-ruby/dotenv-2.7.3

Description

Loads environment variables from .env into ENV

Added to portage

2019-06-24

dovecot - 2.3.6-r1
Ebuild name:

net-mail/dovecot-2.3.6-r1

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2019-06-24

exiv2 - 0.27.1-r1
Ebuild name:

media-gfx/exiv2-0.27.1-r1

Description

EXIF, IPTC and XMP metadata C++ library and command line utility

Added to portage

2019-06-24

flim - 1.14.9_p20190526
Ebuild name:

app-emacs/flim-1.14.9_p20190526

Description

A library to provide basic features about message representation or

Added to portage

2019-06-24

ftp - 0
Ebuild name:

acct-group/ftp-0

Description

File Transfer Protocol server user

Added to portage

2019-06-24

ftp - 0
Ebuild name:

acct-user/ftp-0

Description

File Transfer Protocol server user

Added to portage

2019-06-24

ftpbase - 0.01-r3
Ebuild name:

net-ftp/ftpbase-0.01-r3

Description

FTP layout package

Added to portage

2019-06-24

gcp - 0.2.1
Ebuild name:

sys-apps/gcp-0.2.1

Description

File copying utility with progress and I/O indicator

Added to portage

2019-06-24

giflib - 5.2.1
Ebuild name:

media-libs/giflib-5.2.1

Description

Library to handle, display and manipulate GIF images

Added to portage

2019-06-24

haproxy - 1.9.8
Ebuild name:

net-proxy/haproxy-1.9.8

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2019-06-24

hostapd - 2.8
Ebuild name:

net-wireless/hostapd-2.8

Description

IEEE 802.11 wireless LAN Host AP daemon

Added to portage

2019-06-24

iperf - 3.7
Ebuild name:

net-misc/iperf-3.7

Description

A TCP, UDP, and SCTP network bandwidth measurement tool

Added to portage

2019-06-24

kube-apiserver - 1.15.0
Ebuild name:

sys-cluster/kube-apiserver-1.15.0

Description

Kubernetes API server

Added to portage

2019-06-24

kube-controller-manager - 1.15.0
Ebuild name:

sys-cluster/kube-controller-manager-1.15.0

Description

Kubernetes Controller Manager

Added to portage

2019-06-24

kube-proxy - 1.15.0
Ebuild name:

sys-cluster/kube-proxy-1.15.0

Description

Kubernetes Proxy service

Added to portage

2019-06-24

kube-scheduler - 1.15.0
Ebuild name:

sys-cluster/kube-scheduler-1.15.0

Description

Kubernetes Scheduler

Added to portage

2019-06-24

kubeadm - 1.15.0
Ebuild name:

sys-cluster/kubeadm-1.15.0

Description

CLI to Easily bootstrap a secure Kubernetes cluster

Added to portage

2019-06-24

kubelet - 1.15.0
Ebuild name:

sys-cluster/kubelet-1.15.0

Description

Kubernetes Node Agent

Added to portage

2019-06-24

latexmk - 465
Ebuild name:

dev-tex/latexmk-465

Description

Perl script for automatically building LaTeX documents

Added to portage

2019-06-24

libinput - 1.13.3
Ebuild name:

dev-libs/libinput-1.13.3

Description

Library to handle input devices in Wayland

Added to portage

2019-06-24

liblockfile - 1.14-r1
Ebuild name:

net-libs/liblockfile-1.14-r1

Description

Implements functions designed to lock the standard mailboxes

Added to portage

2019-06-24

libssh2 - 1.9.0
Ebuild name:

net-libs/libssh2-1.9.0

Description

Library implementing the SSH2 protocol

Added to portage

2019-06-24

mail - 0
Ebuild name:

acct-group/mail-0

Description

Mail program group

Added to portage

2019-06-24

mail - 0
Ebuild name:

acct-user/mail-0

Description

Mail program user

Added to portage

2019-06-24

mailbase - 1.5-r1
Ebuild name:

net-mail/mailbase-1.5-r1

Description

MTA layout package

Added to portage

2019-06-24

mp3diags - 1.5.01
Ebuild name:

media-sound/mp3diags-1.5.01

Description

Qt-based MP3 diagnosis and repair tool

Added to portage

2019-06-24

mu-cite - 8.1_p201808232348
Ebuild name:

app-emacs/mu-cite-8.1_p201808232348

Description

Message citation utilities for emacsen

Added to portage

2019-06-24

numpy - 1.8.2
Ebuild name:

dev-python/numpy-1.8.2

Description

Fast array and numerical python library

Added to portage

2019-06-24

nvidia-cuda-toolkit - 10.1.168
Ebuild name:

dev-util/nvidia-cuda-toolkit-10.1.168

Description

NVIDIA CUDA Toolkit (compiler and friends)

Added to portage

2019-06-24

openfire - 4.2.3-r2
Ebuild name:

net-im/openfire-4.2.3-r2

Description

Added to portage

2019-06-24

postmaster - 0
Ebuild name:

acct-user/postmaster-0

Description

Postmaster user

Added to portage

2019-06-24

pulseeffects - 4.6.5
Ebuild name:

media-sound/pulseeffects-4.6.5

Description

Limiter, compressor, reverberation, equalizer auto volume effects fo

Added to portage

2019-06-24

repoman - 2.3.16
Ebuild name:

app-portage/repoman-2.3.16

Description

Repoman is a Quality Assurance tool for Gentoo ebuilds

Added to portage

2019-06-24

rgen - 0.8.4
Ebuild name:

dev-ruby/rgen-0.8.4

Description

Ruby Modelling and Generator Framework

Added to portage

2019-06-24

ruamel-std-pathlib - 0.6.4
Ebuild name:

dev-python/ruamel-std-pathlib-0.6.4

Description

Ruamel enhancements to pathlib and pathlib2

Added to portage

2019-06-24

ruamel-yaml - 0.15.97
Ebuild name:

dev-python/ruamel-yaml-0.15.97

Description

YAML parser/emitter that supports roundtrip comment preservation

Added to portage

2019-06-24

semi - 1.14.7_p20190517
Ebuild name:

app-emacs/semi-1.14.7_p20190517

Description

A library to provide MIME feature for GNU Emacs

Added to portage

2019-06-24

shadowsocks-libev - 3.3.0
Ebuild name:

net-proxy/shadowsocks-libev-3.3.0

Description

A lightweight secured SOCKS5 proxy for embedded devices and low e

Added to portage

2019-06-24

shutter - 0.94.3
Ebuild name:

x11-misc/shutter-0.94.3

Description

Feature-rich screenshot program

Added to portage

2019-06-24

skim - 0.6.8
Ebuild name:

app-misc/skim-0.6.8

Description

Command-line fuzzy finder

Added to portage

2019-06-24

texlive-latexextra - 2019-r2
Ebuild name:

dev-texlive/texlive-latexextra-2019-r2

Description

TeXLive LaTeX additional packages

Added to portage

2019-06-24

wanderlust - 2.15.9_p20190623
Ebuild name:

app-emacs/wanderlust-2.15.9_p20190623

Description

Yet Another Message Interface on Emacsen

Added to portage

2019-06-24

xchm - 1.30
Ebuild name:

app-text/xchm-1.30

Description

Utility for viewing Compiled HTML Help (CHM) files

Added to portage

2019-06-24

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2018 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 58.4 ms