Yun offline when plugin SD card

Hi

I bought a new SD card and pluged it into the Yun.
After that, the webinterface "LuCi" showed me the new card as something like "/mnt/sda1".

After that, I went through the "ExpandingYunDiskStorage-Tutorial" but it ended with an error called something like "err. disk swap".

Since then, everytime when I reset OpenWrt (or reset to factory settings) and the SD-card is plugged in, then I can't reach the Yun by arduino.local anymore. When I plugout the SD card then I can reach him again.

I also tried to format the SD card on my Windows-PC with the Partitionsoftware "MiniTool". I tried with "first partition FAT, second EXT4", I also tried "first partition FAT32, second EXT4" but it did not help, I still can't reach the Yun when the SD card is pluged in.

Has anyone an idea what I do wrong ?

Kind regards
Alain

Your first step is to undo the effects of the expansion process as described in the thread: How to expand the storage memory on the Yun.

[quote author=Federico Fissore date=1398843712 link=msg=1702476]If you encounter any error and would like to restore your yun to its previous state, all you need to do is to reboot it with the SD card UNplugged, then edit file /etc/config/fstab removing the following section

config mount
 option target '/overlay'
 option device '/dev/sda2'
 option fstype 'ext4'
 option enabled '1'
 option enabled_fsck '0'
 option options 'rw,sync,noatime,nodiratime'

and reboot once more
[/quote]

Once you've done that, you can try again. The process will reformat your SD card and copy over the necessary files. Just formatting the card on your computer isn't really going to help as it will be missing the necessary system files.

Now, it's quite possible that repeating the process will repeat the error. Try editing the sketch and turning on the debug flag, then post all of the output, including all error messages:

It may be best to post the output in the original disk expander thread?

Alain:
Hi

I bought a new SD card and pluged it into the Yun.
After that, the webinterface "LuCi" showed me the new card as something like "/mnt/sda1".

After that, I went through the "ExpandingYunDiskStorage-Tutorial" but it ended with an error called something like "err. disk swap".
...

Reset to factory default settings:

remove SD card.

reset-to-factory-anyway
reboot

Reset to factory default settings

Format SD with EXT4:

opkg update
opkg install e2fsprogs fdisk
dd if=/dev/zero of=/dev/sda bs=4096 count=10
(echo n; echo p; echo 1;  echo;  echo; echo w)  | fdisk /dev/sda
umount -f  /mnt/sda1
mkfs.ext4 /dev/sda1

Expand the Storage:

wget -O simplesd.sh https://www.dropbox.com/s/jl4oytptxrb6q5u/simplesd.sh?dl=0 --no-check-certificate
/bin/ash simplesd.sh

Expand the Storage

@ShapeShifter
The YunDiskSpaceExpander-Sketch stops at "Starting Bridge...". I guess thats because as soon as I plugin the SD Card the Yun gets offline. This also means I get no DEBUG-messages.

It seems that the SD Card blocks everything as soon as it's pluged in.

By the way, the /etc/config/fstab contains this on my Yun:

config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 0

@sunnyyu
See my first post: As soon as I plug in the SD Card the Yun gets offline. This means when I set it to factory settings, then plugin the SD Card, after that I can't reach it anymore by the Terminal (Putty). This also means that I can't format the SD Card via Terminal.
I tried to format the SD Card with the partition software "MiniTool" on my Windowscomputer, using the Ext4 Filesystem, but it didn't solve the problem, I still cannot reach the Yun as soon as the SD Card is pluged in.

Do you have any other idea how to get it to work again ?

Kind regards

I found the solution:
Formating the SD Card with the Software MiniTool is NOT a good way to go.
Better you use the software "SD Card Formatter" and Arduino will regognize the card again and will not get offline when plug in the card :wink:

Kind regards
Alain

