Bug 6236

Summary: PenDrive recognized but cannot be accessed
Product: Drivers Reporter: tomek.fizyk
Component: USBAssignee: Matthew Dharm (mdharm-usb)
Status: REJECTED INVALID    
Severity: normal CC: stern
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: Linux version 2.6.15-1-686 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    
Attachments: dmesg output
kern.log
output of "fdisk -l /dev/sda"
"dosfsck /dev/sda1" output
output of "dd if=/dev/sda1..." on FC4 (kernel: 2.6.15-1.1833_FC4)
output of "dd if=/dev/sda1..." on FC4 (kernel: 2.6.16.1)
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.15-1-686-debian)
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.16)
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.17-rc1)
output of "ls /dev/sda*" on laptop, debian with kernel-2.6.15-1-686 (debian)
output of "ls /dev/sda*" on laptop, debian with kernel-2.6.17-rc1 (kernel.org)
output of usbmon on laptop while dd command (debian with linux-2.6.17-rc1)
output of usbmon on laptop while pendrive attatch (debian with linux-2.6.17-rc1)
output of usbmon on laptop while pendrive detatch (debian with linux-2.6.17-rc1)
output of "ls /dev/sda*" on computer, FC4 with2.6.15-1.1833_FC4 kernel
output of usbmon on computer while dd (2.6.15-1.1833_FC4)
output of usbmon on computer while attatch (2.6.15-1.1833_FC4)
output of usbmon on computer while detatch (2.6.15-1.1833_FC4)
/sys/block/sda/sda1/start from laptop with Debian

Description tomek.fizyk 2006-03-16 14:23:38 UTC
Most recent kernel where this bug did not occur: 2.6.8 (don't know if most recent)
Distribution: Debian GNU/Linux
Hardware Environment: Acer TravelMate 2410
Problem Description: PenDrive is detected and initialized as an scsi device
/dev/sda1, but is not mounted due to i/o error. This didn't happen on Mandrake
10.1 linux with 2.6.8 kernel. On Debian I use udev and hal, on Mandrake hotplug
devices were managed by hotplug, but when I submited this bug to udev mailing
list they claimed that it is a kernel or pendrive problem. Pendrive worked well
under mandrake and it does so under windows.
Comment 1 tomek.fizyk 2006-03-16 14:24:42 UTC
Created attachment 7588 [details]
dmesg output
Comment 2 tomek.fizyk 2006-03-16 14:25:09 UTC
Created attachment 7589 [details]
kern.log
Comment 3 Alan Stern 2006-03-16 19:48:02 UTC
Judging from the logical block numbers in the error messages, it looks like the
partition table on the pendrive may be messed up.  What do you get from "fdisk
-l /dev/sda"?
Comment 4 tomek.fizyk 2006-03-18 10:28:25 UTC
"fdisk -l /dev/sda" lists a FAT partition on the pendrive
Comment 5 Alan Stern 2006-03-18 10:54:48 UTC
But what are the sector numbers for the start and end of the the sda1 partition?
 And if they are okay, the next question is whether the filesystem itself has
been corrupted.  Have you tried running dosfsck on /dev/sda1?

The point here is that your mount command failed because some software component
was trying to read block 508378384, but the pendrive only contains 251904
blocks!  No wonder you got an error.
Comment 6 tomek.fizyk 2006-03-21 08:02:37 UTC
Created attachment 7628 [details]
output of "fdisk -l /dev/sda"

this is the output of fdisk command. I'll send the dosfsck output in a while
Comment 7 tomek.fizyk 2006-03-31 07:50:43 UTC
Created attachment 7733 [details]
"dosfsck /dev/sda1" output

This is the output of "dosfsck /dev/sda1" (at last;P). It is quite strange I
think... More strange is the fact that I've checked the same pendrive on other
computer with linux kernel 2.6.15-1 (2.6.15-1.1833_FC4 on Fedora Core 4) and it
worked... Couldn't it be some problem with other software, eg. udev? Or maby
with hardware? I also tried the original linux kernel 2.6.16-git8 and the
pendrive worked, but it was on the second computer (on Fedora, not Debian
system). I will try the newest kernel on the Debian system and send the
results. I don't know if Debian team changes something in the kernel, but if
they do - could it be the source of the problem?
Comment 8 Alan Stern 2006-03-31 08:33:25 UTC
Here's something that might help.  Try doing this on each of the computers (or
under each of the kernels):

  dd if=/dev/sda1 bs=512 count=1 | hexdump -C

