# How can i make my usb stick work? [Solved]

## Blutch

Hi everybody!

I have an usb stick, and i want to make it work with gentoo.

The "uhci", "ohci", "ehci" and "usb mass storage" options are compiled in the kernel (2.6.9-gentoo-r1).

When i plug the stick in, i can see it is detected (with tail -f /var/log/messages). However, i see no new dev created (i'm using udev).

So i think i just have to mount my usb stick now, but i can't find a suitable dev... I already tried sda, sda1 ... and they aren't valid block devices.

When i try fdisk /dev/sda, i get the message Unable to open /dev/sda

Do you have any idea to help me make my usb stick work?Last edited by Blutch on Thu Nov 18, 2004 7:50 pm; edited 1 time in total

----------

## racoontje

You need to talk to it as a partition, not the entire drive. That would be /dev/sda1.

Also, if you don't have non-tarballed /dev, you won't see new devices made.

----------

## Blutch

 *racoontje wrote:*   

> That would be /dev/sda1.

 

Yes it's logical, but i said i have tried to mount sda1, which is also reported as no valid block device

 *racoontje wrote:*   

> Also, if you don't have non-tarballed /dev, you won't see new devices made.

 

How do i know if i have non-tarballed /dev ? If i don't have, is there still a solution for my usb stick to work?

----------

## Hayl

is hotplug working / running?  also what kind of mem stick is it?

----------

## Blutch

 *Hayl wrote:*   

> is hotplug working / running?

 

I suppose it is... i don't see anything like this with ps -ax, even after running by hand /sbin/hotplug

 *Hayl wrote:*   

> also what kind of mem stick is it?

 

It is a normal one, formatted in fat, 128Mo, and perfectly working  :Wink: 

----------

## dsd

could you post the messages that appear at the end of "dmesg" after you plug it in?

----------

## Blutch

```
# dmesg

usb1-1: new full speed USB device using address 9

scsi7 : SCSI emulation for USB Mass Storage devices

  Vendor: USB       Model: BAR               Rev: 2.00

  Type:   Direct-Access                    ANSI SCSI Revision: 02

USB Mass Storage device found at 9
```

note: the big numbers, like 9 or 7 are there because i've plugged it in/out many times  :Wink:  They increase by 1 every time

----------

## cooljoe2003

one more thing, make sure you have vfat support in your kernel  ..just a shot!

----------

## Blutch

 *cooljoe2003 wrote:*   

> make sure you have vfat support in your kernel

 

Yes i have it

----------

## peterk0

i'm not using usb mass storage driver at all and my stick is working...

i use the ub module, i don't remember where exactly is it located but somewhere in device drivers -> bus something -> it's called usb low something.

and after i stick it in my udev created /dev/uba1 device, working like a charm   :Very Happy: 

also try to not include usb mass storage, maybe it's not working 2gether

also look here https://forums.gentoo.org/viewtopic.php?t=244613 and here https://forums.gentoo.org/viewtopic.php?t=243461 and here https://forums.gentoo.org/viewtopic.php?p=1707688

try it !!!

gl

----------

## Blutch

I chose "Mass Storage" as module (instead of inside the kernel), and added the Low something inside the kernel.

Kernel is compiling, i'll try after that.

Thanks!

----------

## Blutch

My kernel is recompiled. I found /dev/uba and /dev/uba1.

With fdisk /dev/uba i can see my usb stick, which filesystem is reported as FAT16. Everything looks good.

But... when i make mount -t vfat /dev/uba1 /mnt/usb i get the following error:

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

       or too many mounted file systems
```

I suppose the fstype is good, i gave no options, the superblock must be good, so i tried to unmount "at random" /dev/shm, and then mount my stick, but the error message is still the same.

Any idea?

----------

## peterk0

i would try to format to fat32, it should fix it, fat16 sux anyway...

also u can try to mount with 

```
-t auto 
```

 instead of vfat (also check vfat support in kernel)

i'm glad it almost works   :Smile: 

----------

## Blutch

Well... Windows told me it was already FAT32, even if Linux was telling FAT16. I re-formatted the stick, and after that Linux told me W95 FAT32 LBA. Great.

But I still can't mount it, the error message is still the same. I tried with -t vfat and -t auto. And i really have vfat in my kernel!

Note also that cfdisk cannot read /dev/sda, i get the following error

```
FATAL ERROR: Bad primary partition 0: Partition begins after end-of-disk
```

I'm also glad that we're close to the success  :Wink:  but it'll be much better when it will work!

----------

## dsd

ub is fairly broken in 2.6.9 - keep away from it.

you were almost there with the scsi driver. all you were lacking is SCSI disk support - either compile it in, or make sure the module is loaded, along with the scsi core.

----------

## peterk0

well, i'm pretty happy with ub in 2.6.9-nitro2   :Cool: 

----------

## peterk0

ok so if you want to go through mass storage, then compile in scsi support otherwise u cannot see /dev/sda and /dev/sda1 ...

----------

## Blutch

Well, i'm recompiling my kernel for the 2nd time today  :Wink: 

Added mass storage and SCSI disk, and moved ub to module   :Very Happy: 

1 year ago i was running away when i heard about kernel recompilation   :Laughing: 

----------

## Dana Merrick

 *Blutch wrote:*   

> 1 year ago i was running away when i heard about kernel recompilation  

 

Haha, yeah, I hear that.

Shows how much confidence I've gotten from reading these formus.  :Very Happy: .

----------

## Blutch

Hmmm... it seems the problems are not on the usb side!

After having recompiled my kernel with SCSI support, i find /dev/sda and /dev/sda1 exactly at the same position as /deb/uba and /dev/uba1 were before. It means: fdisk /dev/sda works, but mounting /dev/sda1 still brings me the same mount error.

BUT! I noticed another mount problem. Here is a line of my /etc/fstab:

```
/dev/hda7               /mnt/share      vfat            defaults                0 0
```

and here is the corresponding line in fdisk:

```
/dev/hda7             663         679      128488+   b  W95 FAT32
```

And at each boot, i get again the same mount error:

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

       or too many mounted file systems
```

I begin to think there were no problem at all with /dev/uba, like there surely aren't with /dev/sda... but the problem would be in the fat32 support???  :Shocked: 

But i have selected the FAT option in the kernel:

File systems > DOS/FAT/NT Filesystems > MSDOS & VFAT & NTFS are selected.

Where is the error?  :Question: 

 :Evil or Very Mad: 

----------

## dsd

after you try and mount it, does anything appear at the end of "dmesg" ?

----------

## Naib

you say you are using udev

plug in the USB stick and post the last 20lines of /var/log/messages

mine is:

```

Nov  3 22:24:06 Fluid Initializing USB Mass Storage driver...

Nov  3 22:24:06 Fluid scsi0 : SCSI emulation for USB Mass Storage devices

Nov  3 22:24:06 Fluid Vendor: USB       Model: Flash Disk        Rev: 2.00

Nov  3 22:24:06 Fluid Type:   Direct-Access                      ANSI SCSI revision: 02

Nov  3 22:24:06 Fluid sda: Unit Not Ready, sense:

Nov  3 22:24:06 Fluid Current : sense = 70  6

Nov  3 22:24:06 Fluid ASC=28 ASCQ= 0

Nov  3 22:24:06 Fluid Raw sense data:0x70 0x00 0x06 0x00 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00

Nov  3 22:24:06 Fluid SCSI device sda: 512000 512-byte hdwr sectors (262 MB)

Nov  3 22:24:06 Fluid sda: Write Protect is off

Nov  3 22:24:06 Fluid sda: Mode Sense: 03 00 00 00

Nov  3 22:24:06 Fluid sda: assuming drive cache: write through

Nov  3 22:24:06 Fluid sda: unknown partition table

Nov  3 22:24:06 Fluid Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0

Nov  3 22:24:06 Fluid Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0

Nov  3 22:24:06 Fluid USB Mass Storage device found at 33

Nov  3 22:24:06 Fluid usbcore: registered new driver usb-storage

Nov  3 22:24:06 Fluid USB Mass Storage support registered.

Nov  3 22:24:07 Fluid scsi.agent[563]: disk at /devices/pci0000:00/0000:00:1d.7/usb4/4-3/4-3.2/4-3.2:1.0/host0/0:0:0:0

```

as you see my USB stick is detected as "sda"

also post the output of:

#ls /sys/block

mine is:

```
root@Fluid block # ls

fd0  hda  hdb  hdc  hdd  sda

```

[/code]

----------

## darkphader

 *racoontje wrote:*   

> Also, if you don't have non-tarballed /dev, you won't see new devices made.

 

Udev, non-tarballed, works fine here for a flash drive.

----------

## dkaplowitz

I'm running 2.6.9-gentoo-r1 on amd64 and I have the same/similar problem.

My dmesg and /var/log/everything/current tells me the device is /dev/sdc, but I get the "wrong fstype" message when trying to mount -t vfat it (but mounting in Knoppix and on another Gentoo box that runs 2.6.7.xx kernel it mounts fine). Mount -t auto tells me I must declare an fstype.

This is an external usb20 hard drive formatted fat32.

I'm assuming it's likely something breaky about USB in 2.6.9, so I guess I'll wait. Drag city, I wanted to organize about 80 GB worth of old archives.  :Sad: 

----------

## dsd

please post the last few lines of dmesg that appear _after_ you try  and mount the device. this should give considerable insight into the problem..

----------

## darkphader

I know it doesn't exactly help or point to a solution but it does work fine here.

I'm using 2.6.9-ck2, full udev, ub module, with no flash drive problems.

I think FAT16 is used for compatibility reasons as you need at least Win98 OSR2 in the Win9x line to read FAT32 and NT doesn't do FAT32 either (but I don't think NT does USB either so it may be a moot point).

