External USB Hard Drive fails to mount on boot from fstab

Bug #367782 reported by Richard Wilson
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

When an external USB HD is entered into fstab it fails to mount at startup with the following error message.

"Mounting local filesystems...
mount: special device /dev/sdb1 does not exist."

I get the same error if using the UUID instead of /dev/sdb1in the fstab

In any case the drive mounts correctly with mount -a once the machine has booted.

I believe this behaviour started after a recent 8.10 update because it used to work fine. The problem persists after upgrading to 9.04

Revision history for this message
Richard Wilson (rich-phatbloke) wrote :

I have been searching Ubuntu Forums and found

http://ubuntuforums.org/archive/index.php/t-1021719.html

It is the same issue. It is interesting that the problem only manifests itself if there is no CD-ROM drive installed. This is the case with the server machine I am using.

The last post in this forum page is as follows:

"
Okay, I think you might have a "race" condition. Edit this file:

/usr/share/initramfs-tools/init # to stop a race condition

187 maybe_break mount
188 sleep 10
189 log_begin_msg "Mounting root file system..."

sudo /usr/sbin/update-initramfs -uk all # run to rebuild the image

Make sure you get to the "mount" line. Lines numbers are likely different for your setup than mine.

If this works you might try lower number than 10 to get the least delay needed. If it doesn't some other delay could be added, here and there.

Good luck!
"

I have tried this fix but initially it did not work. I changed the the sleep value from 10 to 50 and this worked. I tried 20, it also worked. I tried 11, it failed. I tried 15, it works and I stopped here. Although booting up takes a little longer I can live with this as the machine is very rarely rebooted.

Hope this helps you iron out this bug.

Revision history for this message
mikeabout (mikehapner) wrote :

This was plaguing me too until I found the above post. For me, the steps to reproduce are:
1) Enter the drive to be mounted in /etc/fstab -- something like:
    UUID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /mnt/backup ext3 defaults,relatime 0 0
2) sudo mount -a -- which would succeed
3) sudo reboot
4) Login
5) mount

At this point, I expected to see the drive properly mounted like:
   /dev/sdc1 on /mnt/backup type ext3 (rw,relatime)

However, it was not mounted. In the dmesg log - I would see where the other drives got mounted, and that it recognized the usb drive as sdc.

The crazy thing, is that if I did a shutdown -P 0 and powered off completely, all drives would mount properly on power up from a cold start.

As a workaround, I too have added the "sleep 10" line to the /usr/share/initramfs-tools/init file and then sudo /usr/sbin/update-initramfs -uk all to rebuild the image.

FYI - this is on 9.04

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

This is a fundamental issue with our boot sequence, and has always been.

The problem is that the USB bus is inherently asynchronous. After we load the USB host driver, devices will begin appearing throughout the rest of the boot sequence. I guess your device is taking longer to appear than normal, so it's simply not detected by the point we mount filesystems.

There's no way to determine whether all devices have been found either.

Changed in util-linux (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
komputes (komputes) wrote :

I use an external USB drive as /home and it seems to have worked great until about when this bug was originally reported. Something changed/regressed that caused some USB devices to be enumerated after the partitions in /etc/fstab are mounted. I can completely corroborate the experience mikeabout describes in comment #2.

It is a split second between the time when the partitions in /etc/fstab are mounted and the USB drives are detected. Let's hope this is not caused by changes intended to improve boot speed. At boot having to run "sudo mount -a" before logging in is getting tiresome. This only affects one (Dell Mini 9) of my three machines and the fstab line is the same on all 3.

The inconsistency I observed is that when the USB disk is not detected (when the partition to be mounted from fstab is missing) I sometimes get a root prompt. Other times I just get the GDM login screen even though it's not mounted.

I tried Richard's "sleep 10" & "sleep 20" solution which does not work for me.

Ubuntu 9.04 Jaunty Jackalope

Revision history for this message
Marcelo Fernandez (fernandezm) wrote :

Hi, is there any way to get rid of this problem easier?

Maybe allowing some "init_delay=10" parameter in the options field, inside /etc/fstab for that usb device entry, and make update-initramfs to search for it when updating... (it's not a beautiful idea, right, but maybe it's cleaner than the current workaround).

Regards

Revision history for this message
Richard Huddleston (rhuddusa) wrote :

I'm seeing this bug on 3 totally different machines, all booting off usb drives, all without CD drives.

luckily, all the usb drives are just /boot, and i can bring them up manually with "mount -a" when i need to do /boot update/upgrades

i'm with Marcelo, it would be nice to have an options file to tweak somewhere

in regards to not being able to detect for all devices, it would be nice for people like me who boot, for the boot process to see that it booted off a usb drive (or such), record that, and then during the boot process try and find those again later

Revision history for this message
AugustoCiuffoletti (augusto-ciuffoletti) wrote :

If I understand Scott's reply, the problem is that we all expect a synchronous response from an asynchronous device. What about writing a small daemon that is automatically activated at boot (init.d), and waits until the device is available in order to mount it? Feeding the daemon with the mount parameters could be done inserting a keyword in commented fstab lines, so that one could simply update this file, in order to have a lazy mounting operation on that drive. By the way, applications based on that filesystem should be aware on the lazy mount operation.

Right?

Revision history for this message
Sam Geeraerts (samgee) wrote :

Instead of hacking /usr/share/initramfs-tools/init, it's more elegant and robust to add the delay as a rootdelay boot parameter. E.g. edit /etc/default/grub as follows:

GRUB_CMDLINE_LINUX_DEFAULT="quiet rootdelay=10"

and run 'sudo update-grub'.

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

This was fixed in 9.10 when we switched to upstart instead of util-linux's mountall.

Changed in util-linux (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
NJAMI FONDJA Placide Lysias (nfplacide) wrote :

Just achieve this by add on the /etc/fstab exactly below :

## Backup disk on usbdrive TOSHIBA
/dev/sdc1 /media/crashplan ext4 defaults,auto,_netdev 0 0

Of course the ## means what is next is a comment.
default,aotu,_netdev help me to get my usb drive mounted during boot. Without that, it could no work.

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.