OpenWrt Forum Archive

Topic: Mount via script fails, manually works

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I have a weird problem with Backfire 10.03. I have tailored my fstab and I am able to mount my pendrive using mount -a manually. However, if I want it to be automatic and I put the mount -a into a script, it fails.

My fstab:

/dev/sda1 /mnt/disc0_1 ntfs-3g umask=000,dmask=000,fmask=000,uid=65534,gid=65534 0 0

Dmesg:

Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
fuse init (API version 7.13)
fuse init: DCACHE_BUG enabled
scsi 0:0:0:0: Direct-Access     QDI      U2Disk           2.00 PQ: 0 ANSI: 2
sd 0:0:0:0: [sda] 256000 512-byte logical blocks: (131 MB/125 MiB)
usb-storage: device scan complete
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI removable disk

The error:

mount: mounting /dev/sda1 on /mnt/disc0_1 failed: No such device

Also /etc/init.d/fstab fails to mount it, but immediate manual mount -a mounts the device successfully.

Any hints what can be wrong?

Thank you.

Are you using /etc/config/fstab?

Hi Dogge,

yes, I do:

root@OpenWrt:~# uci show fstab
fstab.automount=global
fstab.automount.from_fstab=1
fstab.automount.anon_mount=1
fstab.autoswap=global
fstab.autoswap.from_fstab=1
fstab.autoswap.anon_swap=0
fstab.@mount[0]=mount
fstab.@mount[0].enabled_fsck=0
fstab.@mount[0].enabled=1
fstab.@mount[0].target=/mnt/disc0_1
fstab.@mount[0].fstype=ntfs-3g
fstab.@mount[0].options=umask=000,dmask=000,fmask=000,uid=65534,gid=65534
fstab.@mount[0].device=/dev/sda1
fstab.@swap[0]=swap
fstab.@swap[0].device=/dev/sda2
fstab.@swap[0].enabled=0

Check whether "block-hotplug" is installed. USB needs delayed mounting.

block-hotplug is installed...

 opkg list-installed | grep hotplug
block-hotplug - 0.1.0-1
hotplug2 - 1.0-beta-1

As I said before, I am able to mount -a manually, but running /etc/init.d/fstab or adding mount -a command to any script fails. I cannot explain why it happens so.

@meta96: Thank you, but that does not work either.
/etc/init.d/fstab

start() {
    config_load fstab
    mkdir -p /var/lock
    lock /var/lock/fstab.lck
    # echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
    lock -u /var/lock/fstab.lck
    config_foreach do_mount mount
    config_foreach do_swapon swap
    mount -a
}

(see, I tried to add "mount -a" to the script)
Result:

root@OpenWrt:~# /etc/init.d/fstab restart
umount: /mnt/disc0_1: not mounted
mount: mounting /dev/sda1 on /mnt/disc0_1 failed: No such device
mount: mounting /dev/sda1 on /mnt/disc0_1 failed: No such device
root@OpenWrt:~# mount -a
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
none on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=14832k)
tmpfs on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,relatime)
mini_fo:/overlay on / type mini_fo (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /mnt/disc0_1 type fuseblk (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)

The discussion might have continued from here.