# udev problem

## Roar

Hello!

I have a problem with udev.

When I insert an usb-stick or a digital camera the device node /dev/sd?1 (normally /dev/sdd1) is not created so i can't access the usb-stick/camera.

I just have found a manual solution: stopping udev, inserting usb-device, starting udev:

udev stop

<plug hardware in usb slot>

udevstart

Then sometimes the device node /dev/sdd1 is created and i can mount the hardware.

I'm using gentoo-sources-2.6.14-r3 and udev-079

Anybody any hints?

----------

## Headrush

Is coldplug in your boot runlevel? 

```
rc-update add coldplug boot
```

Is hald in your default runlevel?

```
rc-update add hald default
```

Are there any messages in dmesg after you plug in the device?

----------

## Roar

Yes coldplug is in boot runlevel and hald is in default runlevel

dmesg contains some messages saying that the hardware is at sdd, but when  i try mounting this device node it doesn't exist?!?

----------

## Headrush

Can you list the modules loaded?

```
lsmod
```

----------

## Roar

Here my dmesg output:

usb 4-1: new full speed USB device using ohci_hcd and address 2

scsi1 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 2

usb-storage: waiting for device to settle before scanning

  Vendor: OLYMPUS   Model: C765UZ            Rev: 1.00

  Type:   Direct-Access                      ANSI SCSI revision: 02

SCSI device sdd: 1023120 512-byte hdwr sectors (524 MB)

sdd: Write Protect is off

sdd: Mode Sense: 18 00 00 08

sdd: assuming drive cache: write through

SCSI device sdd: 1023120 512-byte hdwr sectors (524 MB)

sdd: Write Protect is off

sdd: Mode Sense: 18 00 00 08

sdd: assuming drive cache: write through

 sdd: sdd1

Attached scsi removable disk sdd at scsi1, channel 0, id 0, lun 0

usb-storage: device scan complete

Here my lsmod:

Module                  Size  Used by

pcmcia                 40852  2

firmware_class         11136  1 pcmcia

nvidiafb               55196  0

i2c_algo_bit            9992  1 nvidiafb

yenta_socket           28172  2

rsrc_nonstatic         12544  1 yenta_socket

pcmcia_core            44304  3 pcmcia,yenta_socket,rsrc_nonstatic

i2c_sis96x              5636  0

sis_agp                 8964  1

rtc                    10004  0

nvidia               4090768  18

agpgart                36680  2 sis_agp,nvidia

r8180                  58764  0

ieee80211_r8180        35204  1 r8180

ieee80211_crypt_r8180     6276  1 ieee80211_r8180

ata_piix               10116  0

ahci                   12548  0

sata_qstor             10372  0

sata_vsc                8580  0

sata_uli                7424  0

sata_sis                8320  0

sata_sx4               14596  0

sata_nv                 9988  0

sata_via                9092  0

sata_svw                7940  0

sata_sil                9604  0

sata_promise           12164  0

libata                 51080  12 ata_piix,ahci,sata_qstor,sata_vsc,sata_uli,sata_sis,sata_sx4,sata_nv,sata_via,sata_svw,sata_sil,sata_promise

sbp2                   25604  0

ohci1394               36788  0

----------

## Roar

The problem i think is that udevd can't start for some reason:

>> Activating udev

>> Determining root device...

>> Mounting root...

>> Booting (initramfs)....umount: /dev: Device or resource busy

*: Failed to umount the initrd /dev!

..

INIT: version 2.86 booting

...

...

...

* Mounting proc at /proc ... [ok]

* Mounting sysfs at /sys ... [ok]

* Mounting /dev for udev ... [ok]

* Seeding /dev with needed nodes ... [ok]

* Setting up proper hotplug agent ...

* Setting /sbin/udevsend as hotplug agent ... [ok]

* Starting udevd ... [!!]

* Populating /dev with existing devices with udevstart ...

rm: unable to remove 'dev': device or resource busy [ok]

* Letting udev process events ... [ok]

* Finializing udev configuration ... [ok] 

But why?

----------

## Headrush

What baselayout are you using? I don't get any of those messges with baselayout-1.11.14.

----------

## Roar

I'm using udev-079 and baselayout-1.12.0_pre13 -r1

I have another computer with udev-077-r5 and same baselayout as above and here everything works perfect.

On the computer with actually udev-079 i also tried 077 and even earlier versions..always the same effect...

Are there eventually some kernel parameters?

I used the guide

http://www.gentoo.org/doc/en/udev-guide.xml

But i have nothing like

```
File systems --->

  Pseudo Filesystems --->

    [*] /dev file system support (OBSOLETE)

      [ ]   Automatically mount at boot
```

