# udev, 2.6.7-gentoo-r11, and usb card reader troubles

## warthog

OK, so I've been pulling my hair out for a couple of days trying to get this to work. I've searched the forums for hours, trying different things.  I've read the UDEV primer and the UDEV rules howto document, both which are excellent.  BUT, for some reason I'm having trouble getting my usb card reader to work.  Here are the details:

My hardware: USB 11-in-1 card reader (it worked fine previously with 2.4.22-gentoo-rXX running devfs)

The card: Fuji xD card from my digital camera

I performed a fresh install of gentoo 2004.2 on new hard-drive, running gentoo-dev-sources (with the necessary kernel options), and configured udev per the gentoo documentation (although I don't believe it's a 'pure' udev setup)

I know USB is working because my usb webcam (pwc) works fine.

I can tell the device is being detected from the dmesg output:

```
usb 1-4: new high speed USB device using address 2

scsi0 : SCSI emulation for USB Mass Storage devices

  Vendor: AFT PRO   Model: - 9 CF            Rev: 0822

  Type:   Direct-Access                      ANSI SCSI revision: 02

Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0

Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0

```

my addition to '/etc/udev/rules.d/50-udev.rules' (taken from Writing udev rules -- do I need the KERNEL part?)

```

BUS="usb", SYSFS{product}="PRO-IX", NAME{all_partitions}="usbcard" SYMLINK="usbcard-%n"
```

So I end up with /dev/sda, which I cannot mount:

```
# mount -t vfat /dev/sda /mnt/removable

mount: No medium found
```

With devfs and 2.4.22, I always had a /dev/sda1, but I don't have that now.  It seems to me that I should have something like /dev/usbcard if my udev rule was working right.  In any case, I ran some udev investigation commands:

is this bad?

```
# udevinfo -q path /dev/sda

unable to open udev database
```

here's the info I based the above 'rules' command from:

```

# udevinfo -a -p /sys/block/sda/

<...>

 looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.2/usb1/1-4':

    BUS="usb"

    ID="1-4"

    SYSFS{bConfigurationValue}="1"

    SYSFS{bDeviceClass}="00"

    SYSFS{bDeviceProtocol}="00"

    SYSFS{bDeviceSubClass}="00"

    SYSFS{bMaxPower}="500mA"

    SYSFS{bNumConfigurations}="1"

    SYSFS{bNumInterfaces}=" 1"

    SYSFS{bcdDevice}="0005"

    SYSFS{bmAttributes}="80"

    SYSFS{detach_state}="0"

    SYSFS{devnum}="2"

    SYSFS{idProduct}="6787"

    SYSFS{idVendor}="11b0"

    SYSFS{manufacturer}="Atech Flash."

    SYSFS{maxchild}="0"

    SYSFS{product}="PRO-IX"

    SYSFS{serial}="399600212137"

    SYSFS{speed}="480"

    SYSFS{version}=" 2.00"

<...>

```

I don't know what else to try.  Did I miss something?  Please, please, tell me if you have any ideas or if you can point me to the appropriate thread.  Thanks!!!   :Wink: 

----------

## warthog

This might shed some light on my udev problems: I tried connecting my usb hp deskjet printer, and I noticed that a device node got created at /dev/usb/lp0.  I wanted it to be created as /dev/usblp0 instead, so I modified the udev rule as follows:

original

```
BUS="usb", KERNEL="lp[0-9]*",  NAME="usb/%k"
```

modified

```
BUS="usb", KERNEL="lp[0-9]*",   NAME="usb%k"
```

however, upon rebooting, I noticed that the device node is still being created as /dev/usb/lp0.  So assuming I've got the udev rule modified correctly, this tells me that my rules file isn't getting read for some reason.  Do I not have udev configured properly?  I've even tried passing 'gentoo=nodevfs' to the kernel upon boot.  I've reviewed the Gentoo udev Guide several times now, and I just don't understand where I've gone wrong. Please help!

----------

## riprjak

Your problem would seem to be similar to mine...

 *Quote:*   

> # udevinfo -q path /dev/sda
> 
> unable to open udev database

 

If you check /etc/udev/udev.conf, you will see that udev needs a location to place its database and the default is /dev/.udev.tdv

However, I have the problem that this file does  not exist (and, therefore, devices are not being created other than in /dev/scsi/.....).

Unfortunately I dont have a solution to offer yet; but if we solve the problem with database creation, all other things will fall into place.

EDIT: Are you using a bootsplash and genkernel; it seems that when I build a bzImage manually (not using genkernel) and disable my bootsplash initrd, then udev is properly enabled; yet if I use genkernel and its initrd, it fscks up the udev database creation in /dev.

err!

jak

----------

## warthog

Very interesting... I am indeed using genkernel with bootsplash, and I agree that the udev database is obviously not being created properly. But why?  I have a feeling it has something to do with Gentoo's partial udev/devfs setup.  I followed the Gentoo instructions to the letter, so I don't know what else it could be...

----------

## riprjak

 *warthog wrote:*   

