# Problems with external USB HD  [SOLVED]

## jaghetertoffe

Hi,

I have trouble getting Gentoo to discover my external USB HD.

I have checked that the drive works correctly with another computer (WinXP)

Maybe this can help someone figure out what is wrong:

```
#dmesg | grep usb

usbcore: registered new driver usbfs

usbcore: registered new driver hub

#lspci | grep USB

0000:00:1d.0 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03)

0000:00:1d.1 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03)

0000:00:1d.7 USB Controller: Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03)
```

The results is the same before and after I plug the HD in.

I have kernel support for USB device filesystem, EHCI, OHCI and UHCI, USB Mass Storage support, SCSI disk support.

I suppose it is USB that is not working properly, at the moment I don't have any other USB devices to test with.

When I say it isn't working I mean that no /dev/sda* exists and that the results for lspci and dmesg are the same before and after I insert the USB cable.

Any suggestions?

Thanks,

toffeLast edited by jaghetertoffe on Tue Jan 18, 2005 8:35 pm; edited 1 time in total

----------

## GordSki

I think you also need to emerge 'hotplug'. It'll spot that you've plugged the drive in and load the mass storage drivers.

Otherwise, you have to manually modprobe them.

G.

----------

## jaghetertoffe

Thanks for your suggestion GordSki!

I emerged hotplug, rebooted, but still nothing happens when I plug the HD in...

Anything more I can do?

-toffe

----------

## GordSki

Has the output of dmesg changed?

G.

----------

## Veneroso

I am having a similar problem.  Although, I had this working before, 

it seems to have broken after I upgraded from linux-2.6.9-gentoo-r13 

to linux-2.6.10-gentoo-r4.  I re-emerged udev and hotplug, but still 

I have the same problem.  Hotplug does its job sometimes, but not others.  Most of my the problems occur if the hard drive already on before I start Linux.

EDIT:

While if the drive is disconnected at bootup, hotplug adds it when it is powered on, it does not remove it properly.

This is the contents of my usbdrive script from hotplug:

```

#!/bin/sh

# NOTE: to make this work, you *MUST* use the options "sync" and 

# "dirsync" in your /etc/fstab !!! otherwise you *WILL* lose data

N=0

while [ 100 -gt $N ] ; do

  if [ -e /dev/sda1 ]; then

    N=100

  fi

  sleep 1

  N=$(( $N + 1 ))

done

mount /mnt/usbdrive 2>/dev/null

#create a script to undo our actions upon removal

echo "#!/bin/bash" > $REMOVER

chmod a+x $REMOVER

echo "umount -f /mnt/usbdrive" >> $REMOVER

```

Either the remover script is not being called, or hotplug isn't being properly notified that the drive has been removed.  As I said, this was working before, so its probably the latter.  After disconnecting the drive, I have to manually umount -f as root and then physically unplug and re-plugin the drive, as it does not unmount and the device moves to /dev/sdb.

----------

## lotw

 *jaghetertoffe wrote:*   

> Thanks for your suggestion GordSki!
> 
> I emerged hotplug, rebooted, but still nothing happens when I plug the HD in...
> 
> Anything more I can do?
> ...

 

Hehehehehe, you may need to recompile your kernel with the SCSI emulation included.  USB drives will get a SDx designation when they work. I have 3 USB cases, one with a fixed HD, one with a removable tray, and one with a DVD Writer, all work fine.

----------

## jaghetertoffe

 *Quote:*   

> 
> 
> Hehehehehe, you may need to recompile your kernel with the SCSI emulation included. USB drives will get a SDx designation when they work. I have 3 USB cases, one with a fixed HD, one with a removable tray, and one with a DVD Writer, all work fine.

 

Well, if you thought that was funny, wait until you here this:

Where do I include the SCSI emulation?

I have 2.6.10-rc3 and I just can't find it...

I don't have udev emerged. Do I need it?

Veneroso: I have tested both having the drive on before I boot and powering it on at a later instance. It never works.

Guys, I am a total noob, so I have probably overlooked something obvious in your eyes. Which things do I need to modprobe, for instance?

-toffe

----------

## jaghetertoffe

GordSki: The output of dmesg has not changed

----------

## lotw

 *jaghetertoffe wrote:*   

> Well, if you thought that was funny, wait until you here this:
> 
> Where do I include the SCSI emulation?
> 
> I have 2.6.10-rc3 and I just can't find it...
> ...

 

When you use make menuconfig or the genkernel option, Do the following

1 ATA/ATAPI/MFM/RLL support  --->

2. Tenth option down "<*>     SCSI emulation support"

 recompile the kernel and copy over, reboot.

----------

## jschellhaass

You don't need both OHCI and UHCI, in fact they have tendency to interfere with one another.  You can safely remove OHCI.

jeff

----------

## jaghetertoffe

* I have now emerged udev

* I have compiled SCSI emulation into the kernel

I don't know how serious it is, but the output from make module_install ends like this:

```
   INSTALL sound/core/snd-pcm.ko

  INSTALL sound/core/snd-rtctimer.ko

  INSTALL sound/core/snd-timer.ko

  INSTALL sound/core/snd.ko

  INSTALL sound/pci/ac97/snd-ac97-codec.ko

  INSTALL sound/pci/snd-intel8x0.ko

if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.6.10-rc3; 

fi

WARNING: /lib/modules/2.6.10-rc3/extra/slusb.ko needs unknown symbol 

usb_endpoint_halted

```

Now when I insert the USB HD dmesg outputs four more lines:

```
devfs_mk_dev: could not append to parent for vcc/a3

devfs_mk_dev: could not append to parent for vcc/4

devfs_mk_dev: could not append to parent for vcc/a4

devfs_mk_dev: could not append to parent for vcc/3

```

