Disaggregate

Disaggregate Technical Web Log

Technical information and commentary on a variety of topics.
Category: General Technology

December 01, 2005

Migration from devfs to udev

I recently migrated from devfs to udev; although many users simply make the transition without any problems, I could't boot up without using devfs. Here's a mini "how to" that explains how to fix the basic migration from devfs to udev if you find that you can't boot.

Here's a summary of the problem I encountered and how I resolved it.

Problem: as I booted up, I got the usual deluge of reports; then I got three error messages:

/sbin/init: 432 cannot create /dev/null
/sbin/init: 433 cannot open dev/console
Kernel panic -- not syncing: Attempted to kill init!

After a bit of research and some asking around, I found that the answer was as follows.

There's a difference between devfs and udev. Devfs makes the
"console" and "null" files available by the time the files are needed
during the boot. udev starts later in the boot cycle, so you must supply your own copy of /dev/console and /dev/null. (There's a facility in udev that's supposed to create these files in advance (/etc/udev/links.conf in the Debian package), but it didn't work in my case.)

Therefore, before trying to boot using udev only, make certain you have a "console" and "null" file in /dev. Of course, if your system is running, you have these files now -- but the question is, were they part of the /dev directory, or did devfs put it there? Here's how to check.

* First, mount the root directory someplace other than /, so that the /dev
directory can be examined as a standalone -- so it can be seen as it looks without stuff that devfs puts there. As root, issue the command:

# mount -o bind / /mnt

(where /mnt is some random mouting point).


* Next, look at /mnt/dev. You need to have two special files there, console and null:

crw------- root root 5, 1 Nov 28 16:50 console
crw-rw-rw- root root 1, 3 Nov 28 16:51 null

If you have them already, you're all set. On my system, I had "null" and it was *not* a "c" (special character) file; it was an ordinary file. I got rid of that file and issued the following commands to create console and null:


# mknod -m 660 console c 5 1
# mknod -m 660 null c 1 3


* Unmount the / file system:

# umount /mnt.

* Make certain you have udev! Linux 2.6.14-2 requires udev to boot, but you are responsible for actually installing udev.

* Once /dev/console and /dev/null exist, you can boot using udev only. (For example, on my system, a boot using udev only is done by removing the "devfs=mount" command from lilo.) There's other stuff to do to convert completely to udev, but this gets you started.

Posted by Moshe Yudkowsky at December 1, 2005 06:54 AM