Yun loses Wifi settings after boot

Hi everybody,

I have a "small" problem with my Yun and after searching the forum I couldn't find something similar. The problem is at follows.

I have a Yun and I moved the root to SD following this link http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace All went fine or at least looked like. The Yun acts as an access point and bridges the wan (on eth1) with lan (on wifi). Untill this point works perfect. I can connect to the wifi of yun and have access to the internet like on a regular router AP. Now comes the "funky" part. If I disconnect the Yun, or reboot it, it returns to the standard SSID (ArduinoYun and no password for wifi) but it keeps the new name of the device and the password for webinterface, also keeps in memory the bridge thing becoming a free wifi hotspot for my neighbors.

What can I do to keep the SSID and password after I reboot or disconnect the yun? It is annoying to have to set up every morning the SSID and password.

Here I found only the file for the default SSID https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/yun-scripts/files/etc/init.d/rename-wifi-if-access-point#L12 but does not help me too much to hard-code the new SSID as long as is still have to setup the password.

Has to do with this file? https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/yun-scripts/files/usr/bin/wifi-reset-and-reboot If yes, where should I put the key and the encryption? - I don't know too much about linux commands, I am in learning process.

Thank you for your answers, Christian

Almost caught: the file is this https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/yun-scripts/files/usr/bin/wifi-live-or-reset

when the yun starts, it expects wifi to work withing 60 seconds. "work" means either it was able to connect to your home wifi or its own access point was set up. During these 60 seconds, the wland led blinks

If you want to disable wifi http://playground.arduino.cc/Hardware/Yun#disable_wifi

Thank you for your answer.

So you think if I modify the MAX_SLEEP=60 to something bigger I will have success?

My intention is not to disable the wifi but just to keep the settings (the SSID, country code and encryption) from one use to the other, without having to set it every time I start the yun. I noticed that it takes quite a time until the yun boots.

Thank you

Edit

Everytime I boot the yun I get this message "There was a problem last time I tried configuring wireless network."

and this is the log

[   40.960000] Error: Driver 'gpio-keys-polled' is already registered, aborting...

Since I was not able to figure how to configure https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/yun-scripts/files/usr/bin/wifi-live-or-reset to have the configuration I want - meaning AP with my custom password and SSID because whatever I did it always went to rename-wifi-if-access-point, meaning this file https://github.com/arduino/openwrt-packages-yun/blob/master/arduino/yun-scripts/files/etc/init.d/rename-wifi-if-access-point I decided to apply brute force, where is no brain you need just muscles :blush: so I modified it . The downside is that I have to wait for the live or reset first to decide that it needs to rename the wifi because is AP, the good side is that having no brains I can get a bigger hammer and cut the timer to 0 in that file (instead of 60) so I waste no time ]:D

#!/bin/sh /etc/rc.common

START=18

start() {
    MODE=`/sbin/uci get wireless.@wifi-iface[0].mode`
    SSID=`/sbin/uci get wireless.@wifi-iface[0].ssid`

    if [ "$MODE" == "ap" -a "$SSID" == "Arduino" ]
    then
        #SSID_SUFFIX=`/sbin/ifconfig wlan0 | /usr/bin/head -n 1 | /bin/grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | /bin/sed 's/://g'`
        #SSID="Arduino Yun-$SSID_SUFFIX"
        #/sbin/uci "set" "wireless.@wifi-iface[0].ssid=$SSID"
        /sbin/uci "set" "wireless.@wifi-iface[0].ssid=mySSID"
        /sbin/uci "set" "wireless.@wifi-iface[0].encryption=psk-mixed"
        /sbin/uci "set" "wireless.@wifi-iface[0].key=mykey"
        /sbin/uci "set" "wireless.@wifi-iface[0].network=lan wan"
        /sbin/uci "set" "wireless.radio0.channel=11"
        /sbin/uci "set" "wireless.radio0.country=DE"
        /sbin/uci commit wireless
        logger -t rename "WiFi renamed $SSID"
    fi
}

if someone knows a better way, please let me know, if not, maybe someone can have a use for this.