Kubuntu: Can't write to USB stick

Bug #88147 reported by Auke Latour
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Invalid
Undecided
Unassigned
linux (Ubuntu)
Invalid
Undecided
Unassigned
Nominated for Intrepid by Schmirrwurst

Bug Description

When I insert my USB-stick (FAT), the stick is mounted, but I can't copy a file onto it. Reading from the stick works correctly. Below you can find some diagnostic information.

Example copy-command:
-----------------------------------
auke@desktop:/media$ cp /home/auke/tmp/DSC00005.JPG /media/usbdisk-1/
cp: cannot create regular file `/media/usbdisk-1/DSC00005.JPG': Read-only file system

Permissions of the usbdisk-1 directory in /media
----------------------------------------------------------------
auke@desktop:/media$ ls -l
total 48
lrwxrwxrwx 1 root root 6 2006-11-03 23:32 cdrom -> cdrom0
drwxr-xr-x 2 root root 4096 2006-11-03 23:32 cdrom0
drwxr-xr-x 2 root root 4096 2006-11-03 23:32 cdrom1
dr-xr-x--- 1 root plugdev 8192 2007-01-01 16:20 hda1
dr-xr-x--- 1 root plugdev 4096 2007-01-01 16:20 hda5
dr-xr-x--- 1 root plugdev 4096 2007-01-01 16:20 hda6
drwxrwx--- 10 root plugdev 4096 1970-01-01 01:00 hda7
drwxr-xr-x 12 auke auke 4096 2006-11-13 18:36 usbdisk
drwx------ 9 auke auke 16384 1970-01-01 01:00 usbdisk-1

Result of mount (note that usbdisk-1 is mounted rw):
-----------------------------------------------------------------------
auke@desktop:/media$ mount
/dev/hda8 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda13 on /home type ext3 (rw)
/dev/hda1 on /media/hda1 type ntfs (rw,nls=utf8,umask=007,gid=46)
/dev/hda5 on /media/hda5 type ntfs (rw,nls=utf8,umask=007,gid=46)
/dev/hda6 on /media/hda6 type ntfs (rw,nls=utf8,umask=007,gid=46)
/dev/hda7 on /media/hda7 type vfat (rw,utf8,umask=007,gid=46)
/dev/hda12 on /opt type ext3 (rw)
/dev/hda15 on /tmp type ext3 (rw)
/dev/hda10 on /usr type ext3 (rw)
/dev/hda11 on /usr/local type ext3 (rw)
/dev/hda14 on /var type ext3 (rw)
/dev/sda1 on /media/usbdisk type ext3 (rw,nosuid,nodev)
/dev/sdf1 on /media/usbdisk-1 type vfat (rw,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,iocharset=utf8)

Tags: cft-2.6.27
Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for your bug report. What is /media/usbdisk (notice without the -1)? Additionally, what does the command 'id' return? Thanks in advance.

Revision history for this message
Clay Weber (claydoh) wrote :

I have the same problem on my feisty box:
ls -l:
1 root root 6 2007-02-10 08:14 cdrom -> cdrom0
drwxr-xr-x 2 claydoh claydoh 4096 2007-02-10 08:14 cdrom0
drwxr-xr-x 7 claydoh root 4096 1969-12-31 19:00 disk

uid=1000(claydoh) gid=1000(claydoh) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),110(netdev),111(lpadmin),113(powerdev),114(scanner),117(admin),1000(claydoh)

My mount entry for thr 2gb flash drive is slightly different:

/dev/sde1 on /media/disk type vfat (rw,noexec,nosuid,nodev,noatime,uid=1000,utf8,shortname=lower)

Many seem to be having this problem

Revision history for this message
Auke Latour (auke-public) wrote :

Answer to Brian Murray:

what does the command 'id' return?
-------------------------------------------------
auke@desktop:~$ id
uid=1000(auke) gid=1000(auke) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(lpadmin),111(scanner),113(admin),1000(auke)

What is /media/usbdisk (notice without the -1)?
----------------------------------------------------------------
This is a 260GB USB harddisk. It works correctly. It has one ext3 partition.

The problematic device is a USB stick which has one vfat partition.

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Similar problem. I have a music player that acts as a usb vfat storage. It is now mounted with root rights only so I cannot change its contents.

I have an edgy eft laptop besides this feisty box and it works fine. On edgy it mounts as /media/usbdisk, on feisty it mounts as /media/disk (which is weird to me).

I am attaching screenshots and a small screencast demoing the problem.

Revision history for this message
Brian Murray (brian-murray) wrote :

I am unable to reproduce this using up to date Feisty Fawn.

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

I can reproduce this in an up to date Ubuntu (gnome) feisty fawn (upgraded everything one minute ago and rebooted fully). My USB key still is mounted as root and I cannot use it.

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Can you folks reproduce or do I need to fork this bug report?

By the way, I noticed this only happen with usb devices that use FAT filesystems. I have a reiserFS drive on USB and it causes no problems.

Revision history for this message
Auke Latour (auke-public) wrote :

This bug also occurs on the Herd 5 CD. On Herd 5, the behavior is exactly the same as in the description of this bug.
I tested this on my desktop PC and on my notebook by running the live-CD.

It seems essential that this only happens with a FAT formatted USB-disk.

How do I change the "importance"-field of this bug? I think that a distribution that can't write files on a USB-stick is quite useless. This should definitely be solved before the release of Kubuntu 7.04.

Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Marking confirmed as two users have reported it.

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Seems fixed, I cannot reproduce anymore on today's feisty fawn (gnome). Please confirm if it has been fixed for you too, Auke.

Revision history for this message
Auke Latour (auke-public) wrote :

I tested this again on the Kubuntu 7.04 Beta live CD, and the problem still occurs.

Example copy-command:
-----------------------------------
ubuntu@ubuntu:/media$ cp /etc/fstab /media/disk/
cp: cannot create regular file `/media/disk/fstab': Read-only file system

