Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

"Failed to bring up wlan0" when using wpa_supplicant

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
michael_a
Posts: 28
Joined: 2016-05-03 13:59

"Failed to bring up wlan0" when using wpa_supplicant

#1 Post by michael_a »

I followed the instructions on this wiki page to install the wifi drivers on my Thinkpad X1 Carbon under jessie/stable. Basically, I installed the most recent version of the backported kernel (4.5.0-0.bpo.2-amd64), then installed firmware-iwlwifi from the non-free repository. Now, I'm following the instructions on the wiki page about wifi to use wpa_supplicant from the console. I do not have a a graphical interface installed.

I restricted the permissions on /etc/network/interfaces:

Code: Select all

sudo chmod 0600 /etc/network/interfaces
ran wpa_passphrase

Code: Select all

wpa_passphrase myssid network_password
then updated /etc/network/interfaces to look like this

Code: Select all

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

iface wlan0 inet dhcp
    wpa-ssid myssid
    wpa-psk hash_from_wpa_passphrase
When I run "sudo ifup wlan0" I get this error

Code: Select all

wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to bring up wlan0
What's causing this? Is there a way to check that the driver is working/installed properly, or is there another problem?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: "Failed to bring up wlan0" when using wpa_supplicant

#2 Post by Head_on_a_Stick »

Are you sure that your interface is actually called "wlan0"?

Check the output of:

Code: Select all

ip link
See https://www.freedesktop.org/wiki/Softwa ... faceNames/

This command will also show if the interface is active at all, you may need a newer version of firmware-iwlwifi if it is not:
https://packages.debian.org/jessie-back ... re-iwlwifi

If you add this line to the top of your wireless interface stanza:

Code: Select all

auto wlan0 # correct interface name if needed
does the interface start automatically at boot?
deadbang

michael_a
Posts: 28
Joined: 2016-05-03 13:59

Re: "Failed to bring up wlan0" when using wpa_supplicant

#3 Post by michael_a »

The wireless interface didn't show up when I ran ip link, so I installed a newer version of the firmware-iwlwifi from jessie-backports (version firmware-iwlwifi=20160110-1~bpo8+1) and after a reboot, wlan0 shows up in the list of network interfaces. This is /etc/network/interfaces:

Code: Select all