> Very interesting... I am indeed using genkernel with bootsplash, and I agree that the udev database is obviously not being created properly. But why?  I have a feeling it has something to do with Gentoo's partial udev/devfs setup.  I followed the Gentoo instructions to the letter, so I don't know what else it could be...

 

I havent finished testing; but it would appear that the initrd greated by genkernel does something odd to udev...  whilst udevd is running; the init output doesnt print "managing devices with udev" as it does for a boot from a vanilla kernel with no bootsplash.

hmmmm

err!

jak

----------

## Nadhor

I'm not sure, but I don't hink the problem lies with genkernel or initrd. I'm using 2.6.7-r5 and -r11, but no genkernel or initrd, and have seemingly similar troubles with my cardreader. I didn't change anything with udev and this file in /dev doesn't exist either. 

I have a 6-in-1 Cardreader and only load the modul usb-storage if needed. But it seems to be some gamble, if linux will create an /dev/sda1 or not. Sometimes it does, sometimes not. Sometimes it only creates /dev/sda, sometimes not even this. But nearly always not even a rmmod -f usb-storage does unload the module. 

An USB-Stick I have works just fine.

Someone was of the oppinion, it could have something to do with a too standard conform implementation of the usb stack in linux and therefore devices which stretch these standards a ltttle aren't handled properly. 

Or something is borked in the interaction between scsi with Multiple-LUN support, as needed by most X-in-1 Cardreaders, and the usb modules.

----------

## riprjak

hmmm... 

this is beginning to smell like a bug.  Anyone else not getting their udev database created??

err!

jak.

----------

## reptile

hi folks,

inspired by your ideas regarding udev and persistent file names (and the need to just copy something off of a cf card), i played around a bit with udev and the tutorial.

i have indeed managed to mount the cards, but not via BUS="usb", but BUS="scsi".

so my rules file looks like this:

```

bash-2.05b# cat /etc/udev/rules.d/10-local.rules

BUS="scsi", SYSFS{model}="CF Card       CF", SYSFS{vendor}="ICSI    ", NAME="cardreader/cfcard"

BUS="scsi", SYSFS{model}="SD Card   MMC/SD", SYSFS{vendor}="ICSI    ", NAME="cardreader/sdcard"

BUS="scsi", SYSFS{model}="              SM", SYSFS{vendor}="ICSI    ", NAME="cardreader/smartmedia"

BUS="scsi", SYSFS{model}="MS Card       MS", SYSFS{vendor}="ICSI    ", NAME="cardreader/mstick"

```

<EDIT>

 i forgot, of course, the node files are in /dev/cardreader/{sdcard,smartmedia,...}. 

i also like submount doing the automatted mounting for me. especially useful in conjunction with the mount option sync, so you can copy something over, and when the copy process has completed (e.g. in kde or gnome), you can safely pull the card out.

</EDIT>

<EDIT 2>

my /etc/fstab entries for submount:

```

/dev/cardreader/cfcard  /mnt/cfcard     subfs   fs=floppyfss,ro,umask=0,sync    0 0

/dev/cardreader/sdcard  /mnt/sdcard     subfs   fs=floppyfss:vfat,ro,umask=0,sync       0 0

/dev/cardreader/smartmedia      /mnt/smartmedia subfs   fs=floppyfss:vfat,ro,umask=0,sync       0 0

/dev/cardreader/mstick  /mnt/mstick     subfs   fs=floppyfss:vfat,ro,umask=0,sync       0 0

```

</EDIT 2>

hth, reptile

----------

## darkangael

my db isnt being made either using genkernel. Gonna try without the initrd.

----------

## darkangael

not using the initrd from genkernel fixed it. I am using bootsplash btw.

----------

## sog

anybody ever get a definitive answer on this? my db is apparently not being created, and i'm not using genkernel or initrd. 

i'm trying to get info on my USB key to make the automounting work, but when i get this similar to everyone else.

```

# udevinfo -q path /dev/sda

unable to open udev database
```

----------

## deadmoo

i don't know if this is going to help any but as just a reminder. if you are using a 6in1 or 8in1 or other *in1 card reader you should enable the the "probe all luns" option in the SCSI section of the kernel config.

----------

## sog

i'm sorry, but i'm not sure what reader you're referring to. basically i'm just trying to get my standard USB ports to mount an USB key (and digital camera, but one step at a time).

is the reader something i'm just not familiar with?

----------

## cnot

i'm having the same problem with the database not being created.  In grub.conf I added gentoo=nodevfs otherwise I haven't recompiled the kernel (I checked all the required things were included in the kernel though).

What is it that will create the database?

----------

## russryder

**BUMP**

same problem here....still no answer??

----------

## farid

Kernel 2.6.9

baselayout 1.11.6-r1

no bootsplash but using genkernel:

devfsd will be used until i drop it from kernel config but then

my bootup stops cause it does not find me SATA disk

only once the last 20 kernel builds i saw the the genkernel-compile-message that

it was compiling udev support into initrd: 

of course i used --udev as option to genkernel all the time. 

All  other times the bootup gives me:

