WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Problem getting wifi working - time to ask for help...  (Read 10074 times)

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Problem getting wifi working - time to ask for help...
« on: June 03, 2012, 10:33:00 PM »
I've been working on this all morning, but can't resolve this problem...

My system has been running fine for several days, I can log in locally or over the wan using SSH without a problem.  However I need to shift the unit to a spot without a lan socket, so I need to set up wifi.

I have purchased a Netgear G54/N150 wireless USB adapter (based on reported compatibility here http://forum.tinycorelinux.net/index.php/topic,12910.msg73164.html#msg73164

I am running Core in text mode only - no GUI.  Router is an oldish Dlink DI-624+ using WPA-PSK authentication, which is working fine with the windows wired and wireless clients connected to it.

As per the WIKI, I have installed:

wireless_tools.tcz
wireless-3.0.21-tinycore.tcz
firmware.tcz
wpa-supplicant.tcz

iwconfig sees the interface
Code: [Select]
tc@box:~$ iwconfig
lo        no wireless extensions.

dummy0    no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          Retry  long limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:on

I've configured /opt/wpa_configure.conf as follows
Code: [Select]
tc@box:~$ cat /opt/wpa_configure.conf
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="myssid"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="mypassword"
}
I ran filetool.sh -b after saving it.  Note: I originally had the full psk key in there, and changed to a text passphrase (as per wpa_supplicant man page), but no difference to results. I have checked and double checked the passphrase.  It must be right anyway as it connects eventually (see below).

Starting wpa_suplicant gets this:
Code: [Select]
tc@box:~$ sudo wpa_supplicant -i wlan0 -c /opt/wpa_configure.conf &
tc@box:~$ wlan0: Trying to associate with 00:11:95:0e:92:aa (SSID='mySSID' freq=2437 MHz)
wlan0: Associated with 00:11:95:0e:92:aa
wlan0: Michael MIC failure detected
wlan0: WPA: Sending EAPOL-Key Request (error=1 pairwise=1 ptk_set=1 len=99)
wlan0: Michael MIC failure detected
wlan0: WPA: Sending EAPOL-Key Request (error=1 pairwise=1 ptk_set=1 len=99)
wlan0: TKIP countermeasures started
wlan0: CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0
wlan0: Trying to associate with 00:11:95:0e:92:aa (SSID='mySSID' freq=2437 MHz)
wlan0: Associated with 00:11:95:0e:92:aa
wlan0: WPA: Countermeasures - dropped EAPOL packet
wlan0: WPA: Countermeasures - dropped EAPOL packet
wlan0: WPA: Countermeasures - dropped EAPOL packet
wlan0: WPA: Countermeasures - dropped EAPOL packet
wlan0: CTRL-EVENT-DISCONNECTED bssid=00:11:95:0e:92:aa reason=0
which loops though several times, taking about 10-15 minutes to connect.
Once connected I get this:
Code: [Select]
tc@box:~$ iwconfig
lo        no wireless extensions.

dummy0    no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"mySSID"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:11:95:0E:92:AA
          Bit Rate=54 Mb/s   Tx-Power=20 dBm
          Retry  long limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          Link Quality=34/70  Signal level=-76 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:26   Missed beacon:0

Then running udhcpc returns this:

Code: [Select]
tc@box:~$ sudo udhcpc -i wlan0
udhcpc (v1.19.4) started
Sending discover...
Sending discover...
Sending discover...
Sending discover...
Sending select for 192.168.0.104...
Sending select for 192.168.0.104...
Sending select for 192.168.0.104...

Which also repeats several times, before giving me an IP address and hence a working wifi connection.

The end result is it takes 20 minutes or more to connect to the router.  Any ideas what to change to make this useable?

Also, whenever I reboot (with the wifi adapter and lan cable plugged in), I can't SSH back in (on either eth0 or wlan0).  I have to do a hard reset to get SSH access again.  Since all configuration is via SSH this is painful, any ideas why this might be happening?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11499
Re: Problem getting wifi working - time to ask for help...
« Reply #1 on: June 04, 2012, 12:52:00 AM »
Hi herrMnnn
I seem to remember a couple of previous threads mentioning a conflict when trying to connect using wired and
wireless connections at the same time.

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #2 on: June 04, 2012, 06:43:09 AM »
Thanks Rich,

I tried unplugging the lan cable and hard restart but couldn't connect at all.  When wifi does get going I can connect via ssh so not sure what's going on there, possibly not starting wifi properly from bootlocal.sh

Random coincidence maybe, but I have bootlocal.sh send me an email on reboot, mainly so I know to check other hardware after a power fail (which we have plenty of).  However, after playing around with wifi setup, the email no longer gets sent from bootlocal, even though I can send the exact same email from the shell...

