From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040312 Description of problem: Sometimes, when plugging in the USB flash device (disk on a key, whatever you may want to call it), neither /etc/fstab gets updated nor the corresponding entry /mnt/flash gets created. When that happens, a subsequent run of updfstab works as expected. It seems as if it could be a timing issue that sometimes manifests in updfstab being run too soon. It _seems_ like it fails more often when the device was mounted/umounted in between plugging in/out. Version-Release number of selected component (if applicable): hotplug-2004_01_05-2 kudzu-1.1.53-1 How reproducible: Sometimes Steps to Reproduce: 1. Plug in USB flash device 2. Watch /etc/fstab, /mnt and/or Nautilus->Computer whether any new entries get created Actual Results: Sometimes, no entry in /etc/fstab, corresponding directory in /mnt get created. Expected Results: Entry in /etc/fstab, corresponding entry in /mnt get created always. Additional info: --- 8< --- /etc/updfstab.conf --- include /etc/updfstab.conf.default device flash { partition 1 match hd "Traveling Disk" } --- >8 --------------------------
If you add 'sleep 5' in front of the call to updfstab in /etc/hotplug/usb.agent, I assume it succeeds?
Created attachment 98875 [details] Patch to run updfstab until fstab changes or a specified number of attempts has been reached
I've just attached the patch that works for me -- it basically does this: - run updfstab - check whether anything has changed - wait 1 second and repeat until a specified number of attempts are reached
Without the above patch Fedora core 2 test 3 still has the issue
That just seems.... wrong. Repeatedly running it over and over just seems like a hack.
*** Bug 122837 has been marked as a duplicate of this bug. ***
Bill you mentioned something about some code that "waits for USB to settle down" which would be the thing to do here. Where did you say was it -- kudzu or anaconda? Needless to say I still experience the problem from time to time...
That is code from the loader in anaconda, IIRC.
I'm seeing a similar thing with my USB camera (for which I had to add and entry in /etc/updfstab.conf.default, bug #127992) which I think may be the same thing: The first time I plug in the camera after boot, the /mnt/camera directory and the corresponding fstab entry gets created. I then unplug the camera and they disappear, as they should. But if I then plug the camera back in, the entries don't get created. Running updfstab manually does the trick. After some messing around I found that doing a "rmmod usb_storage", and then plugging the camera in, fixes it. So, it seems that while usb_storage is loaded, updfstab is never run.
Created attachment 102323 [details] another take at fixing this This patch fixes this problem for me. It is less hackish although I feel that there may be another way of doing this.
*** Bug 126868 has been marked as a duplicate of this bug. ***
I have recently started seeing problems like those described in this bug. However, proposed fixes aren't quite working. I modified the call to updfstab in hotplug.functions as follows: sleep 1 && date >> /tmp/a && tail -1 /etc/fstab >> /tmp/a && ls -l /sys/bus/usb/drivers/usb-storage >> /tmp/a && [ -x /usr/sbin/updfstab ] && /usr/sbin/updfstab && tail -1 /etc/fstab >> /tmp/a (on one line) and see the following: Tue Jan 25 09:33:28 CST 2005 /dev/vg0/crap /export/crap ext3 defaults 1 3 total 0 lrwxrwxrwx 1 root root 0 Jan 25 09:33 1-1.1:1.0 -> ../../../../devices/pci0000:00/0000:00:11.2/usb1/1-1/1-1.1/1-1.1:1.0 lrwxrwxrwx 1 root root 0 Jan 25 09:28 module -> ../../../../module/usb_storage /dev/vg0/crap /export/crap ext3 defaults 1 3 So the device is appearing, but /mnt/flash does not appear in fstab. It works if I run updfstab manually, or if I sleep for seven seconds instead of one. What else is required in order for updfstab to recognize the device?
I have tested various kernel versions and found that the behavior changed with 2.6.10-1.8_FC2. Under 2.6.9-1.11_FC2 and earlier, I have precisely the problem originally described in this bug: when the usb-storage module is installed, updfstab is called a little too early and waiting for the device to appear in /sys/bus/usb/drivers/usb-storage works. The device appears in that location and in /proc/scsi/scsi at essentially the same time. Under 2.6.10-1.6_FC2 and later, the device appears in /proc/scsi/scsi several seconds later than it appears in /sys/bus/usb/drivers/usb-storage, and so even waiting for it to show up in the latter location is not enough because updfstab still won't find anything. My current hack is to sleep for seven seconds, which seems to cover the delay on all of my hardware.
I emailed the kernel mailing list about this issue and Greg KH <greg>, who maintains the usb code, says that this is a userland bug and not a problem with the kernel. Fedora needs to be fixed to follow the appearance of the /dev node and not the usb hotplug event. http://www.ussg.iu.edu/hypermail/linux/kernel/0502.0/0776.html
Greg's comment is only relevant when udev is in use, which is not the case for FC2.
*** Bug 122868 has been marked as a duplicate of this bug. ***
*** Bug 130855 has been marked as a duplicate of this bug. ***
*** Bug 119774 has been marked as a duplicate of this bug. ***
Created attachment 110766 [details] run updfstab from the right place Try this. You know, if we want to key off the *device*, running from usb.agent is rather silly.
The patch (id=110766) appears to work here. I am assuming I don't need to reboot for the hotplug script changes to take effect. If that is the case then this fix seems okay. I see a delay of about 7 seconds for my Lexar Secure Key to show up which compares to about 5 seconds under MacOS X.
Fixed in 2004_04_1-1.1.
(In reply to comment #21) > Fixed in 2004_04_1-1.1. I know nothing of technical matters. I only know that I want my USB flash drive to work "normally". I can only hotplug my usb flash drive once per session. The second time I try, the drive's not recognised. I found this page, which deals with my problem. As a result of reading it, I updated my existing hotplug to version 2004_04_01-8.1, the latest I could find at the Fedora website. However, that's made no difference to my inability to hotplug twice in a session. Has something done after the version mentioned above re-created the problem? Unfortunately, that's as it appears to me presently. I am aware of the patch referred to above. However, I have no idea what to do with it. If I can figure that out, would it be dangerous to try it, given that it was obviously created to deal with an earlier version of hotplug?
Leslie: Under FC3, the infrastructure is different; automatic mounting is done via HAL and its subprograms. If it's not working for you, please open a new bug against the 'hal' component.