# USB stick in 2.6.11 and UDev [solved]

## AeroIllini

I'm having trouble getting my USB stick working again after upgrading to kernel 2.6.11 and UDev. Am I missing something here?

Kernel Config:

```

Device Drivers --->

   SCSI Device Support --->

      --- SCSI device support

      [*]   legacy /proc/scsi/ support

      ---   SCSI support type (disk, tape, CD-ROM)

      <*>   SCSI disk support

      <*>   SCSI CDROM support

      [*]     Enable vendor-specific extensions (for SCSI CDROM)

      <*>   SCSI generic support

      ---   Some SCSI devices (e.g. CD jukebox) support multiple LUNs

      [*]   Probe all LUNs on each SCSI device

      [*]   Verbose SCSI error reporting (kernel size +=12K)

   USB Support --->

      <*> Support for Host-side USB

      [*]   USB device filesystem

      <*> USB Mass Storage support

      [*]   Microtech/ZiO! CompactFlash/SmartMedia support

File Systems --->

   DOS/FAT/NT Filesystems --->

      <*> MSDOS fs support

      <*> VFAT (Windows-95) fs support

```

Pertinent command lines:

```

[root] ~ $ dmesg tail | grep -i usb

usbcore: registered new driver usbfs

usbcore: registered new driver hub

usbcore: registered new driver ub

Initializing USB Mass Storage driver...

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

[root] ~ $ ls -la /proc/bus/usb/

total 0

drwxr-xr-x  2 root root 0 Aug 12 14:09 .

dr-xr-xr-x  5 root root 0 Aug 12 14:09 ..

[root] ~ $ ls -l /dev/sd*

ls: /dev/sd*: No such file or directory

```

It seems that the kernel isn't even recognizing the usbstick, since nothing shows up in dmesg when I plug it in. I know the stick is not faulty, because it works in Windows machines.

Any suggestions would be appreciated.

- KevinLast edited by AeroIllini on Fri Aug 26, 2005 12:28 am; edited 1 time in total

----------

## moocha

udev rule syntax may have changed. Check this thread: https://forums.gentoo.org/viewtopic-t-370866.html

----------

## AeroIllini

I can't assign a udev rule until I know the path of the node. /dev/sda doesn't exist in my /dev directory.

```

[root] ~ $ udevinfo -q path -n /dev/sda

device not found in database

```

----------

## moocha

Ah, you're right, of course. My bad, I was too hasty.

Could you perhaps try with modular instead of built-in SCSI and USB support? Unless, of course, you need them to mount the root file system. Works for me fine on a modular kernel.

----------

## AeroIllini

No, I don't need it for my root filesystem. I can certainly try recompiling as a module, but why would it make a difference? Modular or built-in, it's all the same code, right?

----------

## moocha

I've seen stranger stuff happening...

----------

## AeroIllini

Ok, I tried recompiling SCSI support as a module, but I still don't have /dev/sda*. My updated config:

Kernel (I took out some stuff I no longer need)...

```

Device Drivers --->

   SCSI Device Support --->

      --- SCSI device support

      [ ]   legacy /proc/scsi/ support

      ---   SCSI support type (disk, tape, CD-ROM)

      <M>   SCSI disk support

      < >   SCSI CDROM support

      [ ]     Enable vendor-specific extensions (for SCSI CDROM)

      < >   SCSI generic support

      ---   Some SCSI devices (e.g. CD jukebox) support multiple LUNs

      [ ]   Probe all LUNs on each SCSI device

      [ ]   Verbose SCSI error reporting (kernel size +=12K)

```

...and command line.

```

[root] /home/kevin $ lsmod

Module                  Size  Used by

   **snip**

sd_mod                 16784  0

   **snip**

```

dmesg same as before:

```

[root] /home/kevin $ dmesg | grep -i usb

usbcore: registered new driver usbfs

usbcore: registered new driver hub

usbcore: registered new driver ub

Initializing USB Mass Storage driver...

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

```

Nothing is added to dmesg when I plug in the usbstick.

Any ideas?

----------

## AeroIllini

Update:

I also compiled Generic SCSI support as a module, to see if that would help, but I still don't have /dev/sd* entries.

