WiFi Unreliable When Booting Into Maintenance Mode

Black Hole

May contain traces of nut
(NB: this thread was spawned from https://hummy.tv/forum/threads/wifi-static-manual-gateway-ip-occasionally-incorrect-on-startup.9657/)

I had to implement this excellent change offered by @/df to get seamless WiFi connection.
If I can reproduce the problem I was having, I will see whether the tweak affects it... but as the problem appears to be intermittent, how will I know what the actual cause is and whether the tweak was responsible for curing it?
Okay, well, this morning I've had two failures to connect to the Maintenance Mode web page out of three attempts. According to the router, the relevant MAC is connected to the WiFi network, but has not been assigned an IP address. What? The IP address is configured as manual at the HDR-FOX.

I have implemented the changes to S00wlan (etc) and it has made no difference. Booted into MM and again the router reports the existence of the MAC but no assigned IP. I'll have to come back to it later and check I really did implement the changes.
 
Last edited:
Okay, well, this morning I've had two failures to connect to the Maintenance Mode web page out of three attempts. According to the router, the relevant MAC is connected to the WiFi network, but has not been assigned an IP address. What? The IP address is configured as manual at the HDR-FOX.

I have implemented the changes to S00wlan (etc) and it has made no difference. Booted into MM and again the router reports the existence of the MAC but no assigned IP. I'll have to come back to it later and check I really did implement the changes.
Double check you've applied the changes suggested by @/df , solution in #11 https://hummy.tv/forum/threads/wifi...onally-incorrect-on-startup.9657/#post-139964

I've amended my post#20 https://hummy.tv/forum/threads/wifi...ionally-incorrect-on-startup.9657/post-139994 to clarify the changes I made, they're in the last 3-4 paragraphs.
 
Last edited:
Double check you've applied the changes suggested by @/df
Seem fine to me, check for yourself...

/mod/etc/init.d/S00wlan - Executable
Code:
#!/bin/sh

export PATH=/mod/bin:/mod/usr/bin:/mod/bin/busybox:/bin:/sbin

exec >/mod/tmp/wlan.log 2>&1

echo "++++++++++++++ S00wlan - `date` ++++++++++++++"

(
    sleep 10
    if [ "`cat /etc/modversion`" -lt 302 ]; then
        /mod/sbin/wifi-up
    else
#        /sbin/wifi-up
        /mod/sbin/wifi-up-test
    fi
) &

exit 0

/mod/sbin/wifi-up-test - Executable
Code:
#!/bin/sh

export PATH=/sbin:/bin
unset LD_LIBRARY_PATH

wid="`iwgetid`"
if [ $? -ne 0 ]; then
    echo "No wireless dongle detected."
    exit 0
fi

eth_check()
{
    # If the Ethernet interface has no link, disable it.
    if ifconfig eth0 | grep -q RUNNING; then
        echo "Link found on eth0."
    else
        echo "No link found on eth0, disabling."
        ifconfig eth0 down
        # Refresh hosts file
        /sbin/modinit setup_hosts
    fi
}

wif="`echo $wid | sed 's/ .*//'`"
essid=`echo $wid | cut -d\" -f2`

echo "Wireless interface: $wif"

if [ -n "$essid" ]; then
    echo "Already connected to '$essid'"
    eth_check
    exit 0
fi

wset()
{
    echo "Set $1=$2"
    iwpriv $wif set $1=$2
}

ifconfig $wif up
wset NetworkType Infra

# 0 None
# 1 WEP 64-bit Hex
# 2 WEP 64-bit ASCII
# 3 WEP 128-bit Hex
# 4 WEP 128-bit ASCII
# 5 WPA-PSK(TKIP)
# 6 WPA-PSK(AES)
# 7 WPA2-PSK(TKIP+AES)
# 8 WPA2-PSK(AES)
# AuthMode                {OPEN,SHARED,WEPAUTO,WPAPSK,WPA2PSK,WPANONE}
# EncrypType              {NONE,WEP,TKIP,AES}

authmode="`swifi auth`"
case $authmode in
    0)
        wset AuthMode OPEN
        wset EncrypType NONE
        ;;
    1|2|3|4)
        wset AuthMode SHARED
        wset EncrypType WEP
        ;;
    5)    wset AuthMode WPAPSK
        wset EncrypType TKIP
        ;;
    6)    wset AuthMode WPAPSK
        wset EncrypType AES
        ;;
    7)    wset AuthMode WPA2PSK
        wset EncrypType TKIP
        ;;
    *)    wset AuthMode WPA2PSK
        wset EncrypType AES
        ;;
esac

ssid=`swifi ssid`
psk=`swifi key`
wpakey=`wpa_passphrase "$ssid" "$psk" | sed -n '4 { s/.*=//; p }'`

wset SSID $ssid
wset WPAPSK $wpakey
wset SSID $ssid

if [ "`swifi manual`" = 1  ]; then
    echo "Manual config:"
    set -x
    eth_check
    ifconfig $wif "`swifi ip`" netmask "`swifi mask`" up
    route add -net default gw "`swifi gw`"
    echo "nameserver `swifi dns`" > /etc/resolv.conf