Permissions of the disk directory in /media
------------------------------------------------
ubuntu@ubuntu:/media$ ls -l
total 16
drwxr-xr-x 9 ubuntu root 16384 1970-01-01 00:00 disk

Result of mount:
---------------------
ubuntu@ubuntu:/media$ mount
unionfs on / type unionfs (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.20-12-generic/volatile type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
/dev/sdb1 on /media/disk type vfat (rw,noexec,nosuid,nodev,noatime,uid=999,utf8,shortname=lower)

what does the command 'id' return?
----------------------------------
ubuntu@ubuntu:/media$ id
uid=999(ubuntu) gid=999(ubuntu) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),110(netdev),111(lpadmin),113(powerdev),114(scanner),117(admin),999(ubuntu)

Revision history for this message
Auke Latour (auke-public) wrote :

I performed a test with a new USB stick. Surprisingly that USB stick showed no problems, so I tried to find a difference.

I discovered that the type of FAT differs. I hope this is useful information.

Non functioning USB stick:
-------------------------
auke@desktop:~$ fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 122 MB, 122814464 bytes
128 heads, 2 sectors/track, 937 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

   Device Boot Start End Blocks Id System
/dev/sdb1 * 1 937 119935 6 FAT16

Functioning USB stick:
-------------------------
auke@desktop:~$ fdisk /dev/sdg

The number of cylinders for this disk is set to 7872.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdg: 2063 MB, 2063597568 bytes
16 heads, 32 sectors/track, 7872 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot Start End Blocks Id System
/dev/sdg1 1 7872 2015216 e W95 FAT16 (LBA)

Revision history for this message
trollord (trollenlord) wrote :

The difference is in kernel modules handling the different fat types differently?

Revision history for this message
Esa Häkkinen (esa+hakkinen) wrote :

Reproduced bug with Hardy Live CD.

I formatted my USB stick with Vista, disk type is "6 FAT16".

'strace dd if=/dev/zero of=/dev/sdb' says only "read-only filesystem".

Revision history for this message
Esa Häkkinen (esa+hakkinen) wrote :

Oddly, I reproduced the error also with 2GB microSD card with SD adapter. This adapter happens to have "LOCK" swich on the side.

With LOCK enabled, I could use the disk with Vista just fine, but in Linux this microSD card was Read-Only.

With LOCK disabled, Vista were just fine read-write as usual, but Linux could also write on this disk just fine! =D

Error seems to be located in kernel handling USB media, since this LOCK switch made it possible to write on the microSD flash stick. Although, I'm still unable to write on any of my few USB stick (6 / FAT16) with Hardy LiveCD.

Revision history for this message
Leann Ogasawara (leannogasawara) wrote :

The Ubuntu Kernel Team is planning to move to the 2.6.27 kernel for the upcoming Intrepid Ibex 8.10 release. As a result, the kernel team would appreciate it if you could please test this newer 2.6.27 Ubuntu kernel. There are one of two ways you should be able to test:

1) If you are comfortable installing packages on your own, the linux-image-2.6.27-* package is currently available for you to install and test.

--or--

2) The upcoming Alpha5 for Intrepid Ibex 8.10 will contain this newer 2.6.27 Ubuntu kernel. Alpha5 is set to be released Thursday Sept 4. Please watch http://www.ubuntu.com/testing for Alpha5 to be announced. You should then be able to test via a LiveCD.

Please let us know immediately if this newer 2.6.27 kernel resolves the bug reported here or if the issue remains. More importantly, please open a new bug report for each new bug/regression introduced by the 2.6.27 kernel and tag the bug report with 'linux-2.6.27'. Also, please specifically note if the issue does or does not appear in the 2.6.26 kernel. Thanks again, we really appreicate your help and feedback.

Revision history for this message
Schmirrwurst (schmirrwurst) wrote :

I experience the same problem with my sd-card, and Intrepid Ibex Beta.
uname -a
Linux 2.6.27-4-generic #1 SMP Wed Sep 24 01:29:06 UTC 2008 x86_64 GNU/Linux

My card is mounted ro by default ! So I can't write to it :
cat /proc/mounts :
/dev/mmcblk0p1 /media/sd_brennion vfat ro,nosuid,nodev,uid=1000,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8 0 0

Changed in linux:
importance: Unknown → Undecided
status: Unknown → New
status: New → Invalid
Revision history for this message
Bill George (billgeorge) wrote :

Confirming that part of the problem is FAT: after reformatting various USB-sticks with NTFS they were again writable under Ubuntu 10.04. The mystery rermains why and how the use of a Sandisk mp3-player should have created this situation (before that all sticks and SD-card behaved normallly.)
The FAT phenomenom explains too why my external harddisks were unaffected - they are of course formatted with NTFS in order to allow large file sizes.

Revision history for this message
Javier Sánchez (javiersm) wrote :

I can confirm this bug in Ubuntu 10.04 after performing the last upgrades. The problem doesn't happen if I use the Ubuntu 10.04 live-cd version. My kernel version is Linux 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010 x86_64 GNU/Linux.

I do not have any problem with NTFS (via ntfs-3g) but I have it with FAT32 or EXT2/3. I test this issue with different usb memory sticks and external hard drives.

Revision history for this message
Phillip Susi (psusi) wrote :

This error indicates that the filesystem on the stick was corrupt. You can confirm this by checking dmesg for more detailed errors, and fscking the filesystem.

Changed in linux (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.