Mdev

The aim of this page is to document how to replace udev in Linux with mdev, thus allowing a separate /usr partition, without an initramfs. The author uses Gentoo Linux with IceWM as the window manager. The instructions here should be applicable to other distros, assuming you can make the necessary changes.

Will mdev work on my system?
I run a simple Gentoo install, using IceWM, and no "desktop environment". An xorg.conf is not required on my system. Note that a "desktop environment" is not required to run Abiword, Firefox, Gimp, Gnumeric, etc. However, "Koffice apps" like Kmail seem to pull in most of KDE as a dependancy. In general, if you use KDE or GNOME lvm2, you may have problems, and may not be able to get by with mdev. One beta tester reports getting close with lvm2, but it's not there yet.

Note: recent versions of evdev and Chromium  require udev. They will not build without it.

There is one more sanity check that Gentoo users can run to check for udev dependancy. I don't think this can be duplicated in other distros.

Sanity check
To, add the line

Execute the two commands:

If the only errors you get are for not being able to re-install udev as required by, you can proceed to the next stage. Otherwise, might be an hard dependency of some package you requested.

ATI/AMD binary blobs
Some ATI/AMD Radeon cards require binary blobs. The Gentoo radeon-ucode ebuild pulls down 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, it loads automatically.

Warning / Disclaimer
This solution has not been tested enough, it may result in a not boot-able linux.

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

Once you've made the changes, rebuild the kernel. Do NOT reboot yet.

Emerging busybox
For our circumstance, you will need the mdev USE flag set for. The static USE flag is probably also a good idea. In the file, add the line:

Now, you may run

If you're using a distro other than Gentoo, or building Busybox manually, do whatever necessary in your situation to enable the mdev option.

Mounting devpts
As of approximately kernel 3.5.7, devpts has to be included in with the following parameters:

devpts exhibits non-standard behaviour. It does not automount, at bootup, or with mount -a. An explicit mount devpts command is required. The standard solution for udev-based systems is to run rc-update add udev-mount sysinit 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 mount devpts in a shell script in In this example, the file will be named

Another side-effect of not using udev-mount is that /dev/shm is only writeable by root. The command chmod 1777 /dev/shm is required to restore the standard behaviour. This command will also be run from a script at startup.

Notes regarding scripts used in
 * the files must be executable
 * they must have the extension ".start" on order to run at startup
 * they must have the extension ".stop" on order to run at stop

Creating /sbin/linuxrc
You will need to contain at least:

This should be enough for most users. If you have an unusual setup, you may need to place additional steps in your. Remember to run chmod 744 /sbin/linuxrc to make the file executable.

Configure the bootloader
Append init=/sbin/linuxrc to your kernel command line. If you use lilo, remember to re-run lilo to implement the changes. If you use a different bootloader, apply any necessary equivalent steps.

Replace the udev service
Remove udev from the services list, replacing it with mdev:

Reboot
Reboot to your new kernel. Your system should now be running using mdev.

Cleanup
Remove udev from your system by running emerge --unmerge sys-fs/udev. In the, append the line sys-fs/udev. Create if it doesn't already exist.

You should now have a completely udev-free machine.

Rebuild the kernel
For libusb (and hence CUPS) to see the USB ports, set CONFIG_USB_DEVICE_CLASS=y and CONFIG_USB_DEVICEFS=y in your kernel configuration. You will also need to enable CONFIG_USB_PRINTER, despite the injunction in the cups-1.5.2 ebuild to disable it. If you use make menuconfig, these items are found here:

(Don't worry about the "DEPRECATED"s.)

Verify the presence of the new device nodes
You should see a hierarchy of device nodes under /dev/bus/usb/. If you switch on your printer, you will probably see a node for it at /dev/lp0. You should be able to run lsusb successfully, and this should display your printer's details.

Configure your printer in CUPS
You should now be able to configure CUPS in the usual way. CUPS should find your printer, and will give it a URI something like parallel:/dev/lp0.

External resources

 * mdev like a boss by Funtoo's Slashbeast