Perhaps because it's marked as obsolete and my kernel (a gentoo-sources 2.6.14-r3) doesn't support it anymore?

Or is it a problem with my grub config?

I have

```
kernel (hd0,0)/kernel-genkernel-x86-2.6.14-gentoo-r3 root=/dev/ram0 real_root=/dev/hda3 splash=silent,theme:GoGentooGo CONSOLE=/dev/tty1 quiet udev
```

in my grub.conf.

I just tried it with

```
kernel (hd0,0)/kernel-genkernel-x86-2.6.14-gentoo-r3 root=/dev/ram0 real_root=/dev/hda3 splash=silent,theme:GoGentooGo CONSOLE=/dev/tty1 quiet gentoo=nodevfs devfs=nomount
```

But this results always in the same problem

----------

## Headrush

Unless you absolutely must, I recommend not using packages marked ~arch, especially core things like baselayout.

Just because it appears to work on another system doesn't mean it will always work on all systems, hence part of the reason it still be marked ~arch.

I won't be much help since I don't know the changes in the upgraded baselayout introduces and my reference will be different from yours.

I would recommend completely removing anything to do with devfs from your system/kernel, it's not needed and although it should work, I wouldn't even try using it with the kernel command line option to turn it off, just remove it all.

Since you are using ~arch baselayout and udev, is it safe to assume you are running everything else ~arch also. (especially hotplug, hal, dbus, libsysfs, etc)

----------

## Roar

Some time ago I also thought that the unstable udev, baselayout and so on would cause this problem. So I deleted all those unstable versions and tried with the stable ones. But that didn't work, too. So i decided to stay in unstable tree and I think the problem must be somewhere else.

More concrete I think the problem is with initrd, as mentioned here:

http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html

 *Quote:*   

> Initrd Note: It would appear that if you want to use initrd , which I don't use, you do have to either use the tarball or Compile your kernel with Devfs support or you will get an error about 'devfs not mounting on /dev' . Doesn't mean you have to use it, just have it compiled in the kernel.

 

And this quote is only for older kernels (pre 2.6.13)

I don't know what to do...

----------

## Headrush

 *Roar wrote:*   

> Some time ago I also thought that the unstable udev, baselayout and so on would cause this problem. So I deleted all those unstable versions and tried with the stable ones. But that didn't work, too. So i decided to stay in unstable tree and I think the problem must be somewhere else.
> 
> More concrete I think the problem is with initrd, as mentioned here:
> 
> http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html
> ...

 

That's if using devfs I believe.

Like I mentioned, DON'T use it and stick with stable, it will be easier to fix.

If you leave your system as ~arch, even if we fix it, it is liable to break again with any update since you are saying yes to any ~arch version.

----------

## Roar

I just changed udev, baselayout, hal, dbus and ivman to the latest stable versions.

But it still doesn't work. I have the same messages while booting like before.

I went also through my kernel options and there's nothing activated that would be devfs...

My output from mount is:

```
/dev/hda3 on / type reiserfs (rw,noatime,notail)

udev on /dev type tmpfs (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

udev on /dev type tmpfs (rw,nosuid)

devpts on /dev/pts type devpts (rw)

cachedir on /lib/splash/cache type tmpfs (rw)

/dev/hda1 on /boot type ext2 (rw,noatime)

none on /dev/shm type tmpfs (rw)

usbfs on /proc/bus/usb type usbfs (rw,devmode=0664,devgid=85)

```

Perhaps there is something wrong?

----------

## Headrush

For starters, enable logging dor udev in /etc/udev/udev.conf

```
udev_log="yes"
```

Are you using genkernel to create your kernel and if so what command are you using?

There was a change awhile back in baselayout that you had to execute a couple BASH line to recreate /dev, do you every remember doing that? I'll search and see if I can find the code again.

Edit: What happens when you try starting udev from the commandline? 

```
udevstart
```

----------

## Roar

 *Quote:*   

> Are you using genkernel to create your kernel and if so what command are you using? 

 

Yes I'm using genkernel with following command:

```
genkernel --menuconfig --gensplash=GoGentooGo all
```

I know of the option --udev, but when I enter this option genkernel says that i don't have to enter this option because this option will be automatically enabled for newer genkernel versions.

 *Quote:*   

> There was a change awhile back in baselayout that you had to execute a couple BASH line to recreate /dev, do you every remember doing that? I'll search and see if I can find the code again. 

 

Well I never did something to recreate /dev and I never thought of this option because on another computer everything works fine.

 *Quote:*   

> What happens when you try starting udev from the commandline?
> 
> ```
> udevstart
> ```
> ...

 

After doing that everything works. That's for some time my manual solution for my problem. I do a