New kernel config:

```

Device Drivers --->

   SCSI Device Support --->

      --- SCSI device support

      [ ]   legacy /proc/scsi/ support

      ---   SCSI support type (disk, tape, CD-ROM)

      <M>   SCSI disk support

      < >   SCSI CDROM support

      [ ]     Enable vendor-specific extensions (for SCSI CDROM)

      <M>   SCSI generic support

      ---   Some SCSI devices (e.g. CD jukebox) support multiple LUNs

      [ ]   Probe all LUNs on each SCSI device

      [ ]   Verbose SCSI error reporting (kernel size +=12K)

```

Command line:

```

[root] /home/kevin $ lsmod

Module                  Size  Used by

   **snip**

sg                     36128  0

sd_mod                 16784  0

   **snip**

```

Where is my /dev/sd*?

----------

## nukem996

Im having the same problem, ive never had anything like this before and have been using usb devices for a long time. Has anyone figured this out?

----------

## AeroIllini

A small update to the situation:

I was poking around in the kernel config, and noticed that I had forgotten to compile in support for OHCI and UHCI in the USB section.

```

Device Drivers --->

   USB Support --->

      <*> OHCI HCD support

      <*> UHCI HCD (most Intel and VIA) support

```

I have no idea what these mean, but the upside is that now I have USB hotplugging enabled (i.e., when I plug in a USB device, the light blinks, and I get messages in dmesg).

```

[root] ~ $ dmesg

  **snip**

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

uba: device 3 capacity nsec 985088 bsize 512

uba: device 3 capacity nsec 985088 bsize 512

 uba: uba1

  **snip**

```

I still don't have /dev/sd* entries, but it's a step in the right direction.

----------

## nukem996

I took some time and screwed around with it and was able to solve it. When ever I plugged a USB Storage device in I kept seeing this in dmesg

```

usb 4-4: device descriptor read/64, error -71

```

I googled it and came across this. Basiclly what this does is make the USB device run in full-speed mode rather then high speed. This is a problem because your device will run slower here is the difference between my laptop, the one with the problem, and my desktop both running the 2.6.12-gentoo-r9 kernel.

Laptop(IBM Thinkpad T40 1.5ghz Centrino 512megs RAM)

```

 Timing cached reads:   1604 MB in  2.00 seconds = 800.92 MB/sec

 Timing buffered disk reads:    4 MB in  4.19 seconds = 978.41 kB/sec

```

Desktop(AMD64 3500+ 2.2ghz 1gig RAM)

```

 Timing cached reads:   3464 MB in  2.00 seconds = 1731.40 MB/sec

 Timing buffered disk reads:    34 MB in  4.19 seconds = 10.84 MB/sec

```

As you can see this is a big difference but at least its a step closer.

----------

## dsd

AeroIllini: http://dev.gentoo.org/~dsd/genpatches/issues-resolved.htm#2.6.9-ub

----------

## nukem996

dsd: I am 100% sure I do not have the module loaded. While your here do you think this could be an IRQ problem? I noticed that everything was on IRQ 11 so I tryed irqpoll, which help spread things out but didnt solve the problem. I also tried setting things manually and still nothing. Tomarrow im thinking of trying to do a BIOS update and see if it fixes anything.

----------

## dsd

nukem996: i dont understand your problem, can you explain it in full?

----------

## nukem996

dsd: What is happening is that if I plug my USB storage device into my USB 2.0 port it does not show up as /dev/sda and lsusb shows nothing. Here is my dmesg after I plug it in

```

usb 4-4: new high speed USB device using ehci_hcd and address 47

usb 4-4: new high speed USB device using ehci_hcd and address 98

usb 4-4: new high speed USB device using ehci_hcd and address 118

usb 4-4: new high speed USB device using ehci_hcd and address 119

usb 4-4: new high speed USB device using ehci_hcd and address 120

usb 4-4: new high speed USB device using ehci_hcd and address 5

usb 4-4: new high speed USB device using ehci_hcd and address 9

usb 4-4: new high speed USB device using ehci_hcd and address 10

usb 4-4: new high speed USB device using ehci_hcd and address 21

usb 4-4: new high speed USB device using ehci_hcd and address 29

usb 4-4: device descriptor read/64, error -71

```

