From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Eudev and the translation is 51% complete.

Other languages:
English • ‎español • ‎日本語 • ‎polski • ‎русский • ‎中文(中国大陆)‎

Warning: Display title "eudev/ja" overrides earlier display title "Eudev".


For configurations not using systemd, eudev is Gentoo's device file manager for the Linux kernel.[1] It manages device nodes in /dev and handles all user space actions when adding or removing devices. It is a fork of systemd's udev with the goal of obtaining better compatibility with existing software such as OpenRC, Upstart, older kernels, various toolchains, and anything else required[2] by (but not well supported through) udev. Configurations utilizing systemd should not use it.

/dev ディレクトリ

多くの Linux ユーザは、/dev/sda1 はカーネルが認識した最初のディスクの最初のパーティションを指す最短の手段だということを知っています。これはとても平易でしょう。

But consider hotpluggable devices like USB, IEEE1394, hot-swappable PCI, etc. What is the first device for each of these? 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 if a printing job were suddenly moved from a high-end laser printer to an almost-dead matrix printer just because someone's mom decided to pull the plug on the laser printer (which just happened to be the first printer)?

デバイスマネージャに入ってみましょう。( udeveudev のような)今どきのデバイスマネージャならば必ず:

  • ユーザスペースで動作する;
  • 動的にデバイスファイルが生成されたり削除されたりする;
  • 一貫したデバイス命名を行う;
  • ユーザスペースのアプリケーション・プログラム・インターフェイス(API)を提供する

Every time a change happens within the device structure, the kernel emits a uevent which gets picked up by the device manager. The device manager then follows the rules declared in the /etc/udev/rules.d, /run/udev/rules.d and /lib/udev/rules.d directories. Based on the information contained within the uevent, it finds the rule or rules it needs to trigger and performs the required actions. These actions may involve the creation or deletion of device files, and may also trigger the loading of particular firmware files into kernel memory.


USE フラグ

Some packages know the udev USE flag for enabling virtual/udev integration.

USE flags for sys-fs/eudev Linux dynamic and persistent device naming support (aka userspace devfs)

hwdb read vendor/device string database and add it to udev database local
introspection Add support for GObject based introspection global
kmod enable module loading through libkmod local
rule-generator install legacy rule generator rules and support scripts - note that the functionality within was dropped from sys-fs/udev as it is not stable in all cases; use at your own risk local
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur global


To avoid registration in the world set, the oneshot option should be used.

root #emerge --ask --oneshot sys-fs/eudev


RC サービス

The RC name is udev, not eudev. It needs to be registered in the sysinit runlevel.

root #rc-update add udev sysinit
 * rc-update: udev already installed in runlevel `sysinit'; skipping

From sys-fs/udev-init-scripts version 29 onward, udev-trigger should also be added to the sysinit runlevel.

Migrating from udev to eudev

Migrating from udev 216 to eudev 1.10-r2 (March 2015) is straight forward:

root #emerge --ask --oneshot sys-fs/eudev

In case the system uses multilib and, for example, has the abi_x86_32 USE flag active against the older udev package, then don't forget to change it too:

FILE /etc/portage/package.useSwitching udev to eudev in package.use
# sys-fs/udev abi_x86_32
sys-fs/eudev abi_x86_32

Keep classic 'eth0' naming

起動時にカーネルが作成する eth0eth1 のようなネットワークデバイス名(dmesg 参照)は、/lib/udev/rules.d/80-net-name-slot.rules での udev ルールを用いて変更可能です。

旧来の命名ルールを維持するには、/etc/udev/rules.d ディレクトリ内に、同じ名称のファイルを空で作成することで上書きします:

root #touch /etc/udev/rules.d/80-net-name-slot.rules

Alternatively add net.ifnames=0 to the kernel command line, change the default policy or create a custom one.

An interesting resource related to the network naming is I don't like this, how do I disable this on the Freedesktop wiki.

Use new 'predictable' naming

The new network interface naming convention is not the same so interfaces will need to be re-linked. Use /etc/init.d/net.lo as a link target for whatever interface names need to be added. Be sure to replace <interface_name> in the commands below with the Ethernet interface names present on the system. It is possible to discover which interfaces exist by running the ifconfig command:

user $ifconfig

Create symbolic links for the existing interfaces in the /etc/init.d/ and /etc/conf.d/ directories:

root #ln -s /etc/init.d/net.lo /etc/init.d/net.<interface_name>
root #ln -s /etc/conf.d/net.lo /etc/conf.d/net.<interface_name>

Add the script(s) to the default runlevel to have the interface(s) start automatically:

root #rc-update add net.<interface_name> default


udevadm の使用

udevadm monitor 実行してみましょう:

user $udevadm monitor

Get device info using udevadm info followed by the device path:

user $udevadm info -p /devices/pci0000:00/0000:00:1d.7

Get the device path using its name:

user $udevadm info -q path -n input/mouse1

Test an event run using udevadm test followed by the device path for which an event is to be tested:

user $udevadm test /devices/pci0000:00/0000:00:1d.7

To get a list of all udevadm commands:

user $udevadm -h

Migrating older releases

udev 171-r10 to eudev 1.2-r1

See this post on the Gentoo forums.

Broken system switching from udev to eudev

See this post on the Gentoo forums.




  1. Bug 575718 - Request for council decision RE virtual/udev default provider, Gentoo's Bugzilla Main Page, (Last modified) February 27th, 2016. Retrieved on March 1st, 2016.
  2. Project:Eudev, Gentoo Wiki, (Last modified) November 12th, 2015. Retrieved on March 11th, 2016.