Be careful to keep track of which computer and which kernel produced which
output.  Normally one would expect the all outputs to be the same, but I bet
they won't be.
Comment 9 tomek.fizyk 2006-04-05 07:31:41 UTC
Created attachment 7772 [details]
output of "dd if=/dev/sda1..." on FC4 (kernel: 2.6.15-1.1833_FC4)

this is the output of "dd if=/dev/sda1 bs=512 count=1 | hexdump -C" on computer
with Fedora Core 4 with 2.6.15-1.1833_FC4 kernel
Comment 10 tomek.fizyk 2006-04-05 07:41:56 UTC
Created attachment 7773 [details]
output of "dd if=/dev/sda1..." on FC4 (kernel: 2.6.16.1)

And here is the ouput of the same command. The same computer, Fedora Core 4,
linux kernel 2.6.16.1 (I've installed this kernel over 2.6.16-git8, and the
pendrive also worked well). Both outputs are the same (I used diff to check
it). In few days Ill send the output from Debian installed on laptop.
Comment 11 tomek.fizyk 2006-04-19 07:17:59 UTC
Created attachment 7900 [details]
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.15-1-686-debian)

The output of dd command. Debian system on the laptop, kernel 2.6.15-1-686
compiled by Debian team
Comment 12 tomek.fizyk 2006-04-19 07:19:41 UTC
Created attachment 7901 [details]
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.16)

output from Debian on the laptop, kernel 2.6.16 from kernel.org
Comment 13 tomek.fizyk 2006-04-19 07:23:56 UTC
Created attachment 7902 [details]
output of "dd if=/dev/sda1..." on Debian (kernel: 2.6.17-rc1)

and finally from Debian on the laptop, with kernel 2.6.17-rc1 from kernel.org.
They are identical (I've checked with diff).
As one can see they are different from those from FC4 on the other machine.
Comment 14 Alan Stern 2006-04-19 11:15:13 UTC
It's obvious that the FC4 tests are doing what they are supposed to (reading the
first sector of /dev/sda1) whereas the tests on the laptop are actually reading
the first sector of /dev/sda instead of /dev/sda1.  That's why the errors occur.

At this point it's hard to tell if the difference is due to the system, the
kernel version, or the hardware.  The first thing to do is "ls -l /dev/sda*" on
both machines.  In particular, check to see that the major and minor numbers for
/dev/sda and /dev/sda1 aren't identical.

Can you copy the 2.6.17-rc1 kernel from the laptop to the other computer and run
the test under it?  If you do, is the output the same as from the FC4 kernels on
that computer or is it the same as on the laptop?

Also try this:  Monitor the output from usbmon while running the "dd..." test. 
usbmon is described in Documentation/usb/usbmon.txt in the kernel source.  You
will probably have to rebuild the 2.6.17-rc1 kernel with CONFIG_USB_MON and
CONFIG_DEBUG_FS set.  Do this on both machines and attach the results here.
Comment 15 tomek.fizyk 2006-05-09 04:55:17 UTC
Created attachment 8069 [details]
output of "ls /dev/sda*" on laptop, debian with kernel-2.6.15-1-686 (debian)
Comment 16 tomek.fizyk 2006-05-09 04:56:21 UTC
Created attachment 8070 [details]
output of "ls /dev/sda*" on laptop, debian with kernel-2.6.17-rc1 (kernel.org)
Comment 17 tomek.fizyk 2006-05-09 04:58:02 UTC
Created attachment 8071 [details]
output of usbmon on laptop while dd command (debian with linux-2.6.17-rc1)
Comment 18 tomek.fizyk 2006-05-09 04:58:57 UTC
Created attachment 8072 [details]
output of usbmon on laptop while pendrive attatch (debian with linux-2.6.17-rc1)
Comment 19 tomek.fizyk 2006-05-09 04:59:39 UTC
Created attachment 8073 [details]
output of usbmon on laptop while pendrive detatch (debian with linux-2.6.17-rc1)
Comment 20 Alan Stern 2006-05-09 10:55:39 UTC
On each of your two systems, what's in the file /sys/block/sda/sda1/start ?

