Go Down

Topic: uci , fstab, micro SD what did i wrong (Read 4916 times) previous topic - next topic

allairgoo

on a new Yun, freshly updated to the latest officiel version. the FS on the microSD is not automounted

Code: [Select]

root@Arduino:/www# 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=1
fstab.@mount[0].fstype=vfat
fstab.@mount[0].device=/dev/sda1
fstab.@mount[0].options=rw,sync,realtime
fstab.@mount[0].target=/www/sd
root@Arduino:/www# /etc/init.d/fstab start
mount: mounting /dev/sda1 on /www/sd failed: Invalid argument


Well if i mount the FS manually it works
Code: [Select]

root@Arduino:/www# mount /dev/sda1 /www/sd
root@Arduino:/www# ls /www/sd
openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin


Maybe i did something wrong

jessemonroy650

#1
Mar 29, 2015, 11:23 pm Last Edit: Mar 30, 2015, 10:05 pm by jessemonroy650
on a new Yun, freshly updated to the latest officiel version. the FS on the microSD is not automounted

::::SNIP::::
Well if i mount the FS manually it works
::::SNIP::::
Maybe i did something wrong

@allairgoo,

1) the SD does automount. It is the last script in the bootup process. You may have a loose wire, that appears to be a common problem. Check the inners of the SD mountings.

So, I would say that problem needs to be addressed first.

Jesse

Angelo9999

I agree with Jesse, maybe the contact in the microSD slot is not perfect. Please make sure that the contact 1 touches the contact 2 when the microSD is inserted.

You can find a picure of the contacts attached to the post.

https://github.com/sngl

sonnyyu


allairgoo

euh Loose wire ? so the wire would be loosed via automount at boot and not loosed when i do it manualy : this is sorcellery.

ShapeShifter

#5
Apr 01, 2015, 06:53 pm Last Edit: Apr 01, 2015, 06:56 pm by ShapeShifter
I'm not sure how the card detect works, but I guess it's possible that the automount logic is triggered by the card detect signal (the contacts in the above picture) while the manual mount command doesn't bother to check that signal? I don't know, just a thought.

My SD card automounts properly, both at boot time, and when the card is inserted after booting. You posted some command output above, mine looks different:
Code: [Select]
root@Yun1:/# 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
root@Yun1:/# /etc/init.d/fstab start
root@Yun1:/#


I notice that my show command doesn't have the second half of the output that yours shows, and my start command does not generate an error. Perhaps there is something wrong with the commands in the latter half of your list that is causing the auto mount operation to fail just like the start operation fails?

I'm not a Linux expert, I just know enough to get myself in trouble, so I don't know if this helps or not. But it does show there is a difference in our systems.

Edit: One more comment: I did run the YunDiskExpander sketch on my Yuns, so maybe that might explain the fstab differences?

allairgoo

#6
Apr 01, 2015, 09:35 pm Last Edit: Apr 01, 2015, 09:36 pm by allairgoo
I'm not a Linux expert, I just know enough to get myself in trouble, so I don't know if this helps or not. But it does show there is a difference in our systems.

I suppose , since you have use DiskExpander that the SD card is automounted by default since some part of the unix system are on it .

I don't use this, all i want is to have /mnt/sda1 mounted on /www/sd

this
Code: [Select]

fstab.@mount[0]=mount
fstab.@mount[0].enabled=1
fstab.@mount[0].fstype=vfat
fstab.@mount[0].device=/dev/sda1
fstab.@mount[0].target=/www/sd
fstab.@mount[0].options=rw,sync,realtime


should work and automatically mounted on boot.
When I use uci comit fstab it write a /etc/fstab file with the correct linux information.

But it won't be automounted on next reboot.


ShapeShifter

#7
Apr 01, 2015, 10:17 pm Last Edit: Apr 01, 2015, 10:46 pm by ShapeShifter
I suppose , since you have use DiskExpander that the SD card is automounted by default since some part of the unix system are on it .
I'm not so sure about that. The disk expander sketch creates two partitions: one for use by the system, and the other is a standard data partition that mounts as /mnt/sda1.  The EXT4 partition for the system is explicitly mounted as an overlay, while I believe the FAT data partition is auto mounted the same way as any other SD card data partition.

Quote
this
Code: [Select]

fstab.@mount[0]=mount
fstab.@mount[0].enabled=1
fstab.@mount[0].fstype=vfat
fstab.@mount[0].device=/dev/sda1
fstab.@mount[0].target=/www/sd
fstab.@mount[0].options=rw,sync,realtime


should work and automatically mounted on boot.
Did you add those lines? If so, they are not necessary, as the factory default configuration has the SD card already set to automatically mount.

As a point of reference, this is what I get when I boot my system without the SD card installed:
Code: [Select]
root@Arduino2:/# 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].target=/overlay
fstab.@mount[0].device=/dev/sda2
fstab.@mount[0].fstype=ext4
fstab.@mount[0].enabled=1
fstab.@mount[0].enabled_fsck=0
fstab.@mount[0].options=rw,sync,noatime,nodiratime
root@Arduino2:/#

Those last lines (with the @mount[0]) were added by the disk expander sketch to mount the ext4 system partition as part of the overlay process. It does not mount the FAT partition of the SD card as sda1. If you remove those lines that are specific to the overlay, you end up with the standard fstab info I posted earlier (the version that is in effect once the overlay is loaded and the system on the SD card takes over.) To disable the overlay and "undo" the disk expansion, those added lines are deleted to return to "normal" configuration.