Also, with my FAT16 flash drive and using type "auto" there was no long file name support. Changing the type to "vfat" allowed for long filename support.

----------

## darkphader

For comparison I get these lines added to dmesg when I plug in the flash drive:

```
usb 3-4: new high speed USB device using address 6

uba: device 6 capacity nsec 502784 bsize 512

uba: was not changed

 uba: uba1
```

----------

## peterk0

just a shot but maybe try to format it on different FS, maybe ext3 or someting like that, just to see what happens...

also if you created your usb disk partition in linux. make sure u turned on the dos compatibility flag in fdisk

----------

## Blutch

Here are my dmesg last lines, after i plugged my stick in and tried to mount /dev/sda1:

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

scsi0 : SCSI emulation for USB Mass Storage devices

  Vendor: USB       Model: BAR               Rev: 2.00

  Type:   Direct-Access                      ANSI SCSI revision: 02

SCSI device sda: 255744 512-byte hdwr sectors (131 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

USB Mass Storage device found at 2

Unable to load NLS charset cp437

FAT: codepage cp437 not found

```

Does it help you?

----------

## darkphader

I do have cp437 support compiled in. Maybe you need that.

----------

## malv

My usb stick works without problems in either gentoo or WindowsXP. If it is set up under WindowsXP, I can't read it in gentoo. If I set it up for gentoo, I can't read it in XP. (using fat32)

Any suggestions?

----------

## peterk0

 *Blutch wrote:*   

> 
> 
> ```
> 
> Unable to load NLS charset cp437
> ...

 

You need cp437 compiled in, it can be found under file systems -> language selection

----------

## peterk0

 *malv wrote:*   

> My usb stick works without problems in either gentoo or WindowsXP. If it is set up under WindowsXP, I can't read it in gentoo. If I set it up for gentoo, I can't read it in XP. (using fat32)
> 
> Any suggestions?

 

maybe try set it up under gentoo and also set the dos compatibility flag in fdisk (just a tought...)

and also check your dmesg if you're sticking in a winxp set up, maybe past the output here ...   :Smile: 

----------

## Naib

how do you format a usbstick?

I tried in windows and it wouldnt let me? it doesnt damage it does it?

----------

## peterk0

 *Naib wrote:*   

> how do you format a usbstick?
> 
> I tried in windows and it wouldnt let me? it doesnt damage it does it?

 

well, it was working for me... sorry dunno

----------

## malv

 *Naib wrote:*   

> how do you format a usbstick?
> 
> I tried in windows and it wouldnt let me? it doesnt damage it does it?

 

Mine came with a windows utility to take care of formatting.

In linux I use cfdisk.

----------

## Blutch

 *Quote:*   

> You need cp437 compiled in, it can be found under file systems -> language selection

 

That was all... now everything works  :Cool:  . I suppose now everything would also work with ub, but i don't want to recompile my kernel once more :p

But why do i need US charset in order to mount fat ??? I had naturally unselected it because i'm european, and i supposed all i needed to include was 850...

Lots of thanks to all people who helped me here!   :Smile: 

One more thing: when I unmount my stick, the led is sometimes still on. I would like to remove it properly, is there a way for it?

----------

## Naib

that LED is just showing power to drive

----------

## Blutch

I remember, with Windows (sorry!  :Wink:  ) that this led still shows a bit when i don't access to the stick, but after i "safely remove" it, the led doesn't show anymore!

----------

## darkphader

The LED on my flash drive blinks when it's being accessed such as data access/transfer and for a few seconds when initially plugged-in otherwise it's off.

----------

## peterk0

well but ub is mutch better though   :Smile:   no scsi, no other stuff (usb mass storage) just one single module loaded automatically with hotplug... simply a dream   :Very Happy: 

I'm glad everything works now, maybe put solved in topic

----------

## awn4500

see, i try to mount my /dev/hda1 or 5 or 6 (all fat32) and it gives me the same error message whenever i do that when running the kernel i compiled (vfat is in it), but when i use my genkernel kernel, they mount fine, so as a noobie speaking here, try genkernel

----------

## Pigeon

fyi- the kernel module for the fat12 and fat16 filesystems is msdos, not vfat.  *Blutch wrote:*   

> But why do i need US charset in order to mount fat ??? I had naturally unselected it because i'm european, and i supposed all i needed to include was 850...

  US.Washington.Redmond.Microsoft

Bastards. *awn4500 wrote:*   

> see, i try to mount my /dev/hda1 or 5 or 6 (all fat32) and it gives me the same error message whenever i do that when running the kernel i compiled (vfat is in it), but when i use my genkernel kernel, they mount fine, so as a noobie speaking here, try genkernel

 Which error message is that?  And the device name shouldn't be /dev/hda anything, it's most likely going to be /dev/sda* or /dev/uba*.

----------

## awn4500

I got this message whenever i want to mount any of my IDE1 harddisk partitions (all FAT32 partitions)   *Quote:*   

>  mount: wrong fs type, bad option, bad superblock on /dev/hda5, 
> 
>        or too many mounted file systems

 

,mounts my NTFS partitions (btw i have 3 harddisks and like 2 thousand partitions) with no probs at all. my kernel from genkernel mounts everything,i used it coz the kernel i compiled sucks big time, cant see half of the screen, large fonts ......, who cares so i am using my genkernel kernel, its fine. i have gentoo-dev-sources 2.6.9

----------

## peterk0

 *awn4500 wrote:*   

> I got this message whenever i want to mount any of my IDE1 harddisk partitions (all FAT32 partitions) 

 

Well, imho it's the same....

When you were configuring your kernel without genkernel (which i never used btw  :Smile:  ) you probably just missed the language option cp437

----------

## dkaplowitz

 *dsd wrote:*   

> please post the last few lines of dmesg that appear _after_ you try  and mount the device. this should give considerable insight into the problem..

 

I was getting the cp437 error message, which led me to this thread , which showed me which modules I wasn't loading but needed.

Thanks for the replies.

Dave

----------

## Blutch

I found something interesting in the kernel: in the DOS/FAT... filesystem options, you can choose the default codepage. I put 850 there instead of 437, and removed the codepage 437 support.   :Cool: 

----------

## Blutch

 *peterk0 wrote:*   

> I'm glad everything works now, maybe put solved in topic

 

How to do this? Can i do this, since i created the topic? I haven't found any option to do it.

----------

## peterk0

 *Blutch wrote:*   

>  *peterk0 wrote:*   I'm glad everything works now, maybe put solved in topic 
> 
> How to do this? Can i do this, since i created the topic? I haven't found any option to do it.

 

I believe you can change the topic by editing the first post   :Smile: 

----------