Alain:
...
@sunnyyu
See my first post: As soon as I plug in the SD Card the Yun gets offline. This means when I set it to factory settings, then plugin the SD Card, after that I can't reach it anymore by the Terminal (Putty). This also means that I can't format the SD Card via Terminal.
I tried to format the SD Card with the partition software "MiniTool" on my Windowscomputer, using the Ext4 Filesystem, but it didn't solve the problem, I still cannot reach the Yun as soon as the SD Card is pluged in.

Do you have any other idea how to get it to work again ?

Kind regards

I will try exchange an other SD Card first.

Dependent Yun revision, early revision Yun has SD card socket QC (Quality control) problem. Make sure card and socket contact well.

B.T.W. you are still able to Terminal by load YunSerialTerminal

https://www.arduino.cc/en/Tutorial/YunSerialTerminal

Get output of YunSerialTerminal

dmesg |grep scsi
[    4.000000] scsi0 : usb-storage 1-1.4:1.0
[    5.020000] scsi 0:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0

@sunnyyu
Thanks for the usefull hint.

After formating the SD Card with Formatter i can see the SD Card on the LuCI Webplattform, see here:

Then I went through the steps you discribed in your post above (date Feb 05, 2016, 04:24 pm ) until I reached this Linuxline.

root@Arduino:/# (echo n; echo p; echo 1;  echo;  echo; echo w)  | fdisk /dev/sda

I get this output:

Welcome to fdisk (util-linux 2.21.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x939f63be.

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-30318591, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-30318591, default 30318591): Using default value 30318591
Partition 1 of type Linux and of size 14.5 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
root@Arduino:/#

What does that mean ?

Why do you write "/dev/sda" while my SD Card is "/dev/sda1" ?

Alain:
Why do you write "/dev/sda" while my SD Card is "/dev/sda1" ?

If you know your drive is /mnt/sda1, then it's best to use that, especially when doing operations like that.

The issue is that in some cases the card may be mounted as /mnt/sda2 (though I've only seen it once, and I think I was using a USB thumb drive at the time.) The Linux system tries to makes it easier for you, and defines /mnt/sda as a link to the first drive it finds that has an /arduino/ folder at the root of the drive. This gives a convenient way to access the card, even if it's device name should change.

However, that works only if there really is an /arduino/ folder. If you had just formatted the card, it won't be there, and /mnt/sda probably doesn't point anywhere. That could be the cause of your failure?

@ShapeShifter
I tried now with "/mnt/sda1" instead of "/mnt/sda", but I still get a warning message:

root@Arduino:/mnt/sda1/System Volume Information# (echo n; echo p; echo 1;  echo
;  echo; echo w) | fdisk /dev/sda1
Welcome to fdisk (util-linux 2.21.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-30306462, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-30306462, default 30306462): Using default value 30306462
Partition 1 of type Linux and of size 14.5 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
root@Arduino:/mnt/sda1/System Volume Information#

What does the warning message mean ?
What do I have to do now ?

When I reboot linino then it reboots over and over again and "/dev/sda1" and "mnt/sda1" is not visible anymore.
In the attachement you find the bootlog messages, maybe it helps to find the mistake.

bootlog.txt (12.3 KB)

Well, it's clear that the problem wasn't using sda vs sda1, as you still have the same issue.

Hopefully sonnyyu or another Linux guru will be along to give some help, you're outside my area of expertise.

sonnyyu:
I will try exchange an other SD Card first.

Is there something I have to consider (for example: specific manufactor,...) to get a sd card which works without any trouble with the yun ?

Kind regards
Alain

Alain:
Is there something I have to consider (for example: specific manufactor,...) to get a sd card which works without any trouble with the yun ?

Kind regards
Alain

http://forum.arduino.cc/index.php?topic=258667.0

First let me warn you that there are many fake cards floating around. The first result is a fake SanDisk 8 GB Ultra sold on Amazon by Nano-Real http://www.amazon.com/gp/product/B0085EG6OW.

  • /dev/sda - SD card
  • /dev/sda1 - first Partition
  • /dev/sdan - n th Partition