source /etc/network/interfaces.d/*

# auto lo
# iface lo inet loopback

# Automatic eth0 is disabled to prevent the delay on 
# "LSB: raise network interfaces". Once the system boots,
# plugging in the network cable will let DHCP pick up.
#auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

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

iface default inet dhcp
and /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant
GROUP=netdev

network={
        ssid="YOUR SSID AT HOME"
        psk=password hash from wpa_passphrase command, without quotes
        id_str="home"
}
Both of these are set to read-only (sudo chmod 0600 <filename>). If I add "auto wlan0" to the line before "allow-hotplug wlan0" the wireless interface still doesn't come up on boot, and "sudo ifup wlan0" returns the same wpa_supplicant error code 1 as in my first post.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: "Failed to bring up wlan0" when using wpa_supplicant

#4 Post by Head_on_a_Stick »

OK, will wpa_supplicant work independently?

Kill any networking processes & `ifdown wlan0` (if it will let you) and flush your IP addresses then try:

Code: Select all

# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
# dhclient wlan0
Does that work? Post any terminal output.
deadbang

michael_a
Posts: 28
Joined: 2016-05-03 13:59

Re: "Failed to bring up wlan0" when using wpa_supplicant

#5 Post by michael_a »

Ok, as root, I ran "ifdown wlan0" (even though it wasn't configured) and "ip addr flush dev wlan0" for wlan0/eth0. The wpa_supplicant command returns

Code: Select all

Successfully initialized wpa_supplicant
Line 3: unknown global field 'GROUP=netdev'
Line 3: Invalid configuration line 'GROUP=netdev'
Failed to read or parse configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
Based on that error, I fixed that by putting "GROUP=netdev" on the same line as "ctrl_interface=DIR=/var/run/wpa_supplicant", and then the wpa_supplicant command works (it just says "Successfully initialized wpa_supplicant" so that's working. "dhclient -v wlan0" never picks up an IP address, though. It just says "DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval <interval>" repeatedly for a few minutes, then says

Code: Select all

No DHCPOFFERS received.
No working leases in persistent database - sleeping.
Googling around for that error turns up quite a few raspberry pi threads, but nothing relevant to this situation that I can see (several of the solutions involve something called berryboot and the settings that were selected during the installation, which I don't think applies here.

Also, the standard non-root user is in the netdev group.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: "Failed to bring up wlan0" when using wpa_supplicant

#6 Post by Head_on_a_Stick »

Yes, sorry I should have picked up the line break error in the configuration file.

In that vein, try a simplified wpa_supplicant.conf based on the wpa_passphrase(8) output alone:

Code: Select all

# wpa_passphrase $SSID $password > /etc/wpa_supplicant/wpa_supplicant.conf
Also, have you tried using wpa-ssid & wpa-psk lines in /etc/network/interfaces rather than using wpa-roam & wpa_supplicant.conf?

See https://wiki.debian.org/WiFi/HowToUse#W ... d_WPA2-PSK
deadbang

michael_a
Posts: 28
Joined: 2016-05-03 13:59

Re: "Failed to bring up wlan0" when using wpa_supplicant

#7 Post by michael_a »

Head_on_a_Stick wrote:
In that vein, try a simplified wpa_supplicant.conf based on the wpa_passphrase(8) output alone:

Code: Select all

# wpa_passphrase $SSID $password > /etc/wpa_supplicant/wpa_supplicant.conf
Trying this on my home wifi network (substituting in for SSID and password appropriately, then running wpa_supplicant and dhclient manually gives the same "No working leases in persistent database" error as before.
Also, have you tried using wpa-ssid & wpa-psk lines in /etc/network/interfaces rather than using wpa-roam & wpa_supplicant.conf?

See https://wiki.debian.org/WiFi/HowToUse#W ... d_WPA2-PSK
I edited /etc/network/interfaces to look like this

Code: Select all

auto lo
iface lo inet loopback

#auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid myssid
        wpa-psk ccb290fd4fe6b22935cbae31449e050edd02ad44627b16ce0151668f5f53c01b
and on reboot, the wifi picks up!

That seems to indicate a problem with wpa_supplicant (or how I have it configured in /etc/network/interfaces), right?

Ideally, I'd still like to use wpa_supplicant and wpa-roam for this so I don't have to manually configure /etc/network/interfaces every time I switch networks. Is there any other information that I can post that would be useful for debugging purposes?

mik13ST
Posts: 1
Joined: 2022-05-12 17:41

Re: "Failed to bring up wlan0" when using wpa_supplicant

#8 Post by mik13ST »

I think static IP address defined in your router might be the problem. It was in my case.

If you have a static IP address allocated by your router, try deleting the allocation. Then your device should get an IP address from the router's pool. Then define the static IP address again.

What I did when debugging this problem on my Raspberry Pi:
1. Unplug USB WiFi dongle from RPi and try it in a PC. It worked and connected (and got a statically defined IP address that was meant for the RPi).
2. Plug USB WiFi dongle back into RPi.
3. Fix wpa_supplicant.conf syntax (or whatever the "run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1" error).
4. Fail to get an IP address from your router because it thinks it's already being used.

I think you just got lucky and the WiFi worked after a reboot just because you got the timing just right so the DHCP static IP lease expired or something. My router model is ZyXEL NBG-417N.

arochester
Emeritus
Emeritus
Posts: 2435
Joined: 2010-12-07 19:55
Has thanked: 14 times
Been thanked: 54 times

Re: "Failed to bring up wlan0" when using wpa_supplicant

#9 Post by arochester »

@mik13ST

Did you notice that this thread is from 2016?

Post Reply