I googled the error message(last line) and found this. What is says is that theres some problem with the ehci_hcd driver. In order to be able to use my USB storage device at all I need to remove the ehci_hcd module and just use the uhci_hcd module. While this hack fixes my problem it greatly degresses the speed of the device, basicly making it a USB 1.1 device. This is a 40gig USB drive so I use it to transfer large files and I would like to do them quickly so using the device at USB 1.1 speeds is unacceptable. Basicly what I want to be able to do is use my USB drive with the ehci_hcd driver so I can get full speed.

----------

## AeroIllini

dsd: I disabled the Low Level USB driver in my kernel, and now I have a /dev/sda and /dev/sda1 when I plug in my usb stick. However, no mount command I give it will let me browse the filesystem.

when I plug in the usbstick:

```

[root] ~ # dmesg

  **snip**

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

scsi0 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 3

usb-storage: waiting for device to settle before scanning

  Vendor:           Model: USB DISK 20X      Rev: PMAP

  Type:   Direct-Access                      ANSI SCSI revision: 00

SCSI device sda: 985088 512-byte hdwr sectors (504 MB)

sda: assuming Write Enabled

sda: assuming drive cache: write through

SCSI device sda: 985088 512-byte hdwr sectors (504 MB)

sda: assuming Write Enabled

sda: assuming drive cache: write through

 sda: sda1

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

usb-storage: device scan complete

```

Then I try to mount it:

```

[root] ~ # mount -t vfat /dev/sda1 /mnt/usbstick

mount: wrong fs type, bad option, bad superblock on /dev/sda1,

       or too many mounted file systems

```

and after a mount attempt:

```

[root] ~ # dmesg

  **snip**

Unable to load NLS charset cp437

FAT: codepage cp437 not found

```

I formatted the usb stick on a Windows machine as FAT32. What am I doing wrong?

----------

## AeroIllini

Found it!

I should have read http://gentoo-wiki.com/HOWTO_USB_Mass_Storage_Device a little more carefully...

The error I got in dmesg...

```

[root] ~ # dmesg

  **snip**

Unable to load NLS charset cp437

FAT: codepage cp437 not found

```

...meant I didn't have certain charsets compiled into my kernel.

```

File systems --->

   Native Language Support --->

      <*> Codepage 437 (United States, Canada)

      <*> NLS ISO 8859-1 (Latin 1; Western European Languages)

```

Once those were compiled in, everything worked again.

----------

## nukem996

I guess ill start a new thread :\

----------

## newtonian

Just to wrap things up, the same fix worked for me with modules.  When I followed the Unicode howto to set up my system I removed all other code pages on purpose.  This is the first time I've ever been forced to use a code page other than utf-8.  I hope my system doesn't start writing Japanese file names using iso8859 or cp437.  That could get messy.  Is the iso8859 and cp437 requirement a vfat problem or a usbfs problem?

```

cd /usr/src/linux

make menuconfig

  --> file systems --> native language support

    M  codepage 437

    M  NLS-iso8859-1

mount /boot/

cp arch/i386/boot/bzImage /boot/kernel-2.6.11-gentoo-r6

cp System.map /boot/System.map-2.6.11-gentoo-r6

cp .config /boot/config-2.6.11-gentoo-r6

```

reboot

```

mount -t vfat /dev/sdb1 /mnt/clip

```

Cheers,

----------

## dsd

there is no requirement. you get to choose the default fat codepage and nls in the kernel config, and you also get the option of specifying different ones on the kernel command line or when loading the module. be careful when you change kernel options which you dont fully understand  :Wink: 

----------

## newtonian

 *dsd wrote:*   

> there is no requirement. you get to choose the default fat codepage and nls in the kernel config, and you also get the option of specifying different ones on the kernel command line or when loading the module. be careful when you change kernel options which you dont fully understand 

 

Thanks for the advice.  I left the default nls option as UTF8. So I'm hoping that the kernel will continue to write my file names to the hard disk in UTF8.  No problems yet, but I'll keep an eye out.

Cheers,

----------