I'm trying to do everything over ssh at the moment, so tomorrow I'll take a monitor and keyboard to the office and see if I can make any sense of it while sitting in front of the box....

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Re: Problem getting wifi working - time to ask for help...
« Reply #3 on: June 04, 2012, 07:45:01 AM »
At least there also seems to be some misconfiguration with your router/WPA/TKIP setup, because
Quote
wlan0: Michael MIC failure detected
wlan0: TKIP countermeasures started
wlan0: WPA: Countermeasures - dropped EAPOL packet
shouldn't come up. Dropping packets isn't something wpa_supplicant is doing by design. There are some suggestions in the net to change wpa=>wpa2 or change the group ciphers (ccmp/tkip). Countermeasures could also be disabled in the old madwifi driver. It's possible the d-link router uses an Atheros chipset and causes the problem somehow with your device. Also I would only suggest to follow the instructions in the wpa_supplicant info file (not saying that the wiki states something wrong) and only provide SSID and PSK and leave the rest up to the program. And then maybe run wpa_supplicant with -dd to get verbose debugging output.
If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11022
Re: Problem getting wifi working - time to ask for help...
« Reply #4 on: June 04, 2012, 12:33:32 PM »
The usual problem with both wifi and eth is using dhcp for both. Please use a static IP for the ethernet in such a config.
The only barriers that can stop you are the ones you create yourself.

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #5 on: June 04, 2012, 10:31:32 PM »
Thanks for the advice, one or the other of the above suggestions solved my problem (not exactly sure which one sorry).

I'll explain what I've ended up with in case another newbie ends up at this thread...

I set a static IP for eth0 by running this script from bootlocal.sh
Code: [Select]
#!/bin/sh
kill udhcpc
ifconfig eth0 192.168.0.120 netmask 255.0.0.0 broadcast 192.168.0.255 up
route add default gw 192.168.0.1
echo nameserver 192.168.0.1 > /etc/resolv.conf

Then to get wifi running I created a new script I called /opt/wlan0.sh and added that to bootlocal.sh instead.  I followed the instructions in the wpa_supplicant inf (which are indeed slightly different to the wiki), but also set a static IP for wlan0, script as follows:

Code: [Select]
#!/bin/sh
wpa_passphrase "mySSID" "myPassphrase" > /etc/wpa_supplicant.conf
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
ifconfig wlan0 192.168.0.121 netmask 255.0.0.0 broadcast 192.168.0.255 up
route add default gw 192.168.0.1
echo nameserver 192.168.0.1 > /etc/resolv.conf

I can sudo this from the shell and it works fine, giving me a working wifi connection alongside my ethernet connection.

However it didn't work when run from bootlocal.sh.  I received the message "Could not read interface wlan0 flags: No such device".  After booting had completed iwconfig told me wlan0 is available, and if I ran /opt/wlan0.sh (my script above) I get a working wifi connection.

I have had to insert a sleep=5 into bootlocal.sh to apparently give the wifi adapter time to get itself sorted.  This is working now after repeated reboots, both soft and hard. 

If there is a more elegant solution to this script pause I'd be interested to know.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11499
Re: Problem getting wifi working - time to ask for help...
« Reply #6 on: June 05, 2012, 12:22:46 AM »
Hi herrMnnn
If you use the  nodhcp  boot code, does the wireless connect then?

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #7 on: June 05, 2012, 01:17:43 AM »
Hi herrMnnn
If you use the  nodhcp  boot code, does the wireless connect then?

Thanks Rich, but I tried adding the nodhcp bootcode and I still need the sleep=5 to let the wlan0 interface come up.

In actual use this is insignificant - the system will only reboot when I'm reconfiguring it for some reason, or after a power fail/restore, so an additional 5 seconds added to the boot time isn't a problem.  It's just that it doesn't seem right so it bugs me a little...


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11022
Re: Problem getting wifi working - time to ask for help...
« Reply #8 on: June 05, 2012, 06:28:39 AM »
It's actually quite normal to have to do that for slow devices; we do boot quite fast ;)

A more elegant solution would be a polling loop, checking every N ms whether the device is now available.
The only barriers that can stop you are the ones you create yourself.

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #9 on: July 15, 2012, 08:07:44 PM »
Just a follow up on this thread...

This wifi setup has been proving very unreliable (the TC box itself is running perfectly otherwise).

I regularly lose wifi access to it.  I'm not sure if it's due to power outages (they are very common here) - the TC box is on a UPS but the router is only on a power filter, no battery backup.

I can reboot the TC box and sometimes it will get lan access, sometimes it won't.

The router is a Linksys E1200 - I was using a Dlink but that failed (probably due to power supply issues), the problem has existed with both routers.  It has an IP address reserved for the MAC address of the TC wifi adapter so it should always get the same ip address - nothing else is using that address.

As above, I've followed the instructions in the info files, and added delays to allow the wifi adapter time to get up and running.  I now have a 20 second delay in bootlocal before starting my wlan0 script, and I added a 20 second delay in wlan0 script prior to running ifconfig , which seems over the top.  It's not working reliably in any case.  I have nodhcp added to boot code.