else
    eth_check
    echo "DHCP:"
    udhcpc -t 5 -T 10 -p /var/lib/humaxtv/udhcpc.$wif.pid -i $wif &
    sleep 7
fi
 
Seem fine to me, check for yourself...
....
That does look ok.
Unfortunately I'm out of ideas.
Other than triple checking eg
Code:
ls -l /sbin/wifi-up   /mod/etc/init.d/S00wlan   /mod/sbin/wifi-up-test
My WiFi did have issues 10-20% of the time on reboot.
eg normal reboot would sometimes get this #32 https://hummy.tv/forum/threads/wifi...-incorrect-on-startup.9657/page-2#post-141908 and maintenance mode sometimes didn't have WiFi connection.

I haven't notice issues since this fix.
I have these packages installed - wireless-helper, wireless-tools, wpa-supplicant
 
Last edited:
I have these packages installed - wireless-helper, wireless-tools, wpa-supplicant
Yep, got all those

My WiFi did have issues 10-20% of the time on reboot.
eg normal reboot would sometimes get this #32 https://hummy.tv/forum/threads/wifi...-incorrect-on-startup.9657/page-2#post-141908 and maintenance mode sometimes didn't have WiFi connection.
My "issue" only seems to happen in MM, and not always.

As said previously, when it manifests there is a line in the router's "connected devices" list which corresponds with the appropriate MAC (which I guess is the MAC of the USB WiFi dongle) without any allocated IP address. I therefore conclude that the dongle is autonomously seeing and registering itself on the WiFi network, but the HDR-FOX is not communicating through the dongle to establish an IP link to the router.

To me, this "feels like" a timing issue. Could it be that the MM boot tries to establish a network link before the dongle is ready, then gives up and does not retry later?
 
Last edited:
..
My "issue" only seems to happen in MM, and not always.

As said previously, when it manifests there is a line in the router's "connected devices" list which corresponds with the appropriate MAC (which I guess is the MAC of the USB WiFi dongle) without any allocated IP address. I therefore conclude that the dongle is autonomously seeing and registering itself on the WiFi network, but the HDR-FOX is not communicating through the dongle to establish an IP link to the router.

To me, this "feels like" a timing issue. Could it be that the MM boot tries to establish a network link before the dongle is ready, then gives up and does not retry later?
You may find the issue is more obvious in MM because of the lack of connection from that HDR to both internal and external network.
It shows up on normal reboot but slightly differently. HDR to the internal network works, but HDR to external network won't - hence why it can't find updates (when this happened, the Manual gateway IP mysteriously got set to zeros).

Regarding the timing issue - I thought that was why we need wireless-helper.
As an experiment maybe try using DHCP instead of Manual IP for that HDR wireless?
 
I have an entire modified WiFi startup script that has further features like persistent settings and correct wifi channel selection. I should get the latest version from my HD Fox-T2 that is prone to uncommanded resets and has been successfully testing it...
This...

It expects WebIf to be there, and wireless-tools and wpa_supplicant, and /sbin/swifi from the CF. Should be a candidate for wireless-helper 2.0.
 

Attachments

  • wifi-up.tgz
    4 KB · Views: 6
Last edited:
  • wireless-tools ✓︎
  • wpa_supplicant ✓︎
  • /sbin/swifi ✓︎
Happy to test wifi-up.tgz if you give me instructions.
 
Just extract it over your /mod directory. It may be safer to extract it into /tmp and move the items individually (some go into the flash filesystem(s) linked from /mod/boot). To recover, force reinstall wireless-helper.
 
I'm not getting on very well...
Code:
HDRFOX4# unzip wifi-up.tgz                                                                                                                                                 
Archive:  wifi-up.tgz                                                                                                                                                     
  End-of-central-directory signature not found.  Either this file is not                                                                                                   
  a zipfile, or it constitutes one disk of a multi-part archive.  In the                                                                                                   
  latter case the central directory and zipfile comment will be found on                                                                                                   
  the last disk(s) of this archive.                                                                                                                                       
unzip:  cannot find zipfile directory in one of wifi-up.tgz or                                                                                                             
        wifi-up.tgz.zip, and cannot find wifi-up.tgz.ZIP, period.
 
I used something like
Code:
cd tmp
tar -xvf wifi-up.tgz
But I have either messed something up or spotted a couple of oddities.
After tar, the extracted files are
  • mod/etc/init.d/S00wlan
  • mod/boot/xinit.d/wifi
  • mod/boot/2/wifi-up
They have odd owner 1000 default - which I don't know matters or is intentional.
But also this file is incorrect - mod/boot/xinit.d/wifi
Code:
#!/bin/sh

mount --bind \
        /var/lib/humaxtv_backup/mod/wifi-up \
        /sbin/wifi-up

Should it be something like this instead?
Code:
#!/bin/sh

mount --bind \
        /mod/boot/2/wifi-up \
        /sbin/wifi-up
