Mdev/ja

The aim of this page is to document how to replace udev in Linux with mdev, thus allowing a separate partition, without an initramfs. The author uses Gentoo Linux with IceWM as the window manager. The instructions here should be, with some small adjustments, applicable to other distributions.

Will mdev work on my system?
The application is definitely suitable as long as the system does not use a full-fledged desktop environment. Note that a desktop environment is not required to run AbiWord, Firefox, GIMP, Gnumeric, etc. However, KOffice applications like KMail seem to pull in most of KDE as a dependency. In general, when using KDE or GNOME, is not suitable. Also using LVM might be troublesome.

デフォルトのGentooプロファイルを使用している場合、それは非常によく動作します:


 * default/linux/x86/13.0
 * default/linux/amd64/13.0

List the currently used profile by using following command:

There is one more sanity check that Gentoo users can run to check for udev dependency.

Sanity check
Get a general overview which packages might depend on udev. The output could look similar to the one shown below:

Add the following line to the file (which can be created if it does not exist yet):

Disable the  USE flag globally in :

Rebuild all packages with the new  USE flag

If the only error that comes up is that Portage is not able to re-install udev as required by, proceed to the next stage. Otherwise, might be an hard dependency of one or more packages installed on the system.

ATI/AMD binary blobs
Some ATI/AMD Radeon cards require binary blobs. The Gentoo package pulls in all the binary blobs available at http://people.freedesktop.org/~ag5f/radeon_ucode/ to support many different models.

With all the binary blobs in the library directory, the kernel needs udev to figure out which one of the many binary blobs to load. If all but one of the binary blobs are removed, leaving only the correct one in the library directory, the binary blob is loaded automatically.

Setting up the kernel for devtmpfs
Set up the kernel to support and automount a devtmpfs filesystem at :

Once the changes have been made, rebuild the kernel. Do NOT reboot yet.

Emerging busybox
Make sure that the  USE flag is set for. The  USE flag is probably also a good idea. In the file, add the follwoing line:

Now, (re)install busybox:

Mounting devpts
The devpts filesystem exhibits non-standard behavior. It does not automount, at bootup, or with. An explicit command is required. The standard solution for udev-based systems is to run as root, and have the udev-mount script do the mounting at startup. An mdev-based system will probably not have udev installed. An alternative way to do this at bootup is to include the command in a shell script in. In this example, the file will be named

Another side-effect of not using udev-mount is that is only writable by root. The command is required to restore the standard behavior. This command will also be run from the script at startup.

Replace the udev service
Remove udev from the services list and replace it with mdev:

Reboot
Reboot to the new kernel. The system should now be running using mdev.

Cleanup
Remove udev from the system:

In the file (or a file in this directory), add.

This now results in a completely udev-free machine.

Rebuild the kernel
For libusb (and hence CUPS) to see the USB ports, set  and   in the kernel configuration. Also enable, despite the injunction in the cups-1.5.2 ebuild to disable it. When using, these items are found here:

Verify the presence of the new device nodes
A hierarchy of device nodes should be present under. When switching on the printer, a node for it should occur at. should run successfully, and this should display the printer's details.

Configure the printer in CUPS
Configure CUPS in the usual way. CUPS should find the printer, and will give it a URI like.

Linux modules missing at boot sequence
If Linux modules are required and not loaded on boot after migration, execute one or more of the following solutions:


 * Add Linux modules to


 * Compile modules into the Linux kernel, without the need of loading them on demand.


 * Write a custom module loader:

Install it as the hotplug handler instead of mdev. Note that the earlier this gets executed, the better. Consider naming this script, since that is the default value of (or change the default value in the kernel configuration).

Miscellaneous

 * mdev unlike udev does not support auto-modules loading. Use and put all the modules there that should be loaded (nvidia, wl, etc.). Also,  have their own   variables as it does not support . It might be necessary to move the module configuration to this location.


 * does not create nodes. Either manually create them or use  from lvm2. It is a good idea to add it after  in the init script.


 * Use mouse and keyboard drivers for xorg inputs. Evdev needs udev to be built. Mousedrv (for the mouse driver) may conflict with the synaptics driver when both are loaded.


 * The Kernel configuration option CONFIG_INPUT_EVDEV not only provides the keyboard and mouse as input device events, it will provide lid and button events to acpid as well.

External resources

 * mdev like a boss project.