Udev/ja

udev (user ) は systemd の Linux カーネルのためのデバイスマネージャです. ]] 内のデバイスノードを管理し、デバイスを追加または削除するときのユーザ空間での操作のすべてを取り扱います.

カーネル
には、以下のカーネルオプションが必要です:

USE フラグ
Portage は USE フラグを、他のパッケージの udev サポートを有効化するものであると認識しています. この USE フラグ値を USE フラグリストに追加すると (すべての Linux プロファイルでデフォルトです)、 パッケージを自動でインストールするでしょう:

Emerge
USE フラグを設定したら、システムを更新して変更を反映させましょう:

サービス
起動時に udev を始動させるには、 sysinit ランレベルに追加します. root 権限で以下のコマンドを実行すると可能です:

ルール
udev provides a set of rules that match against exported values of uevents (events sent by the kernel) and properties of the discovered device. A matching rule will possibly name and create a device node and run configured programs to setup and configure the device.

The rule definitions are stored in two locations:


 * 1)  - Rules in this directory are installed by certain packages, they generally should not be changed by users;
 * 2)  - This folder is for end-user specified rules. Any new rules should be added in this directory;

In these directories, multiple rule files (with suffix ) are traversed in alphanumerical order. Inside the rules files, udev will find expressions that might match a uevent together with the state to match (is the uevent because a device is added or removed) and the command to execute.

イベントマッチングは、次のような情報に基づいています:


 * The SUBSYSTEM of the uevent (for which type of device is the uevent fired);
 * The ACTION that is taken (add, change, or remove);
 * One or more attributes (through ATTR or ATTRS), such as the device class, vendor or other device information;
 * The kernel-provided name (through KERNEL), such as sd* (for SCSI/SATA disks) or input* (for input devices such as mice and keyboards);
 * One or more environment settings (through ENV), used to send information between multiple rules.

Based on this information, the rule can then state if:


 * 1) Some information needs to be shared with later events (through environment variables)
 * 2) Links need to be created in
 * 3) Commands need to be executed

Udev does this for every rule that matches (it does not stop after the first match) to allow a flexible device management approach.

恒久的なデバイス名
The kernel detects devices asynchronously, udev mirrors the kernel's sysfs filesystem and so the devices are named and numbered in order of detection. So by default udev provides no persistent device names. However there are mechanisms for some device classes to provide these:


 * Udev creates for storage devices additional symlinks based on the device's ID, label, UUID and path. See the directory. So instead of using e.g. the device file  use the file.


 * The same for input devices in the directory.


 * Using custom rules enables users to create their own device files.

使い方
便利なコマンドをいくつか挙げると:


 * 与えられたデバイスファイルについてのすべてのメッセージを表示します:




 * udev アクティビティを監視します:




 * Udev rules file example - assign a persistent name to an Ethernet device:




 * After changing a rules file in, either reboot or make udev reload them with:




 * For already added devices (plugged USB, etc.), the reloaded rules take effect either after changing the device (replugging USB, etc.) or by making udev request kernel events again via . Various event actions can be triggered. By default, the change event action is triggered:



さらなる情報は の man page を読んでください.

Log monitor messages
To log all message when is ran, modify the following configuration file:

It will create the new log file located at

デバッグモード
デバッグモードを有効にすると、詳細なメッセージをログに記録します:

ロギングの優先順位を設定します:

The log file will be created but no messages will be logged to it. The most recent versions of udev will log all messages to.

Missing device files and
Some udev versions need the and  files in order to work properly, but can not create them on their own. To manually create these files for udev run the following commands with root privileges:

NIC assigned eth0, but is moved to eth1
Those having dual network cards on their motherboards may run into a situation where may show no eth0 or eth1. may show their NIC detected as eth0, and later moved to eth1. Performing a will also show the NIC as eth1. This is caused by using the kernel assigned names in the first place. Users should write custom rules like to use free names like lan0 or wireless0 or use predictable interface names (which have been enabled by default since udev version 197).

Remember to also remove old files from old versions of udev:

Also make sure not to pass  on the kernel commandline. This setting would disable the predictable interface names feature of udev altogether.

外部の情報
- デフォルトの プロバイダが  に変わりました