Hope that someone can help me with this, it's really annoying that I can't use my expensive HD...

-toffe

----------

## jaghetertoffe

Update:

```
#modprobe usb-storage

#dmesg

...

Initializing USB Mass Storage driver...

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

```

I've come this far now.

But I still don't get /dev/sd* and directory /proc/bus/usb is empty

Any suggestions?

Thanks,

toffe

----------

## GordSki

Check and see if you have a anything in "/dev/scsi". The actual device nodes end up in the sub directories there and udev or devfs should symlink to /dev/sdaX.

What did you change to get the usb-storeage module to load?

G.

----------

## jaghetertoffe

Thanks for your interest, GordSki!

/dev/scsi is completely empty.

To get the storage-module to load I removed OHCI and did a manual modprobe.

-toffe

----------

## GordSki

Here's what I get in dmesg when I attach a USB Storage device:

```

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

scsi0 : SCSI emulation for USB Mass Storage devices

  Vendor: Genesys   Model: USB to IDE Disk   Rev: 0002

  Type:   Direct-Access                      ANSI SCSI revision: 02

SCSI device sda: 250880 512-byte hdwr sectors (128 MB)

sda: assuming Write Enabled

sda: assuming drive cache: write through

 /dev/scsi/host0/bus0/target0/lun0: p1

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 Mass Storage device found at 2

```

I have both OHCI and EHCI in my kernel, as well as USB Storage. Here's the relevent chunks of my .config:

```

CONFIG_USB_EHCI_HCD=y

# CONFIG_USB_EHCI_SPLIT_ISO is not set

# CONFIG_USB_EHCI_ROOT_HUB_TT is not set

CONFIG_USB_OHCI_HCD=y

CONFIG_USB_UHCI_HCD=y

CONFIG_USB_STORAGE=y

# CONFIG_USB_STORAGE_DEBUG is not set

# CONFIG_USB_STORAGE_DATAFAB is not set

# CONFIG_USB_STORAGE_FREECOM is not set

# CONFIG_USB_STORAGE_ISD200 is not set

# CONFIG_USB_STORAGE_DPCM is not set

# CONFIG_USB_STORAGE_HP8200e is not set

# CONFIG_USB_STORAGE_SDDR09 is not set

# CONFIG_USB_STORAGE_SDDR55 is not set

# CONFIG_USB_STORAGE_JUMPSHOT is not set

CONFIG_BLK_DEV_IDESCSI=m

CONFIG_DEVFS_FS=y

CONFIG_DEVFS_MOUNT=y

```

I also have the latest hotplug emerged.

Try comparing this with your's and see what's missing.....

Otherwise I'm stumped  :Sad: 

G.

PS. What is the make/model of your HD?

----------

## jaghetertoffe

Jay! It works, kind of.

I had one of the USB alternatives as a module (which I apparantly did not load) and not compiled into the kernel as you had.

When I changed this everything works fine... almost. I can't mount the drive:

```
# mount -t vfat /dev/sda1 /porsche/

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

       missing codepage or other error

       In some cases useful info is found in syslog - try

       dmesg | tail  or so

# dmesg | tail

Unable to load NLS charset cp437

FAT: codepage cp437 not found

```

Ok, so what is cp437 and how do I enable support for it?

-toffe

----------

## GordSki

Cool! Well done   :Very Happy: 

This should help:

 *Der P@te wrote:*   

> Check:
> 
> Filesystems --> DOS/FAT/NTFS FS && Native Lanuage Support
> 
> ```
> ...

 

EDIT: I assume you have a non-US non-English native language setup...

I don't know what might happen to FAT disks that are formatted for  US English in a system that doesn't support it.....

EDIT 2: https://forums.gentoo.org/viewtopic.php?t=278585&highlight=fat+codepage+cp437

G.

----------

## jaghetertoffe

Now everything works.

I had to add both 437 and iso8859-1 for it to work.

Thanks a lot GordSki!

Umm... actually there is one last problem   :Embarassed: 

```
/dev/sda1  /porsche  vfat  defaults,noauto,users,umask=000  0 0
```

This is from my fstab. If I mount /porsche as user toffe (not root) everything works fine, but all files get the executable bit set, which is a bit annoying. If I don't have umask=000 in fstab, then user toffe cannot access the disk properly.

Any solution to this?

-toffe

----------

## dsd

just to clarify: scsi emulation support is *not* needed for usb-storage.

----------

## GordSki

Try 'umask=644'

This should give you user read/write, group read and world read.

try 640 if you want no world rights.

EDIT: Thanks for the clarification dsd, l've seen lots of people saying you do need it but not many saying you don't  :Smile: 

G.

----------

## jaghetertoffe

I don't think it works with 644. It gives me:

```
d--x-wx-wx   3 toffe users  32K Jan  1  1970 porsche
```

The uid bits are inverted so I should have 100 if I don't want 'x' for user.

But then I can't cd to /porsche.

On the other hand, if I have uid=000 I get rwx, but all new files I create get rwx as well..., so it seems as if the rights are recursive.

Can I change this in some way?

Thanks,

toffe

----------

## GordSki

Ahh! I see the problem now.....

You need execute to enter directories.....

I guess your stuck with having execute on everything, sorry   :Crying or Very sad: 

There is a bit more explination in section 1.4 of this: http://tlug.up.ac.za/csslug/usb_devices.html

EDIT: You might want to looking into what you can do with an NTFS drive.

EDIT 2: This could be a bit extreme: http://uranus.it.swin.edu.au/~jn/linux/ext2ifs.htm

G.

----------

## jaghetertoffe

Great! The first link helped me solve this.

Thanks a lot!

toffe

----------

## GordSki

Doh! Didn't see the fmask and dmask bit!

Solved it without knowing it   :Confused: 

G.

----------

