Trouble with Wireless USB Adapter working on boot up.
Linux - Wireless NetworkingThis forum is for the discussion of wireless networking in Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Trouble with Wireless USB Adapter working on boot up.
I've gotten better at Linux and it's been a while since I have posted. But I just about gave up trying to get my Wifi USB Adapter (TP-Link Archer T1U) to connect to the WAP in the office on boot up. The online research said to use WPA supplicant and I tried to follow the instructions and modified the variable names to match what I am running. I think my issue is either a problem with it using the wrong driver when I try to start it with WPA supplicant, or a possible authentication failure. The following is the reason I type that.
After I restart the PC, or start /etc/init.d/wpa.sh manually I get the following when I check /var/log/wpa_supplicant.log
Code:
Successfully initialized wpa_supplicant
ra0: Trying to associate with e2:55:6d:5f:90:51 (SSID=<my office ssid> freq=5220 MHz)
ra0: Association request to the driver failed
ra0: Authentication with e2:55:6d:5f:90:51 timed out.
ra0: CTRL-EVENT-DISCONNECTED bssid=e2:55:6d:5f:90:51 reason=3 locally_generate
...and it just repeats itself.
Now, I have a gut feeling that the driver that is being used when I connect manually is not the same as the driver that the srcipt /etc/init.d/wpa.sh wants to use. On /etc/init.d/wpa.sh, I have:
Code:
DRIVER=wext
When I connect manually (and it works), and I use lshaw, it is using this:
If I change DRIVER=wext to DRIVER="RALINK WLAN", on /etc/init.d/wpa.sh I get a different message on the log (/var/log/wpa_supplicant.log) when I start /etc/init.d/wpa.sh. Something along the lines that this driver RLINK can't be used.
The following is what I enter manually to make this work but I need it to work automatically when it boots up.
Code:
ifconfig ra0 up
iwpriv ra0 set SiteSurvey=1
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=WPA2PSK
iwpriv ra0 set EncrypType=AES
iwpriv ra0 set SSID="<my office ssid>"
iwpriv ra0 set WPAPSK=<my preshared key>
iwpriv ra0 set SSID="<my office ssid>"
dhclient ra0
(I got this information from driver manual from the TP-LINK website)
This works great, but again, if done manually!
And yes, I've tried this with a bash script in /etc/init.d/ to see if it connects on bootup, but it doesn't work. Not sure why.
Here is some more information that may help you help me:
The same manual to me to check that the driver was installed by doing this:
...and yes, I even tried to set DRIVER=mt7650u and DRIVER=mt7650u_sta_net and DRIVER=mt7650u_sta...etc...on /etc/init.d/wpa.sh and it did not work. Got the same message as with RALINK
This is the Kernel Version and Ubuntu version I am trying to run this on:
Code:
#cat /proc/version
Linux version 3.16.0-77-generic (buildd@lcy01-24) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) #99~14.04.1-Ubuntu SMP Tue Jun 28 19:18:41 UTC 2016
(Please note that, I had to downgrade to v 14 from v 16 when I couldn't get the driver to install, per the driver specs from the TP-LINK website.)
My network configuration:
Code:
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ra0
iface ra0 inet dhcp
pre-up /etc/init.d/wpa.sh start
post-down /etc/init.d/wpa.sh stop
If I change DRIVER=wext to DRIVER="RALINK WLAN", on /etc/init.d/wpa.sh I get a different message on the log (/var/log/wpa_supplicant.log) when I start /etc/init.d/wpa.sh. Something along the lines that this driver RLINK can't be used.
Don't get yourself confused here. Your wireless hardware is supported by the mt7650u_sta driver, and wpa_supplicant does not directly communicate with the wireless device driver, but instead relies on a backend to interface to the driver. The wext backend is largely now deprecated, but some older drivers such as yours still depend on it for operation. Newer wifi dirvers/hardware use the nl80211 backend and the cfg80211 kernel module to communicate with the driver.
Don't get yourself confused here. Your wireless hardware is supported by the mt7650u_sta driver, and wpa_supplicant does not directly communicate with the wireless device driver, but instead relies on a backend to interface to the driver. The wext backend is largely now deprecated, but some older drivers such as yours still depend on it for operation. Newer wifi dirvers/hardware use the nl80211 backend and the cfg80211 kernel module to communicate with the driver.
This helped me read to learn further. The wpa_supplicant script creates an IPC communication process between the kernel and the userspace (backend). I also learned that nl80211 that works with cfg80211 but no longer use ioctl, but instead are used by netlink at the back end. I used to get errors on
Code:
/var/log/wpa_supplicant.log
stating that ioctl doesn't recognize ra0, when I tried to incorrectly set the driver name, instead of the back end APIs. This told me that wpa_supplicant is using ioctl and not netlink that nl80211 and cfg80211 work with. If this is the case, then I may only be able to use wext, for this older driver.
Unless you have another suggestion, I'm going to see if I can use iw or hostapd as alternative backend components that use netlink libraries to see if I get better luck communicating with this driver from the backend. Let me see how I can install one at a time and see if I can make it work.
GREAT LEARNING EXPERIENCE, I'll keep you posted on the results. Thanks again!
Glad to have been of help with the learning. I had a quick look at the guide you were working from, but I think the guide I linked to uses a simpler approach for connecting with wpa_supplcant and shows how to implement the wext backend as part of the wireless configuration. It relies only on minimal /etc/wpa_supplicant.conf and /etc/network/interfaces configuration, and easy to follow.
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ra0
iface ra0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
I bounced the ra0 interface:
Code:
#ifdown ra0
#ifup ra0
This is what I got on the log tail -f /var/log/syslog
Code:
Jan 23 17:38:14 clockinout2-OptiPlex-3020 wpa_supplicant[2947]: Successfully initialized wpa_supplicant
Jan 23 17:38:14 clockinout2-OptiPlex-3020 kernel: [ 3223.657077] /home/clockinout2/Archer_T1U_V1_150909/Archer_T1U_V1_150909/MODULE/os/linux/../../common/cmm_asic.c:2225 assert KeyIdx < 4failed
Jan 23 17:38:14 clockinout2-OptiPlex-3020 kernel: [ 3223.658223] /home/clockinout2/Archer_T1U_V1_150909/Archer_T1U_V1_150909/MODULE/os/linux/../../common/cmm_asic.c:2225 assert KeyIdx < 4failed
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: Internet Systems Consortium DHCP Client 4.2.4
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: Copyright 2004-2012 Internet Systems Consortium.
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: All rights reserved.
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: For info, please visit https://www.isc.org/software/dhcp/
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient:
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: Listening on LPF/ra0/d4:6e:0e:05:db:ae
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: Sending on LPF/ra0/d4:6e:0e:05:db:ae
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: Sending on Socket/fallback
Jan 23 17:38:14 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 3 (xid=0x7edcee74)
Jan 23 17:38:16 clockinout2-OptiPlex-3020 avahi-daemon[684]: Joining mDNS multicast group on interface ra0.IPv6 with address fe80::d66e:eff:fe05:dbae.
Jan 23 17:38:16 clockinout2-OptiPlex-3020 avahi-daemon[684]: New relevant interface ra0.IPv6 for mDNS.
Jan 23 17:38:16 clockinout2-OptiPlex-3020 avahi-daemon[684]: Registering new address record for fe80::d66e:eff:fe05:dbae on ra0.*.
Jan 23 17:38:17 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 3 (xid=0x7edcee74)
Jan 23 17:38:20 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 4 (xid=0x7edcee74)
Jan 23 17:38:24 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 11 (xid=0x7edcee74)
Jan 23 17:38:24 clockinout2-OptiPlex-3020 kernel: [ 3233.766750] ===>rt_ioctl_giwscan. 10(10) BSS returned, data->length = 1494
Jan 23 17:38:35 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 8 (xid=0x7edcee74)
Jan 23 17:38:39 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Trying to associate with e2:55:6d:5f:90:51 (SSID='<my-office-ssid>' freq=5220 MHz)
Jan 23 17:38:39 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Association request to the driver failed
Jan 23 17:38:39 clockinout2-OptiPlex-3020 kernel: [ 3248.789258] ===>rt_ioctl_giwscan. 6(6) BSS returned, data->length = 892
Jan 23 17:38:39 clockinout2-OptiPlex-3020 kernel: [ 3248.789397] ==>rt_ioctl_siwfreq::SIOCSIWFREQ(Channel=44)
Jan 23 17:38:40 clockinout2-OptiPlex-3020 kernel: [ 3249.463090] PeerBeaconAtJoinAction(): HT-CtrlChannel=44, CentralChannel=>46
Jan 23 17:38:40 clockinout2-OptiPlex-3020 kernel: [ 3249.463092] PeerBeaconAtJoinAction(): Set CentralChannel=46
Jan 23 17:38:40 clockinout2-OptiPlex-3020 kernel: [ 3249.463094] AdjustChannelRelatedValue(): Input BW=1, rf_channel=46, vht_bw=1, Channel=44, vht_cent_ch=42!
Jan 23 17:38:41 clockinout2-OptiPlex-3020 kernel: [ 3250.766178] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-60, Rssi_DVGA=-59
Jan 23 17:38:41 clockinout2-OptiPlex-3020 kernel: [ 3250.766245] MT76x0_dynamic_vga_tuning(): RSSI=-60, BBP 2320=0x101014f2
Jan 23 17:38:43 clockinout2-OptiPlex-3020 kernel: [ 3251.835162] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-57, Rssi_DVGA=-58
Jan 23 17:38:43 clockinout2-OptiPlex-3020 kernel: [ 3251.835228] MT76x0_dynamic_vga_tuning(): RSSI=-57, BBP 2320=0x10101eb2
Jan 23 17:38:43 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 14 (xid=0x7edcee74)
Jan 23 17:38:44 clockinout2-OptiPlex-3020 kernel: [ 3252.864031] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-56, Rssi_DVGA=-57
Jan 23 17:38:44 clockinout2-OptiPlex-3020 kernel: [ 3252.864099] MT76x0_dynamic_vga_tuning(): RSSI=-56, BBP 2320=0x10101eb2
Jan 23 17:38:44 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Authentication with e2:55:6d:5f:90:51 timed out.
Jan 23 17:38:44 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: CTRL-EVENT-DISCONNECTED bssid=e2:55:6d:5f:90:51 reason=3 locally_generated=1
Jan 23 17:38:55 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Trying to associate with e2:55:6d:5f:90:51 (SSID='<my-office-ssid>' freq=5220 MHz)
Jan 23 17:38:55 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Association request to the driver failed
Jan 23 17:38:55 clockinout2-OptiPlex-3020 kernel: [ 3263.906263] ===>rt_ioctl_giwscan. 8(8) BSS returned, data->length = 1136
Jan 23 17:38:55 clockinout2-OptiPlex-3020 kernel: [ 3263.906409] ==>rt_ioctl_siwfreq::SIOCSIWFREQ(Channel=44)
Jan 23 17:38:55 clockinout2-OptiPlex-3020 kernel: [ 3263.920075] PeerBeaconAtJoinAction(): HT-CtrlChannel=44, CentralChannel=>46
Jan 23 17:38:55 clockinout2-OptiPlex-3020 kernel: [ 3263.920077] PeerBeaconAtJoinAction(): Set CentralChannel=46
Jan 23 17:38:55 clockinout2-OptiPlex-3020 kernel: [ 3263.920079] AdjustChannelRelatedValue(): Input BW=1, rf_channel=46, vht_bw=1, Channel=44, vht_cent_ch=42!
Jan 23 17:38:56 clockinout2-OptiPlex-3020 kernel: [ 3265.089823] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-56, Rssi_DVGA=-57
Jan 23 17:38:56 clockinout2-OptiPlex-3020 kernel: [ 3265.089892] MT76x0_dynamic_vga_tuning(): RSSI=-56, BBP 2320=0x10101eb2
Jan 23 17:38:57 clockinout2-OptiPlex-3020 kernel: [ 3266.166571] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-56, Rssi_DVGA=-57
Jan 23 17:38:57 clockinout2-OptiPlex-3020 kernel: [ 3266.166637] MT76x0_dynamic_vga_tuning(): RSSI=-56, BBP 2320=0x10101eb2
Jan 23 17:38:57 clockinout2-OptiPlex-3020 dhclient: DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 20 (xid=0x7edcee74)
Jan 23 17:38:58 clockinout2-OptiPlex-3020 kernel: [ 3267.187562] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-56, Rssi_DVGA=-57
Jan 23 17:38:58 clockinout2-OptiPlex-3020 kernel: [ 3267.187628] MT76x0_dynamic_vga_tuning(): RSSI=-56, BBP 2320=0x10101eb2
Jan 23 17:38:59 clockinout2-OptiPlex-3020 kernel: [ 3268.208137] @@@ BEFORE MT76x0_dynamic_vga_tuning(): rssi=-57, Rssi_DVGA=-57
Jan 23 17:38:59 clockinout2-OptiPlex-3020 kernel: [ 3268.208203] MT76x0_dynamic_vga_tuning(): RSSI=-57, BBP 2320=0x10101eb2
Jan 23 17:39:00 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: Authentication with e2:55:6d:5f:90:51 timed out.
Jan 23 17:39:00 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: CTRL-EVENT-DISCONNECTED bssid=e2:55:6d:5f:90:51 reason=3 locally_generated=1
Jan 23 17:39:00 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="<my-office-ssid>" auth_failures=1 duration=10
Jan 23 17:39:10 clockinout2-OptiPlex-3020 wpa_supplicant[2948]: ra0: CTRL-EVENT-SSID-REENABLED id=0 ssid="<my-office-ssid>"
Jan 23 17:39:10 clockinout2-OptiPlex-3020 kernel: [ 3279.025692] ===>rt_ioctl_giwscan. 7(7) BSS returned, data->length = 958
Next thing that I am thinking of doing is blacklisting drivers, but having trouble identifying them.
No, there's no need to blacklist anything- its not the issue here.
You mentioned in your opening post that you can connect manually? Can you clarify further and explain what steps or command you do here?
I also note from googling "TP-Link Archer T1U wpa_supplicant" and similar there are a lot of people experiencing connectivity issues with this device. It doesn't help that it's not supported by a mainline kernel driver. What I read is accounts of users having better success connecting to 2.4GHz wifi frequencies rather than 5GHz, but not everyone has a choice in the matter if the AP is managed by someone else for example.
The the wireless USB adapter works great if I execute the following after I turn on the machine.
ifconfig ra0 up
iwpriv ra0 set SiteSurvey=1
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=WPA2PSK
iwpriv ra0 set EncrypType=AES
iwpriv ra0 set SSID="<my office ssid>"
iwpriv ra0 set WPAPSK=<my preshared key>
iwpriv ra0 set SSID="<my office ssid>"
dhclient ra0
I got these steps straight from the driver manual that I downloaded from the TP-Link website that came with the driver itself. The only reason I wanted to blacklist drivers was to blacklist a driver for another usb wireless of another brand I wanted to try out, but it didn't work. I was a concerned that maybe this other driver would cause some type of conflict. I would not be going through all this trouble if we had extra network ports in the office to connect a cable to the PC. We ran out and they need another station for people to clock in and clock out, and to transfer data from hand held devices on Windows Mobile 5 or 6 to a mapped shared file sever in the LAN that the office uses. (Another task after I can get this resolved.) I already mapped the shared drive with CIFS and it connects on boot up just fine only if I have a network cable connected to the PC but again but we need for the wireless solution to work too. Again, since we are out of network ports and my boss doesn't want to use cheap switches to extend ports on the wall, I need to come up with a solution.
I have these commands on an bash script that I run and have thought about putting them in /init/rc.d but, I believe in not being sloppy. I would like a clean disconnect right before shutdown. The following is something I though I could make run and hold the shutdown process until it finishes:
Unless you think it isn't necessary, and I should tackle this from another angle, this may be an opportunity for me to learn how to set up the system to run the bash script with the commands at boot up BEFORE the the scripts that mounts the network drive. On shutdown, make sure I disassociate or disconnect from the WAP before it shuts down.
Ok, I think I know what is needed. It's clear that 'wpa-conf' isn't working for you here. You need to have your working commands in a script that gets called once the wireless device interface (ra0) is up. This can be done in /etc/network/interfaces using the 'post-up' directive. So something like this might be sufficient perhaps...
Code:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ra0
iface ra0 inet manual
post-up <your script>.sh
and your_scipt.sh is
Code:
#!/bin/bash
iwpriv ra0 set SiteSurvey=1
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=WPA2PSK
iwpriv ra0 set EncrypType=AES
iwpriv ra0 set SSID="<my office ssid>"
iwpriv ra0 set WPAPSK=<my preshared key>
iwpriv ra0 set SSID="<my office ssid>"
dhclient ra0
This works on restart great! Thanks! The only problem I'm having now is if I shutdown, wait a few minutes, and then start the PC again. I decided to also do a pre-down as follows:
Code:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ra0
iface ra0 inet manual
post-up <my wifi connect script>.sh
pre-down <my wifi disassociate script>.sh
Thank you for the post-up tip, looks like I'm almost there. Restart is working fine, now I need to make sure this works on start up after a power failure for example.
This works on restart great! Thanks! The only problem I'm having now is if I shutdown, wait a few minutes, and then start the PC again. I decided to also do a pre-down as follows:
Yes, it was just a minimal config to help with progressing this. Further tweaking is always possible.
Actually, 'pre-down' is just run before a given network interface goes down. The Debian guide just used that as an example of its use.
More info from the man page...
Code:
man /etc/network.interfaces
Quote:
IFACE OPTIONS
The following "command" options are available for every family and method. Each of these options can be given multiple times in a single stanza, in which case the commands are executed in the order in which they appear in the stanza. (You can ensure a command never fails by suffixing them with "|| true".)
pre-up command
Run command before bringing the interface up. If this command fails then ifup aborts, refraining from marking the interface as configured, prints an error message, and exits with status 0. This behavior may change in the future.
up command
post-up command
Run command after bringing the interface up. If this command fails then ifup aborts, refraining from marking the interface as configured (even though it has really been configured), prints an error message, and exits with status 0. This behavior may change in the future.
down command
pre-down command
Run command before taking the interface down. If this command fails then ifdown aborts, marks the interface as deconfigured (even though it has not really been deconfigured), and exits with status 0. This behavior may change in the future.
post-down command
Run command after taking the interface down. If this command fails then ifdown aborts, marks the interface as deconfigured, and exits with status 0. This behavior may change in the future.
There exists for each of the above mentioned options a directory /etc/network/if- <option>.d/ the scripts in which are run (with no arguments) using run-parts(8) after the option itself has been processed. Please note that as post-up and pre-down are aliases, no files in the corresponding directories are processed. Please use if-up.d and if-down.d directories instead.
All of these commands have access to the following environment variables.
IFACE
physical name of the interface being processed
LOGICAL
logical name of the interface being processed
ADDRFAM
address family of the interface
METHOD
method of the interface (e.g., static)
MODE
start if run from ifup, stop if run from ifdown
PHASE
as per MODE, but with finer granularity, distinguishing the pre-up, post-up, pre-down and post-down phases.
VERBOSITY
indicates whether --verbose was used; set to 1 if so, 0 if not.
PATH
the command search path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Additionally, all options given in an interface definition stanza are exported to the environment in upper case with "IF_" prepended and with hyphens converted to underscores and non-alphanumeric characters discarded.
When ifupdown is being called with the --all option, before doing anything to interfaces, if calls all the hook scripts ( pre-up or down) with IFACE set to "--all", LOGICAL set to the current value of --allow parameter (or "auto" if it's not set), ADDRFAM="meta" and METHOD="none". After all the interfaces have been brought up or taken down, the appropriate scripts ( up or post-down) are executed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.