brunot
Posts: 1
Joined: Sat Sep 21, 2013 9:05 pm

WiFi not working using command line [Raspbian]

Sat Sep 21, 2013 9:44 pm

I'm not able to get my WiFi to work using the command line. I've read through the forums, but haven't found a solution that works yet.

I'm able to get my WiFi working using the wpa_gui...

Here's my /etc/network/interfaces:

Code: Select all

[email protected] ~ $ more /etc/network/interfaces 
auto lo
iface lo inet loopback

iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
And my wpa_supplicant.conf file:

Code: Select all

[email protected] ~ $ more /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="TRENDnet"
scan_ssid=1
psk="passphrase"
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
}
Here's where I get lost:

Code: Select all

sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -d
wpa_supplicant v1.0
random: Trying to read entropy from /dev/random
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='DIR=/var/run/wpa_supplicant GROUP=netdev'
update_config=1
Priority group 0
   id=0 ssid='TRENDnet'
rfkill: Cannot open RFKILL control device
WEXT: RFKILL status not available
SIOCGIWRANGE: WE(compiled)=22 WE(source)=16 enc_capa=0xf
  capabilities: key_mgmt 0xf enc 0xf flags 0x0
ioctl[SIOCSIWAP]: Operation not permitted
WEXT: Failed to clear BSSID selection on disconnect
netlink: Operstate: linkmode=1, operstate=5
wlan0: Own MAC address: 64:70:02:09:4c:e6
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=4 set_tx=0 seq_len=0 key_len=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Driver did not support SIOCSIWENCODEEXT
wpa_driver_wext_set_key: alg=0 key_idx=5 set_tx=0 seq_len=0 key_len=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Driver did not support SIOCSIWENCODEEXT
wpa_driver_wext_set_countermeasures
wlan0: RSN: flushing PMKID list in the driver
wlan0: Setting scan request: 0 sec 100000 usec
WPS: Set UUID for interface wlan0
WPS: UUID based on MAC address - hexdump(len=16): f0 c9 9c 58 55 2d 5a 1a 9f 7a 56 1d 7a 8a 03 ab
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Using existing control interface directory.
ctrl_interface_group=105 (from group name 'netdev')
ctrl_iface bind(PF_UNIX) failed: Address already in use
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan0
wlan0: No keys have been configured - skip key clearing
wlan0: State: DISCONNECTED -> DISCONNECTED
wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
EAPOL: External notification - portEnabled=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
wpa_driver_wext_set_countermeasures
wlan0: No keys have been configured - skip key clearing
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout
ioctl[SIOCSIWAP]: Operation not permitted
WEXT: Failed to clear BSSID selection on disconnect
netlink: Operstate: linkmode=0, operstate=6
Any help is much appreciated :)

User avatar
DavidXN
Posts: 54
Joined: Sat Sep 14, 2013 7:14 pm

Re: WiFi not working using command line [Raspbian]

Mon Sep 23, 2013 8:51 pm

Someone else may be able to provide better advice with your setup because it looks like you're at least halfway there - but I ran into problems configuring a WPA network manually as well, and ended up using the wicd configuration tool to do it automatically:

Code: Select all

sudo apt-get install wicd
wicd-curses

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: WiFi not working using command line [Raspbian]

Tue Sep 24, 2013 2:02 am

Personally, I don't use the wpa-roam or wpa-conf options. I normally set the ssid and psk in /etc/network/interfaces

Make your wlan0 like this one

Code: Select all

auto wlan0
iface wlan0 inet dhcp
wpa-ssid TRENDnet
wps-psk passphrase
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

chorlton2080
Posts: 124
Joined: Sun Dec 23, 2012 9:44 pm

Re: WiFi not working using command line [Raspbian]

Fri Oct 11, 2013 8:49 pm

How might you do this so that you have both of the the following available:

1. a wifi connection with a static IP to Router 1 (but not using the router's MAC IP reservation function)
2. a wifi connection with a DHCP connection to Router 2

dus-um
Posts: 1
Joined: Fri Nov 29, 2013 12:30 pm
Location: Germany

Re: WiFi not working using command line [Raspbian]

Fri Nov 29, 2013 1:31 pm

@brunot
Sorry for the late answer, but maybe I can help you:
If I type

Code: Select all

wpa_supplicant -d -c /etc/wpa_supplicant/wpa_supplicant.conf  -iwlan0
I receve the error like you (looks like ;-) )
The solution was, that the wlan was already startet, so i stop the wlan

Code: Select all

ifdown wlan0
and retype the first command and ... YES, here we are.
Rasperry Pi Board Model B V2, LogiLink 4-Port Hub (also for powering the Pi), Transcend Extreme-Speed SDHC 32GB Class 10 Card, HDMI to VGA Converter CM3-AK-001-2, EDIMAX EW-7811UN Wireless USB Adapter, USB mouse and keyboard; various operating systems

portlandproductions
Posts: 1
Joined: Sat Dec 28, 2013 12:33 am

Re: WiFi not working using command line [Raspbian]

Sat Dec 28, 2013 1:38 am

I had this problem for 2 frustrating days, when, after staring at the pi hopefully for around 10 solid minutes, I realized that the wifi must have some power draw. I checked the power supply I was using, and it was 5v 550ma. I changed it to one that supplies 1000ma, and thus far the problem is fixed.

For reference, my original problem was that periodically, and usually when the wifi was being used, the gui would crash and I would get the message that it couldn't get the status from the wpa_supplicant.conf file

I had tried virtually every variation of the conf files that I could find, modified the /etc/network/interfaces file, used "sudo /init.d/networking stop" then restarted with "sudo /init.d/networking start", and on and on.

I also tried the following:
sudo ifup --force wlan0

It would force the wpa_gui to read the conf file, but it would not get an IP address. To me, this said that everything on the software side of things was working (if only for that instant), that it was a hardware issue. I checked to make sure my router wasn't booting me off the network, and that didn't seem to be the case.

Current up time: 5 hours

ajacker
Posts: 19
Joined: Mon Sep 12, 2011 2:21 pm

Re: WiFi not working using command line [Raspbian]

Sun Sep 14, 2014 10:31 am

On a fresh install with an Ethernet connection and a USB WiFi dongle connected I did the following:

Code: Select all

nano /etc/wpa_supplicant/wpa_supplicant.conf
Then added my networks security information (you will need to replace networkssid with the SSID of your network and passphrase with the security passphrase). Usually your WiFi security would be on a sticker on the back of the router.

Code: Select all

network={
    ssid="networkssid"
    psk="passphrase"
} 
Quick reboot and done

vg3dc
Posts: 2
Joined: Mon Jun 11, 2018 3:59 pm
Location: https://rebrand.ly/financiacion-empresas
Contact: Website

Re: WiFi not working using command line [Raspbian]

Mon Jun 11, 2018 4:05 pm

dus-um wrote:
Fri Nov 29, 2013 1:31 pm
@brunot
Sorry for the late answer, but maybe I can help you:
If I type

Code: Select all

wpa_supplicant -d -c /etc/wpa_supplicant/wpa_supplicant.conf  -iwlan0
I receve the error like you (looks like ;-) )
The solution was, that the wlan was already startet, so i stop the wlan

Code: Select all

ifdown wlan0
and retype the first command and ... YES, here we are.
I works for me!
Mi web: https://www.gedesco.es/financiacion-empresas - https://rebrand.ly/financiacion-empresas

Return to “Troubleshooting”