dd if=/dev/zero of=/dev/sda bs=4096 count=10

Deleting All Partitions from SD card - /dev/sda

(echo n; echo p; echo 1;  echo;  echo; echo w)  | fdisk /dev/sda

Format first Partition of SD card - /dev/sda1

umount -f  /mnt/sda1

Force umount /mnt/sda1

mkfs.ext4 /dev/sda1

Format first Partition - /dev/sda1 as ext4.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

After reboot, everything should be fine.

@sonnyyu

Reffering to your post #12:
Every step worked.

After that I started this:

root@Arduino:~# wget -O simplesd.sh https://www.dropbox.com/s/jl4oytptxrb6q5u/si
mplesd.sh?dl=0 --no-check-certificate

And then this:

root@Arduino:~# /bin/ash simplesd.sh

An then I did get this:

Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check passed.
Package e2fsprogs (1.42.4-1) installed in root is up to date.
Package fdisk (2.21.2-1) installed in root is up to date.
Start
10+0 records in
10+0 records out
Welcome to fdisk (util-linux 2.21.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x5a9ebd6c.

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-30318591, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-30318591, default 30318591): Using default value 30318591
Partition 1 of type Linux and of size 14.5 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
umount: can't forcibly umount /mnt/sda1: Invalid argument
mke2fs 1.42.4 (12-June-2012)
Could not stat /dev/sda1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
mount: mounting /dev/sda1 on /mnt/sda1 failed: No such file or directory
./
./bin/
./bin/ash
./bin/busybox
./bin/cat
./bin/chgrp
./bin/chmod
./bin/chown
./bin/cp
./bin/date
./bin/dd
./bin/df
./bin/dmesg
./bin/dnsdomainname
./bin/echo
./bin/egrep
./bin/false

...


./mnt/sda1/mnt/sda1/lib/modules/3.3.8/nf_conntrack.ko
tar: write error: No space left on device
cfg044d78
uci: I/O error
root@Arduino:~#

What did I do wrong ?
Do I have to mount the new partition (ext4) first ?
How do I do that ?

sonnyyu:
...

backup & restore factory default setting.

reset-to-factory-anyway

reboot -f

I will try exchange an other SD Card first. then start over.

I tried again and this time "/bin/ash simplesd.sh" endet and rebooted with this:

...
./www/luci-static/resources/xhr.js
./.gnupg/
./.gnupg/random_seed
./.gnupg/pubring.gpg
./.gnupg/secring.gpg
./.extroot.md5sum
cfg044d78
root@Arduino:~#

Is this correct or is this an error ?

sonnyyu:

  • /dev/sda - SD card
  • /dev/sda1 - first Partition
  • /dev/sdan - n th Partition

D'oh! :-[ I was talking about the mounted file systems (/mnt/sd*) while the disk management code was talking about the device interface (/dev/sd*)

My apologies for the confusion!

I tried now the YunDiskSpaceExpander-Sketch with a new SD Card (this time it's a SanDisk 8GB, first try was Kingston 16GB).

Because I didn't wanna do something wrong I entered 500MB (suggestion of the Sketch) for the Data-Partition and 256MB for the Memory-Partition.
I still don't know what's meaned by "Data-Partition", is the Partition for User Data only ?
And what's the "Memory-Partition" for ? Is it for Linio Systemfiles ?

LuCI shows me this now:

Does it use all the 8 GB of the SD Card now or only the 500 MB ?
If no, what's the amount for partitionsize I can enter, without getting into some errors, for the first (Data-Partition) and the seconde Partition (Memory-Partition) ?

Kind regards
Alain

The missbehaving is back ! :frowning:
After turning on the Yun this morning it keeps rebooting and rebooting again (see the log-file in the attachement).

Whats wrong ? Has anybody an idea ?

log_SD_Card_8GB_01_100216.txt (12.3 KB)