# Migrating to udev

## jumpula

This may be a faq, but I'll post it anyway.

Emerged udev necessities

```
emerge udev hotplug coldplug
```

Added them to boot runlevel

```
rc-update add hotplug boot

rc-update add coldplug boot

rc-update del hotplug default

```

Compiled the 2.6.13-ck7 kernel with options

```
CONFIG_PROC_FS=y

CONFIG_TMPFS=y

CONFIG=HOTPLUG=y

```

Did an entry for it in the Grub with

```
gentoo=nodevfs
```

Have up-to-date baselayout with following entries in /etc/conf.d/rc

```
RC_DEVICE_TARBALL="yes"

RC_DEVFSD_STARTUP="no"
```

And when I try to boot the udev kernel, it tries to create nodes for /dev/hdaX, fails and panics.

What did I forget?

----------

## frostschutz

Provided that devfs is no longer included in the kernel, nothing. I don't have a gentoo=nodevfs or whatever in my grub.conf, where did you get that from?

----------

## jumpula

There were a couple of guides suggesting that... one was http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html.

I have gentoo=noudev on my current kernel with normal dev.

Perhaps the problem is elsewhere on my newly compiled kernel?

----------

## frostschutz

No idea. Can you post the exact error messages you are getting?

----------

## jumpula

```
Creating block devices

Failed to create /dev/hda

Failed to create /dev/hda1

Failed to create /dev/hda2

Failed to create /dev/hda3

Failed to create /dev/hda4

Failed to create /dev/hda5

Creating root device

mkrootdev: mknod failed: 30

Mounting root filesystem

mount: error 2 mounting ext3

pivotroot: pivot_root (/sysroot,/sysroot/initrd) failed: 2

umount: /initrd/proc failed: 2

Kernel panic - not syncing: Attempted to kill init
```

Still longing for /dev? But how or why, that's beyond to me...

----------

## widan

```
mkrootdev: mknod failed: 30
```

Errno 30 is EROFS (Read-only filesystem). Are there any other errors before (like failing to (re)mount something, ...) ? Also, if you have "ro" in the kernel command line in grub, try to change that to "rw".

----------

## jumpula

No ro options there. It's identical to my current configuration, with the exception of nodevfs and noudev.

However, now that I checked, the root parameter still points to /dev. Should this be changed to the udev counterpart, and if it should what is it?

```
root=/dev/ram0
```

----------

## jumpula

Ok, additional questions.

When using udev, should I use udev counterparts of the devices specified at grub.conf? Logic suggests that the answer would be yes.

```
kernel /boot/kernel-2.6.10 root=/dev/ram0 real_root=/dev/hda3 init=linuxrc vga=1 gentoo=noudev

kernel /boot/kernel-2.6.13-ck7 root=/dev/rd/0 real_root=/dev/discs/disc0/part3 init=linuxrc vga=1 gentoo=nodevfs
```

The first is my working kernel and the second is the unbootable kernel with udev support. Is this correct?

Could this be a problem with my initrd or kernel configuration? My root partition has ext3fs. I have compiled the kernel with options CONFIG_EXT2_FS=y, CONFIG_EXT3_FS=y, CONFIG_PROC_FS=y, CONFIG_BLK_DEV_RAM=y and CONFIG_BLK_DEV_INITRD=y.

So, to my knowledge, nothing should be missing when creating initrd from modules.conf since the required modules are built-in...

----------

## jumpula

Oh, and removing the gentoo=nodevfs doesn't help. Still won't boot.

----------

## jumpula

Furthermore, the error changed slightly when switched to udev counterparts in grub. Now the block devices give no error, but mounting root partition fails.

```
Mounting root filesystem

mount: error 6 mounting ext3

pivotroot: pivot_root (/sysroot,/sysroot/initrd) failed: 2

umount /initrd/proc failed: 2

Freeing unused kernel memory: 156k freed

RedHat Nash version 3.5.7 starting

Mounting /proc filesystem

mount: error 16 mounting proc

Creating block devices

Creating root device

mkrootdev: mknod failed 17

Mounting root filesystem

mount: error 6 mounting ext3

pivotroot: pivot_root (/sysroot,/sysroot/initrd) failed: 2

umount /initrd/proc failed: 2

Kernel panic - not syncing: Attempted to kill init!
```

----------

## frostschutz

 *jumpula wrote:*   

> When using udev, should I use udev counterparts of the devices specified at grub.conf?

 

Hmmm. udev is a user-space application, that means it's not included in the kernel (the kernel just provides an interface), but rather the program itself as well as it's configuration files are on disk. I think that means it can be used only after the disk was actually mounted.

----------

## chunderbunny

Do you have to following line in your /etc/fstab ?

```
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
```

 You will also need SHM support in our kernel IIRC.

----------

## jumpula

The root partition never gets mounted. It really makes no difference wheter I have tmpfs in my fstab or not  :Sad: 

Kernel was compiled with CONFIG_TMPFS=y.

Wonder if it is a case with SATA. If the SATA drives get the priority in numbering /dev/discs/discX, I'm trying to mount the wrong volume? Perhaps I should try guessing another numbers in grub...

But the SATA support is compiled as a module, so it shouldn't be that either...

----------

## jumpula

The problem is initrd. Don't know why, but getting rid of that allowed the kernel to boot.

Very strange. If someone knows why, I would be happy to know  :Smile: 

The initrd was created with

```
mkinitrd initrd-2.6.13-ck7 2.6.13-ck7
```

after the kernel was built.

----------

