# [solved] udev doesn't create nodes in /dev

## ShinyDoofy

Hi,

udev-198-r1 doesn't seem to create devices nodes under /dev for me. For example, when I plug in a USB drive, I see my kernel naming it sdh with two partitions, sdh1 and sdh2:

```
[ 2186.052649] usb 2-4.1: new high-speed USB device number 11 using ehci_hcd

[ 2186.127928] usb 2-4.1: New USB device found, idVendor=14cd, idProduct=125a

[ 2186.127932] usb 2-4.1: New USB device strings: Mfr=1, Product=3, SerialNumber=2

[ 2186.127935] usb 2-4.1: Product: Mass Storage Device

[ 2186.127937] usb 2-4.1: Manufacturer: Generic

[ 2186.127939] usb 2-4.1: SerialNumber: 812520090519

[ 2186.128262] scsi15 : usb-storage 2-4.1:1.0

[ 2187.129192] scsi 15:0:0:0: Direct-Access     USB Mass Storage Device        PQ: 0 ANSI: 0 CCS

[ 2187.129418] sd 15:0:0:0: Attached scsi generic sg9 type 0

[ 2187.130692] sd 15:0:0:0: [sdh] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)

[ 2187.131273] sd 15:0:0:0: [sdh] Write Protect is off

[ 2187.131277] sd 15:0:0:0: [sdh] Mode Sense: 03 00 00 00

[ 2187.131803] sd 15:0:0:0: [sdh] No Caching mode page present

[ 2187.131807] sd 15:0:0:0: [sdh] Assuming drive cache: write through

[ 2187.134498] sd 15:0:0:0: [sdh] No Caching mode page present

[ 2187.134501] sd 15:0:0:0: [sdh] Assuming drive cache: write through

[ 2187.135745]  sdh: sdh1 sdh2

[ 2187.138000] sd 15:0:0:0: [sdh] No Caching mode page present

[ 2187.138002] sd 15:0:0:0: [sdh] Assuming drive cache: write through

[ 2187.138004] sd 15:0:0:0: [sdh] Attached SCSI removable disk
```

However, this node is not created under /dev:

```
# ls -lah /dev/sdh*

ls: cannot access /dev/sdh*: No such file or directory

#
```

Running udevadm monitor, I see udev toying around in /sys, but not in /dev:

```
# udevadm monitor

monitor will print the received events for:

UDEV - the event which udev sends out after rule processing

KERNEL - the kernel uevent

KERNEL[2189.565965] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1 (usb)

KERNEL[2189.565985] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0 (usb)

KERNEL[2189.566173] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15 (scsi)

KERNEL[2189.566192] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/scsi_host/host15 (scsi_host)

UDEV  [2189.566480] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1 (usb)

UDEV  [2189.566773] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0 (usb)

UDEV  [2189.566839] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15 (scsi)

UDEV  [2189.566938] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/scsi_host/host15 (scsi_host)

KERNEL[2190.568808] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0 (scsi)

KERNEL[2190.568828] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0 (scsi)

KERNEL[2190.568837] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_disk/15:0:0:0 (scsi_disk)

KERNEL[2190.568843] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_device/15:0:0:0 (scsi_device)

KERNEL[2190.568954] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_generic/sg9 (scsi_generic)

UDEV  [2190.568968] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0 (scsi)

KERNEL[2190.568979] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/bsg/15:0:0:0 (bsg)

UDEV  [2190.569129] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0 (scsi)

UDEV  [2190.569275] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_disk/15:0:0:0 (scsi_disk)

UDEV  [2190.569505] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_device/15:0:0:0 (scsi_device)

UDEV  [2190.569703] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/bsg/15:0:0:0 (bsg)

UDEV  [2190.570042] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_generic/sg9 (scsi_generic)

KERNEL[2190.571350] add      /devices/virtual/bdi/8:112 (bdi)

UDEV  [2190.571543] add      /devices/virtual/bdi/8:112 (bdi)

KERNEL[2190.575703] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh (block)

KERNEL[2190.575717] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh/sdh1 (block)

KERNEL[2190.575727] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh/sdh2 (block)

UDEV  [2190.576354] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh (block)

UDEV  [2190.576786] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh/sdh2 (block)

UDEV  [2190.576805] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.1/2-4.1:1.0/host15/target15:0:0/15:0:0:0/block/sdh/sdh1 (block)
```