Probably on the laptop it says 0 and on the other system it says something like
512.  If so, that's the root of the problem -- but we still don't know what's
causing it.
Comment 21 tomek.fizyk 2006-05-12 14:41:19 UTC
Created attachment 8108 [details]
output of "ls /dev/sda*" on computer, FC4 with2.6.15-1.1833_FC4 kernel
Comment 22 tomek.fizyk 2006-05-12 14:42:32 UTC
Created attachment 8109 [details]
output of usbmon on computer while dd (2.6.15-1.1833_FC4)
Comment 23 tomek.fizyk 2006-05-12 14:46:22 UTC
Created attachment 8110 [details]
output of usbmon on computer while attatch (2.6.15-1.1833_FC4)
Comment 24 tomek.fizyk 2006-05-12 14:48:08 UTC
Created attachment 8111 [details]
output of usbmon on computer while detatch (2.6.15-1.1833_FC4)
Comment 25 tomek.fizyk 2006-05-12 15:01:30 UTC
The above are the outputs of ls and usbmon on FC4 (on the desktop computer) with it's own 2.6.15-1.
1833_FC4 kernel. The content of /sys/block/sda/sda1/start on the system is 32.
In a while I will send the output of the commands made on FC4 with the kernel copied from the laptop. 
In few days I will send the content of the /sys/block/sda/sda1/start from the laptop.
Comment 26 tomek.fizyk 2006-05-12 15:19:51 UTC
Bad news... The kernel copied from laptop wouldn't run on the computer. Maby it's because the kernel 
is compiled for intel processor and on the computer there is an AMD64? Anyway I will send the /sys/
block/sda/sda1/start from the laptop in few days
Comment 27 tomek.fizyk 2006-05-20 10:44:06 UTC
Created attachment 8152 [details]
/sys/block/sda/sda1/start from laptop with Debian
Comment 28 Alan Stern 2006-05-20 13:12:38 UTC
Well, that's strange.  The file contains "60 480 0 0" but it should contain
"32", just like on the other computer.  I suspect that this was caused by a
Debian modification to the kernel.

Is it possible for you to install a vanilla kernel (or even a Fedora kernel) on
the laptop?  Or even just boot it from a live CD with a recent non-Debian
kernel.  If the PenDrive works then this is definitely a Debian problem and you
should speak to them.  If it doesn't work, then let us know which kernel you
tried and show the contents of /sys/block/sda/sda1/start.
Comment 29 Alan Stern 2006-05-20 13:15:29 UTC
Wait a minute!  It looks like you posted the contents of
/sys/block/sda/sda1/stat, not /sys/block/sda/sda1/start.  Try doing it again.

(By the way, you don't need to create a separate attachment for a 1-line file. 
Just include it in with your comments.)
Comment 30 tomek.fizyk 2006-05-30 03:24:56 UTC
It was the correct file (/sys/block/sda/sda1/start), but after formatting the
pendrive (under windows) the content of the file changed to 0.
The Fedora kernel is 64bit and the laptop has 32bit processor, so it won't run.
But I'm downloading some non-debian Live-CD distribution of linux so I will try
it on the laptop. I have also Installed recently a Debian on the computer, so I
will also try the pendrive on that system.
In my first comment I wrote that the pendrive worked on laptop but under
mandrake linux.
Comment 31 tomek.fizyk 2006-05-31 10:16:37 UTC
My mistake... "60 480 0 0" was from stat, not from start even before formatting
the pendrive... Any way i have connected the pendrive to the computer with the
same debian installed and the situation was the same as in the case of laptop.
So I am now sure that is Debian's fault. I'm also sure that when I run a
non-debian LiveCD on the laptop the pendrive will work.
Comment 32 tomek.fizyk 2006-06-13 08:17:57 UTC
I've run a non-debian Linux distribution on the laptop and the pendrive worked 
well. The distribution was Pingwinek GNU/Linux 1.0 preview 3. I've also tried 
DSL Linux 3.0 RC 1, which is, as far as I know, Knoppix based, and the 
pendrive did not work.
Comment 33 Alan Stern 2006-06-13 12:00:03 UTC
Then you should mark this bug as REJECTED and file a bug report with the Debian
maintainers.  Let them know about this report though, so they can read through
it and benefit from what we've learned.