So I ask again: did you add those lines at the end? If so, remove them and try again.

jessemonroy650

#8
Apr 02, 2015, 02:08 am Last Edit: Apr 03, 2015, 01:17 am by jessemonroy650
@ShapeShifter & @allairgoo,
the wire that needs to make contact is a microswitch. It is intended for hot swapping.

I don't have a full trace on this, so some of this is based on my guesses according to
standard architecture.

S99usd is the last script to run during the bootup process. The uSDaemon it calls is locate in /sbin/. It is a script (see below).
Code: [Select]

#!/bin/sh /etc/rc.common
# Copyright (C) 2013 DogHunter

START=99
STOP=99

status() {
oi=$(pidof uSDaemon)
if [ "x$oi" == "x" ]; then
echo "uSDaemon is not running"
else
echo "uSDaemon is running ($oi)"
fi
}

start() {
oi=$(pidof uSDaemon)
if [ "x$oi" == "x" ]; then
echo "Start uSDaemon"
nice -n 10 /sbin/uSDaemon &
else
echo "uSDaemon is already running ($oi)"
fi
}

stop() {
kill $(pidof uSDaemon)
}

EXTRA_COMMANDS="status"
EXTRA_HELP=" status  Print the status of the service"


In the comments for uSDaemon you'll see:
https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/uSDaemon/files/sbin/uSDaemon
Code: [Select]

# This is the uSDaemon. It is a little daemon used to automatically discover
# the uSD card presence in the on-board reader. The default configuration of
# this daemon *only* look for the specific USB-uSD-reader that is welded at
# the USB geographical address '1-1.4:1.0'. The user can change the
# evironment variable 'USBDEVICE' to work with another address. The daemon
# is limited in this way because external USB devices work with the
# 'block-mount' package within OpenWRT


What's not clear is why the microswitch has to work. But we can surmise from the Overlay filesystem, that it (the overlay filesystem) must be in place for any *user* changes to take place. To remind yous, the base file system is READ ONLY, and changes that are made by the *user* are written to the Overlay.

Next, as USB, and in this case uSD (microSD), is electrically visible, but without a special BIOS it does NOT boot first or second in the sequence. So I am guessing the Microswitch helps place the uSD at that special address '1-1.4:1.0', otherwise it gets a wildcard address.

Jesse





allairgoo

well :

Code: [Select]

root@yun:~# 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=1
fstab.@mount[0].fstype=vfat
fstab.@mount[0].device=/dev/sda1
fstab.@mount[0].target=/www/sd
fstab.@mount[0].options=rw,sync,realtime
root@yun:~# /etc/init.d/fstab start
mount: mounting /dev/sda1 on /www/sd failed: Invalid argument



what is my invalid argument in these ?

ShapeShifter

I'm not sure how the card detect works, but I guess it's possible that the automount logic is triggered by the card detect signal (the contacts in the above picture) while the manual mount command doesn't bother to check that signal? I don't know, just a thought.
I tried a little experiment, sticking some paper insulators between the leaves of the socket's card detect contacts. With the insulator in place, simulating the mis-adjusted contacts that some have reported, the card does not auto mount, nor does it manually mount.

So, I think that pretty much disproves my previous theory. If the card can mount manually, as the OP states, then I doubt the card detect contacts are the cause for the lack of auto mounting.

From looking at the code for the auto mount daemon that Jesse tracked down, it's clear that it is not looking at this switch. It looks to see if there is an unmounted card at /sys/bus/scsi/drivers/sd/*/block/sd? and then mounts it if any are found.

So, there must be some other process that finds the card and detects it as being connected to /sys/bus/scsi and creates that low-level connection. Whatever process that is, perhaps that's the one that's looking at the detect switch?

But I'm thinking it really doesn't matter, since the card can't be manually mounted without the card detect switch, but the OP can manually mount the card.

At this point, I'm keying on this error message from the first post:
Code: [Select]
root@Arduino:/www# /etc/init.d/fstab start
mount: mounting /dev/sda1 on /www/sd failed: Invalid argument

I'm theorizing that the card is properly detected, and the automount process is running, but it's failing because of an error in the fstab data. I'm guessing if we can get rid of that error when trying to manually start things, it will work automatically.

If there is someone who has a fresh Yun, which hasn't run the disk expander sketch, could you please run the commands from the first code block in the first post and show us the output? It would be helpful to have another data point.

what is my invalid argument in these ?
Precisely.  I think that's the question that must be answered.

allairgoo

may i precise, that it worked like a charm on 2 others Yun (not upgraded) for months with some reboot, and that on 2 new Yun feshly opened from the box, upgraded to the lastest Linino distribution throw me this error.

ShapeShifter

may i precise, that it worked like a charm on 2 others Yun (not upgraded) for months
Interesting. What does the uci show fstab command output for the two non-upgraded working Yuns say?

allairgoo

Interesting. What does the uci show fstab command output for the two non-upgraded working Yuns say?
on these yun , uci show fstab , shows :
Code: [Select]

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


the SD card is automounted , and my link /www/sd to /mnt/sda1 works at boot

ShapeShifter

As I suspected. So I wonder where that second set of lines in the problem unit's listing case from? It would seem that they are the culprit?

Go Up