Currently, the only way for me to access this drive is to make my own nodes using /proc/partitions and mknod. Creating these nodes by hand is irritating and feels unnecessary, udev won't even remove the handmade nodes after I unplug the drive.

Possibly on a related note, plugging in a USB headset I don't see any new sound device in alsamixer/KMix - shouldn't udev be in charge of that as well? I do know that it used to work just fine a few weeks back in late January or so. I may have had anything udev >171 blocked due to similar issues I had in December, I can't say for sure anymore. As I don't have the headset with me atm, I can't reproduce this case, but rather just plug in/pull out USB drives.

I'm using an initramfs to setup my software RAID and decrypt my hard drives. Vanilla Kernel 3.5.0, ~amd64 system. Other than that, /usr is not on a different partition.

Can anybody point me in the right direction with this? Is there any vital information missing? Clearly, something's not right.

//As can be read a few posts down, my initramfs missed a single umount line.Last edited by ShinyDoofy on Tue Mar 19, 2013 10:29 pm; edited 1 time in total

----------

## SamuliSuominen

Is /dev mounted correctly as filesystem "devtmpfs"?

$ zgrep DEVTMPFS /proc/config.gz 

CONFIG_DEVTMPFS=y

$ grep devtmpfs /proc/mounts 

devtmpfs /dev devtmpfs rw,relatime,size=8197092k,nr_inodes=2049273,mode=755 0 0

I guess so, since this is made clear in the postinst message of udev's emerge, just verifying

----------

## ShinyDoofy

Thank you for your quick response!

About your questions:

```
# zgrep DEVTMPFS /proc/config.gz 

CONFIG_DEVTMPFS=y

# CONFIG_DEVTMPFS_MOUNT is not set

# grep devtmpfs /proc/mounts 

none /dev devtmpfs rw,relatime,size=12341368k,nr_inodes=3085342,mode=755 0 0

# rc-update show | grep udev

                 udev |                                        sysinit

           udev-mount |                                        sysinit
```

I rm -rf'ed /etc/udev and /lib/udev prior to re-emerging it and rebooting, so I should be on a pretty standard config. I even went through all kernel options in /usr/share/doc/udev-198-r1/README.bz2 - everything's fine (except for the systemd/UEFI stuff, I'm on OpenRC and a standard BIOS). I didn't get a postint message for wrong paths/kernel options and my systems boots up flawlessly without any errors or warnings.

If you have any other ideas, please let me know.

----------

## ShinyDoofy

Sorry to bump so quickly, but I believe I have found something that might help in tracking this down a bit:

When I activate CONFIG_DEVTMPFS_MOUNT as well, all hell breaks loose during boot: ALSA doesn't detect any sound cards and there are a few messages about something being off about /dev and advising me to check dmesg | tail.

However, I noticed that /dev wasn't mounted anymore upon boot in either cases (_MOUNT on or off). Mounting it before booting kdm and thus my regular KDE session, I could finally see the appropriate nodes in /dev on my beloved tty1; no leftover sdi and sdj nodes, just those up to sde. However, the nVidia drivers complained about not finding /dev/fd/62 when reinstalling the module. Booting into KDE, I couldn't open a terminal via Konsole, it was nothing but a cursor, no shell, no nothing.

Now if I don't mount /dev after booting, I have the usual crapton of sd* nodes in /dev, including the dead ones I created myself back in December. I tried toying around with fstab about mounting /dev, but it only got more frustrating (more error messages I can't seem to reproduce anymore). The wiki states that /dev lines should use tmpfs if there are any. So am I correct that I only need any at all, not even the /dev/shm one?

Frankly, it's too late for me to continue playing around with the fstab for this evening. Is anybody able to tell me why /dev isn't automatically mounted on boot? Or why the manually mounted devtmpfs at /dev misses the /dev/fd symlink to /proc/self/fd? I'm tired of constantly rebooting.

----------

## SamuliSuominen

 *ShinyDoofy wrote:*   

> Now if I don't mount /dev after booting, I have the usual crapton of sd* nodes in /dev, including the dead ones I created myself back in December. I tried toying around with fstab about mounting /dev, but it only got more frustrating (more error messages I can't seem to reproduce anymore). The wiki states that /dev lines should use tmpfs if there are any. So am I correct that I only need any at all, not even the /dev/shm one?

 