"You wanted udev but support for it was not available!"

hmm...

----------

## russryder

from my experience it's hard to get UDev to work properly with genkernel.  have you tried compiling w/o genkernel to see if that fixes your problem?  Compiling my own kernel fixed my main udev problems.

----------

## farid

no, i have not tried it yet...

and since i am not really in need of using genkernel

and initrd i will give it a try: so back to the roots!  :Smile: 

----------

## depontius

 *russryder wrote:*   

> from my experience it's hard to get UDev to work properly with genkernel.  have you tried compiling w/o genkernel to see if that fixes your problem?  Compiling my own kernel fixed my main udev problems.

 

I recently migrated to udev, and it wasn't without it's problems. I used the "--udev" switch with genkernel, and still didn't see the /dev/.udev.??? database being created. I tried the "nodevfs" switch in the grub command line, and was unable to boot, because it couldn't find my hard disk. Reading through the initscripts it appeared that if udev was invoked, devfs would not be. But in my case it looked like both udevd and devfsd were running.

Eventually, just thrashing around trying various things, I finally noticed that the /dev/.udev.??? database really did exist, and only udevd was running, not devfsd. At that point, I was able to add the "gentoo=nodevfs" flag (note that it wasn't "nodevfs", and I'm not sure if that's significant, I read more documentation between attempts.) and am booting purely udev, now.

It appears to me that this really is an issue that requires multiple reboots to solve, in order for the initscripts to clear out evidence of devfs and start putting the udev stuff into place. But that's only a guess. At this point, I've got a stable system, and on my next kernel upgrade I'm going to remove all traces of devfs. (emerge -C)

But the immediate problem is that I got a flash reader yesterday, and can't seem to read anything. That's how I found this thread. I get:

/dev/sg0    /dev/sda

/dev/sg1    /dev/sdb

/dev/sg2    /dev/sdc

/dev/sg3    /dev/sdd

But I can't actually access any of those devices, nor do I find partitions. That's what got me to this thread. At least now I have some more ideas to pursue, but thought I could add a few words about my recent udev conversion. Since I have a k6-3 (rather slow) I haven't been in a big hurry to take on the "emerge -e world" that will be needed if/when I convert to NPTL, as suggested in the 2.6 migration guide. OpenOffice alone took about 48 hours.

----------

## russryder

 *Quote:*   

> depontius wrote
> 
> But the immediate problem is that I got a flash reader yesterday, and can't seem to read anything. That's how I found this thread. I get: 
> 
> /dev/sg0 /dev/sda 
> ...

 

check out this link....it helped me out w/ my cardreader:

http://www.reactivated.net/writing_udev_rules.html#example-camera

----------

## farid

and the basic things worked out of the box - if i can say so...:

bootup, network and sound... but

my PS/2 mouse is not recognized anymore

therefore X11 does not start and in the end:

i have a RADEON 9800Pro (with ATI Drivers!)

- i think the outlay is two big: all that worked with 

devfsd does not without it ( and with udev )

allready back to devfsd...

----------

## russryder

farid said:

 *Quote:*   

> my PS/2 mouse is not recognized anymore 
> 
> therefore X11 does not start and in the end:

 

Just change your XF86Config to update the udev location of the mouse

```
Option "Device"      "/dev/misc/psaux"

```

That worked for me, if you have a usb mouse it may be a little different, but don't give up on something as simple as that.  Udev is so much better than devfs once it you have it setup properly.

----------

## depontius

 *russryder wrote:*   

>  *Quote:*   depontius wrote
> 
> But the immediate problem is that I got a flash reader yesterday, and can't seem to read anything. That's how I found this thread. I get: 
> 
> /dev/sg0 /dev/sda 
> ...

 

Nothing so sophisticated. Shall we say... mechanical problems.

It's a rather cheap "corporate gift" 4-socket reader, and I could read neither the memory stick from my camera, nor the SD card I bought to go with roCA. (Bootable Knoppix Certificate Authority CD using tinyCA) Eventually I found I wasn't seating the memory stick properly, and was able to read my photos. Much later I found that my SD card *was* preformatted, but it had to plug into the socket upside-down, compared to the memory stick. I looked at it and said, "If I was making something *this cheap* I would put all the metal in the middle. Sure enough it worked. This was after a much more painful MESS on my Win98SE box, getting drivers properly installed. MUCH worse than rebuilding a kernel to get the multiple LUNs thing fixed.

----------

## farid

 *farid wrote:*   

> and the basic things worked out of the box - if i can say so...:
> 
> bootup, network and sound... but
> 
> my PS/2 mouse is not recognized anymore
> ...

 

i got i working last night! even without saving the /dev.. tar.bz2

at shutdown. so it's a really udev-only system now...

- updated baselayout to 1.11.7-r2

- changed the the udev-version to 046 in /etc/genkernel.conf (was 039! - but have 046 installed) - but that did not the trick

- kompiled the kernel without genkernel and without devfs (not only without the "mount at boot" option but completely without devfs

and works great! even with my ATI

----------