Becase an error shows up
Code:
[/var/lib/humaxtv/mod/xinit.d/ahw]
AHW: Already done.
[/var/lib/humaxtv/mod/xinit.d/bootset]
Setting MENUCONFIG:AUTOMATIC_POWER_DOWN = (Value)1
Setting MENUCONFIG:DISPLAY_CRID = (Value)1
Setting MENUCONFIG:DMS_START_ON = (Value)1
Setting MENUCONFIG:INSTANT_REPLAY = (Value)305
Setting MENUCONFIG:pIN_CODE = (Text)6060
Setting MENUCONFIG:pWR_SAVING_ON_STANDBY = (Value)0
Setting MENUCONFIG:RESOLUTION = (Value)5
Setting MENUCONFIG:SKIP_FORWARD = (Value)300
Setting MENUCONFIG:SOUND_DIGITALOUTPUT = (Value)3
Setting MENUCONFIG:TV_SCART = (Value)2
Setting USERCONFIG:LCN = (Value)4
    Mapped LCN 4 to hSvc 262238
Setting USERCONFIG:CUR_SVC = (Value)262238
Setting USERCONFIG:VOLUME = (Value)10
[/var/lib/humaxtv/mod/xinit.d/dbupdate]
SQLite3: 3.7.5
[/var/lib/humaxtv/mod/xinit.d/forcedate]
[/var/lib/humaxtv/mod/xinit.d/install_dustbin]
[/var/lib/humaxtv/mod/xinit.d/install_fan]
[/var/lib/humaxtv/mod/xinit.d/install_ir3]
[/var/lib/humaxtv/mod/xinit.d/install_nugget]
[/var/lib/humaxtv/mod/xinit.d/opkg-beta]
[/var/lib/humaxtv/mod/xinit.d/rsvsync]
[/var/lib/humaxtv/mod/xinit.d/vdisk]
Loaded kernel module dummy_hcd.ko
Loaded kernel module g_file_storage.ko
[/var/lib/humaxtv/mod/xinit.d/wifi]
mount: mounting /var/lib/humaxtv_backup/mod/wifi-up on /sbin/wifi-up failed: No such file or directory
[/var/lib/humaxtv/mod/xinit.d/xota]
SQLite3: 3.7.5
Opening /var/lib/humaxtv/rsv.db
XOTA: Removing any auto-update scheduled events.
XOTA: Removed 0
Reminder checking disabled.
 
Last edited:
Use 7zip, or gzip -d -c wifi-up.tgz | tar -xvf -.
Yeah, well, maybe you could have said so when I asked for instructions :rolleyes:

Under my own steam I extracted the double-packaged file set in Windows then FTP'ed the folder across, chmod'ed the files, then individually copied them into their target folders as instructed. I've even been around and checked they are in the right places and executable.

Result: no change. Continues to show up on the router with no IP address in Maintenance Mode, but (fortunately) still connects in normal boot.
 
Last edited:
It doesn't matter - everything executes as root.
Fair enough.
I think that's a manipulation required because we are unable to write directly to the Flash file system. That path shows up automatically in my FTP client.
Obviously you just thought you'll wing it with this ludicrous answer.
What makes you think I am querying the 'manipulation' technique? Have a look at the your log.
 
Obviously you just thought you'll wing it with this ludicrous answer.
What's ludicrous about it? The path exists, so it's not obviously wrong in the file as you seemed to imply. Okay, it might be more complicated than that but all I'm saying is it's not wrong at first sight.

Have a look at the your log.
My xinit.log does not appear to contain anything useful.
 
What's ludicrous about it? The path exists, so it's not obviously wrong in the file as you seemed to imply. Okay, it might be more complicated than that but all I'm saying is it's not wrong at first sight.
...

My xinit.log does not appear to contain anything useful.
Ignorance is bliss.
 
This...

It expects WebIf to be there, and wireless-tools and wpa_supplicant, and /sbin/swifi from the CF. Should be a candidate for wireless-helper 2.0.
I've tried the new files but have some inconsistencies to report.

1. After applying the files, it made wireless connection worse for my HDR in Maintenance Mode. 10-20% of Maintenance Mode restarts failed to allocate the static IP for the wireless connection.

2. So I tried the edit of file mod/boot/xinit.d/wifi as in my post#51 https://hummy.tv/forum/threads/wifi...ionally-incorrect-on-startup.9657/post-161568. That did not work. Upon reboot it's obvious the mount still fails.

3. So, after tar, the extracted files are
  • mod/etc/init.d/S00wlan
  • mod/boot/xinit.d/wifi
  • mod/boot/2/wifi-up
I copied the first two files to their matching destinations and copied mod/boot/2/wifi-up to /var/lib/humaxtv_backup/mod/wifi-up so that the file will be at the correct place.
On reboot the mount works and cat /sbin/wifi-up shows the new file contents.
But despite this, on repeated reboots (in Maintenance Mode) - it will often loose wireless connection.

For my HDR units your solution in #11 https://hummy.tv/forum/threads/wifi...onally-incorrect-on-startup.9657/#post-139964 consistently gives very good (maybe close to 100%) results .
 
Last edited:
Back
Top