The wiki doesn't say it has to be tmpfs, but devtmpfs. Might only be a typing error in your forums post, but wanted to point it out.

And you are correct, you don't need a line for /dev or /dev/shm in /etc/fstab at all, those are both automounted without fstab entry. In fact, fstab entry will most likely break

either the default options or the correct mount order. I've seen old documentation and howto's where they say to add these entries, but they are what they are, old docs.

----------

## ShinyDoofy

Heh, that might have something to do with it. I still had a line for /dev/shm to be mounted as tmpfs. I will see how things turn out this evening. After all, this is a rather old installation from early 2008.

----------

## SamuliSuominen

 *ShinyDoofy wrote:*   

> Heh, that might have something to do with it. I still had a line for /dev/shm to be mounted as tmpfs. I will see how things turn out this evening. After all, this is a rather old installation from early 2008.

 

The another problem I've seen is people grepping /usr/src/linux/.config for DEVTMPFS=y and then genkernel picking up the kernel config from other location. I don't use genkernel,

but something have changed recently.

The way to ensure this won't hit you, is to enable the CONFIG_IKCONFIG_PROC=y option to get /proc/config.gz and:

```

$ zgrep DEVTMPFS /proc/config.gz 

CONFIG_DEVTMPFS=y

CONFIG_DEVTMPFS_MOUNT=y

```

And one more case I've seen something like this happen is people using USE="-*" which disabled USE="openrc" for sys-fs/udev and left sys-fs/udev-init-scripts uninstalled, thus both 'udev' and 'udev-mount' out from runlevels...

Good luck.

----------

## SamuliSuominen

One more thing came into mind. Do you have rc_coldplug="NO" in /etc/conf.d/udev? If so, then use rc_coldplug="YES" at least for now, wait at least until udev-init-scripts-25 is out before using "NO".

----------

## ShinyDoofy

Once more, thank you very much on trying to fix this!  :Smile: 

Unfortunately, it's not fixed yet. I dropped the fstab lines (now it only contains lines for /, /home, /mnt/cdrom and my tmpfs for /var/tmp/portage (yeah, I also tried dropping the latter, but that didn't change things)) and yet still do have to mount /dev manually and even then I'm out one /dev/fd -> /proc/self/fd...

About your remarks: I use a vanilla kernel, no genkernel. I do grep /proc/config.gz and have set rc_coldplug to NO (was commented out before). Still no proper /dev after boot (no matter if I set CONFIG_DEVTMPFS_MOUNT and boot with devtmpfs.mount=1 or 0).

Is there anything worth keeping track of when using /dev in an initramfs? I'll edit in my init script in a bit, posting this from my phone in front of tty1...

/edit: Still can't get a terminal open with Konsole although I created the fd symlink myself. And another reboot...

/edit2:

```
# cat init 

#!/bin/sh

mount -t proc none /proc

mount -t devtmpfs none /dev

CMDLINE=`cat /proc/cmdline`

mount -t sysfs none /sys

mdadm --assemble --scan /dev/md1

# cryptsetup for /

# cryptsetup for /home

mount -r /dev/mapper/root /newroot

umount /sys

umount /proc

exec /bin/busybox switch_root /newroot /sbin/init ${CMDLINE}
```

Although it's not 100% the same as the one in the wiki about early userspace mounting, the very gist should be the same. Are there perhaps any debug logs I can provide you with? I'm almost certain it's something painfully trivial...

/edit3: I've noticed that when booting with devtmpfs.mount=1, I do have /dev mounted as devtmpfs... However, I still have the /dev/sdh, sdi, sdj etc nodes. This is only fixed by mounting another devtmpfs in /dev, which in turn makes me lose the fd symlink and the ability to run Konsole.

/edit4: Oh my. I added umount /dev and through the wonders of magic, everything turned out to work perfectly. Automounted /dev, /dev/fd symlink, Konsole working, just the right nodes for my disk parade (dynamically added and removed as I plug in multiple flash drives) and /dev/snd nodes with properly ACL. Sorry it had to come to this. As anticipated, it was something numbingly trivial. Thank you, nonetheless, for the pointer and insights!

----------