Can someone post a detailed explanation of a working set up? 

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Problem getting wifi working - time to ask for help...
« Reply #10 on: July 15, 2012, 11:06:15 PM »
Quote
As per the WIKI, I have installed:

wireless_tools.tcz
wireless-3.0.21-tinycore.tcz
firmware.tcz
wpa-supplicant.tcz

Something missing here..?  Just saying has not been tested with a manual configuration of wpa_supplicant but no reason it shouldn't either.

This adapter was tested with

wireless-3.0.21-tinycore.tcz
firmware.tcz
And wifi.tcz 

and is still a favorite for an intel based  notebook running 24/7

While I start wifi mostly within X have not experienced any issues in text mode.

Will test it tonight or tomorrow and get back later





Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Problem getting wifi working - time to ask for help...
« Reply #11 on: July 16, 2012, 08:37:45 PM »
Ok I verified my Netgear G54/N150 wireless USB adapter's firmware and drivers on a working setup.   Additionally plugged it into another PC just to check.

Bus 002 Device 002: ID 0846:9041 NetGear, Inc. WNA1000M 802.11bgn [Realtek RTL8188CUS]

/sys/bus/usb/drivers/rtl8192cu
/sys/module/rtl8192cu
/sys/module/mac80211/holders/rtl8192cu
/sys/module/rtl8192c_common/holders/rtl8192cu
/sys/module/rtlwifi/holders/rtl8192cu
/usr/local/lib/modules/3.0.21-tinycore/kernel/drivers/net/wireless/rtlwifi/rtl8192cu
/tmp/tcloop/wireless-3.0.21-tinycore/usr/local/lib/modules/3.0.21-tinycore/kernel/drivers/net/wireless/rtlwifi/rtl8192cu

wlan1     IEEE 802.11bgn  ESSID:"MyNet" 
          Mode:Managed  Frequency:2.432 GHz  Access Point: 00:16:E8:C5:3D:F2   
          Bit Rate=72.2 Mb/s   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          Link Quality=62/70  Signal level=-48 dBm 
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:40   Missed beacon:0

« Last Edit: July 17, 2012, 09:58:16 AM by coreplayer2 »

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #12 on: July 17, 2012, 12:00:12 AM »
Thanks coreplayer2.

here's my output from iwconfig
Code: [Select]
tc@box:~$ iwconfig
lo        no wireless extensions.

dummy0    no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"myESSID"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 20:AA:4B:43:7F:2B
          Bit Rate=72.2 Mb/s   Tx-Power=20 dBm
          Retry  long limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          Link Quality=66/70  Signal level=-44 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:72   Missed beacon:0


When it's working it works fine.  It will run like this for days no problem.  However I will frequently lose access to it via SSH/Rsync at which time a physical inspection shows the blue led off on the wifi dongle (indicating no network). I assume it's not random, and guess it's associated with something such as a reboot after power fail.  I've tried testing this by shutting the power and sometimes it reboots and gets a wifi connection, sometimes it doesn't.  Since it's largely unattended I need it to be 100% reliable on getting a connection on reboot.

What will happen if the router reboots but the TC box doesn't (since it's on battery backup)?  I'm assuming the ip address that is reserved for it's MAC will be reallocated to it, and TC will regain wifi access when the router is back up.  Is this a flawed assumption?  If so how do I deal with that?

I'd really appreciate a clear description of a working system - ie scripts and boot codes etc....

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Problem getting wifi working - time to ask for help...
« Reply #13 on: July 17, 2012, 01:34:11 AM »

     
What will happen if the router reboots but the TC box doesn't (since it's on battery backup)?  I'm assuming the ip address that is reserved for it's MAC will be reallocated to it, and TC will regain wifi access when the router is back up.  Is this a flawed assumption?  If so how do I deal with that?

I'd really appreciate a clear description of a working system - ie scripts and boot codes etc....


A statically configured IP would be a way to ensure.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: Problem getting wifi working - time to ask for help...
« Reply #14 on: July 17, 2012, 02:16:50 AM »
I "think" that is what I have set up....

in wlan0.sh I have
Code: [Select]
ifconfig wlan0 192.168.0.121 netmask 255.0.0.0 broadcast 192.168.0.255 up
route add default gw 192.168.0.1
echo nameserver 192.168.0.1 > /etc/resolv.conf

and I have my router set to reserve 192.168.0.121 for the MAC address of the wifi adapter.

I also have nodhcp bootcode set.

I'm guessing it's something I've done or haven't done, so any and all suggestions or prompts of things to check are helpful.

I just noticed I had
Code: [Select]
kill udhcp in my eth0 script (no longer used but was working fine), but not in my wlan0 script, so I've added that and will see if it makes any difference.