```
udev stop
```

Then i plug in my device. And after a

```
udevstart
```

everything works fine.

----------

## Headrush

What happens when you do udevstart, and then plug device in? (Don't do udevstop, attach, and then udevstart)

----------

## Roar

 *Quote:*   

> What happens when you do udevstart, and then plug device in? (Don't do udevstop, attach, and then udevstart)

 

Then the node /dev/sdd1 is created and i can mount my hardware. But when I remove the hardware, /dev/sdd1 resides where it is (shouldn't udev automatically remove it when there's no hardware?) and a udevstart doesn't change anything

----------

## Headrush

 *Roar wrote:*   

> But when I remove the hardware, /dev/sdd1 resides where it is (shouldn't udev automatically remove it when there's no hardware?) and a udevstart doesn't change anything

 

That's why I said to enable logging for udev. Then we can see if udev get the device removal message from hotplug.

----------

## Roar

And where can I find those log-files?

If there should be something in /var/log/messages, here is the output:

```
Jan  9 21:59:27 stefficl usb 3-1: new full speed USB device using ohci_hcd and address 4

Jan  9 21:59:27 stefficl scsi2 : SCSI emulation for USB Mass Storage devices

Jan  9 21:59:27 stefficl usb-storage: device found at 4

Jan  9 21:59:27 stefficl usb-storage: waiting for device to settle before scanning

Jan  9 21:59:32 stefficl Vendor: OLYMPUS   Model: IR-300            Rev: 1.00

Jan  9 21:59:32 stefficl Type:   Direct-Access                      ANSI SCSI revision: 02

Jan  9 21:59:32 stefficl SCSI device sdd: 32000 512-byte hdwr sectors (16 MB)

Jan  9 21:59:32 stefficl sdd: Write Protect is off

Jan  9 21:59:32 stefficl sdd: Mode Sense: 18 00 00 08

Jan  9 21:59:32 stefficl sdd: assuming drive cache: write through

Jan  9 21:59:32 stefficl SCSI device sdd: 32000 512-byte hdwr sectors (16 MB)

Jan  9 21:59:32 stefficl sdd: Write Protect is off

Jan  9 21:59:32 stefficl sdd: Mode Sense: 18 00 00 08

Jan  9 21:59:32 stefficl sdd: assuming drive cache: write through

Jan  9 21:59:32 stefficl sdd: sdd1

Jan  9 21:59:32 stefficl Attached scsi removable disk sdd at scsi2, channel 0, id 0, lun 0

Jan  9 21:59:32 stefficl usb-storage: device scan complete
```

----------

## Headrush

After restarting udev, 

```
tail /var/log/messages
```

You should see something like this on disconnect:

```
Jan  9 16:12:04 tux scsi.agent[13290]: disk at /devices/pci0000:00/0000:00:10.0/usb1/1-2/1-2:1.0/host5/target5:0:0/5:0:0:0
```

----------

## Roar

The only thing I see is:

```
Jan  9 22:20:22 stefficl usb 3-1: USB disconnect, address 5
```

Eventually something to mention:

I just typed "udev" in konsole and i got the following in /var/log/messages:

```
Jan  9 22:24:55 stefficl udev[22767]: main: action, subsystem or devpath missing
```

Is this normal?

----------

## Roar

When I start udevmonitor, plug in the camera and then remove the camera, this is what I get:

```
UEVENT[1137094751.982829] add@/devices/pci0000:00/0000:00:03.1/usb3/3-1

UEVENT[1137094751.985755] add@/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0

UEVENT[1137094752.274880] add@/class/scsi_host/host2

UEVENT[1137094752.276076] add@/class/usb_device/usbdev3.4

UEVENT[1137094757.280143] add@/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0/host2/target2:0:0/2:0:0:0

UEVENT[1137094757.300142] add@/block/sdd

UEVENT[1137094757.345146] add@/block/sdd/sdd1

UEVENT[1137094757.349261] add@/class/scsi_device/2:0:0:0

UEVENT[1137094764.911702] remove@/class/scsi_device/2:0:0:0

UEVENT[1137094764.911745] remove@/block/sdd/sdd1

UEVENT[1137094764.911757] remove@/block/sdd

UEVENT[1137094764.911770] remove@/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0/host2/target2:0:0/2:0:0:0

UEVENT[1137094764.911782] remove@/class/scsi_host/host2

UEVENT[1137094764.911794] remove@/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0

UEVENT[1137094764.911807] remove@/class/usb_device/usbdev3.4

UEVENT[1137094764.911819] remove@/devices/pci0000:00/0000:00:03.1/usb3/3-1

```

But /dev/sdd1 isn't created

----------

