Linux 101 : UDEV, the device manager



The udev software handles the the naming and the configuration of devices on Linux systems.

Udev is managed by systemd. It also handles loadable modules for hardware devices. 

The configuration files for udev are called rules and they live in the "/etc/udev/rules.d" directory.

We could for example order the system to run a specific utility or create a symbolic links when a device is plugged using these rules.

The rules could live in different directories, but the "/etc/udev/rules.d" directory takes precedence over the other locations such as the "/usr/lib/udev/rules.d" directory.

For example rules in the "40-mouse.rules" file in "/etc/udev/rules.d" will take precedence over the default "40-mouse.rules" file in "/usr/lib/udev/rules.d".

We could also find rules in "/run/udev/rules.d" that are generated on each boot - we find there temporary rules that won't survive a reboot -.

To manage udev, we could use a utility program called "udevadm".
For example, we could use it to get information about the "/dev/sdb" drive using the below command:


The information include the device's vendor ID, product ID, model, major and minor numbers, ...

We could also monitor all the udev events using the below command:

Comments

Leave as a comment:

Archive