Rustie0125
Posts: 4
Joined: Thu Jul 20, 2017 12:57 pm

Re: Raspbian Stretch: Wifi not starting on boot

Thu Sep 28, 2017 5:31 am

Can confirm that this worked for me aswell. must state that i get an error when rebooting " [FAILED] FAILED TO START RAISE NETWORK INTERFACES " but it works for now. some official communication from Raspberry.org would be nice with new releases that explains what and why they @@@@ the system

ITkerala
Posts: 1
Joined: Wed Oct 18, 2017 12:17 am

Re: Raspbian Stretch: Wifi not starting on boot

Wed Oct 18, 2017 1:01 am

Hai guys ..I am new budy..and my first post
I was in a similar ccondition .and I did all according to forum
Edited WPA supplicant then network interfaces file and dhcpcd file.
Then enabled systemctl wpa_ supplicant. Service,but still not working ?
Sudo ifup wlan0 now recognize wlan0 interface but shows /sbin/wpa_supplicant deamon failed to start.
/etc/network/if-pre-up.d/wpasupplicant exited with return code=1.
Ifup:failed to bring up wlan 0

And i dont find afile named interface in /var/run as mentioned in wpa_supplicant.conf using file manager.
iwlist scan wlan0 gives me all thehotspot around..so my adapter is working. Hhm.
Is this the problem of my specific release of raspbian image??
Fed up completely..worked many hours please help

User avatar
DougieLawson
Posts: 42312
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspbian Stretch: Wifi not starting on boot

Wed Oct 18, 2017 6:46 am

Run wpa_supplicant from a command line with

sudo wpa_supplicant -d -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0

To get lots of debugging messages. Run it with -dd for even more debugging noise.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

nandoe
Posts: 1
Joined: Thu Oct 19, 2017 9:00 pm

Re: Raspbian Stretch: Wifi not starting on boot

Thu Oct 19, 2017 9:08 pm

Thanks for all the help.
In the end I got both my cabled network and my wifi up and running by editing the two mentioned files.

add to /etc/wpa_supplicant/wpa_supplicant.conf the following lines

country=XX
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="**********"
psk="***********"
}


and change /etc/network/interfaces to


iface lo inet loopback

auto eth0

iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.254

auto wlan0

iface wlan0 inet static
address 192.168.1.86
netmask 255.255.255.0
gateway 192.168.1.254


or whatever you require in the way of ip addresses.

key is the addition of the lines starting with auto

Once done, reboot and check with ifconfig.

P.S. One small glitch, if eth0 is not plugged in, wlan0 will not start!

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspbian Stretch: Wifi not starting on boot

Fri Oct 20, 2017 10:48 am

You shouldn't use /etc/network/interfaces to assign static network settings. That is now accomplished in /etc/dhcpcd.conf.
My advice applies to RaspiOS only. Please mention if you use another OS.

amcdonley
Posts: 207
Joined: Mon Jan 26, 2015 5:56 pm
Location: Florida, USA

Re: Raspbian Stretch: Wifi not starting on boot

Tue Oct 31, 2017 1:46 am

I just finished two days of flogging with "wlan0 not associated" with 2017-09-07-raspbian-stretch on a Pi3 that was playing nice under jessie-lite.

I tried the headless method with: wpa_supplicant.conf per the thread head:

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

network={
ssid=“myssid”
scan_ssid=1
psk=“mypasskey”
key_mgmt=WPA-PSK
}

Then I tried stock stretch hooking a keyboard and monitor to edit the /etc/wpa_supplicant/wpa_supplicant.conf - to no avail

I ended up having to:

sudo wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
(which said there was some problem and suggested I remove /var/run/wpa_supplicant/wlan0 )
sudo rm /var/run/wpa_supplicant/wlan0
sudo wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
(kept saying auth key failure)
and then a reboot got wlan0 to come up and all is well now.

jughead
Posts: 1
Joined: Thu Nov 09, 2017 1:54 am

Re: Raspbian Stretch: Wifi not starting on boot

Thu Nov 09, 2017 2:14 am

Have there been recent changes to the headless wifi configuration for the pi zero w? I'm using the 2017-09-07 distribution (2017-09-07-raspbian-stretch-lite.img) and the changes outlined in this thread are not working.

Here's my setup:

cat /etc/wpa_supplicant/wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="<ssid removed>"
#psk="<password removed>"
psk=theHashCreatedByTheFunction-wpa_passphrase
}

/etc/network folder exists but is empty

reading about issues about "Predictable Network Interface Names" I also tried adding this to cmdline.txt in the root folder:
net.ifnames=0

No cigar. Device boots but is not getting an IP address via DHCP. I've checked both the router and using NMAP.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6392
Joined: Fri Jul 29, 2011 5:36 pm

Re: Raspbian Stretch: Wifi not starting on boot

Thu Nov 09, 2017 9:14 am

jughead wrote:
Thu Nov 09, 2017 2:14 am
Have there been recent changes to the headless wifi configuration for the pi zero w? I'm using the 2017-09-07 distribution (2017-09-07-raspbian-stretch-lite.img) and the changes outlined in this thread are not working.

Here's my setup:

cat /etc/wpa_supplicant/wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="<ssid removed>"
#psk="<password removed>"
psk=theHashCreatedByTheFunction-wpa_passphrase
}

/etc/network folder exists but is empty

reading about issues about "Predictable Network Interface Names" I also tried adding this to cmdline.txt in the root folder:
net.ifnames=0

No cigar. Device boots but is not getting an IP address via DHCP. I've checked both the router and using NMAP.
Could you please post the output of "sudo journalctl"?

aradove
Posts: 5
Joined: Fri Apr 15, 2016 10:14 am

Re: Raspbian Stretch: Wifi not starting on boot

Fri Nov 10, 2017 11:31 am

I've tried all your tips but cannot get it working.

I've changed the interfaces file and the wpa_supplicant file to the things you written but wifi is not booting on startup. If I start the wlan myself, it does not connect to my network with the supplied information in the wpa file.

What is going on? I've spent 6 hours on this now. Why is Wifi disabled as default?
Is it supposed to be like this?

User avatar
HawaiianPi
Posts: 7578
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Raspbian Stretch: Wifi not starting on boot

Fri Nov 10, 2017 12:18 pm

WiFi is not disabled by default, and "just works" for most people.

This is the procedure I use for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3, or a Raspbian compatible USB WiFi dongle on other models (tested on an old model B, Pi2 and Pi Zero). Everything is done before you boot the SD card, and can be done on a Windows or Mac computer which only has access to the small FAT32 boot partition of a Raspbian SD card.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card. You don't need to extract the image or format the card prior to writing. Just choose the Raspbian .zip, pick your SD card and write (if you have trouble, verify the SHA256 checksum of the download).
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the SD card.
  5. On that small partition, create a file with the name ssh (or ssh.txt).
  6. To connect to a wireless network, create another file on the FAT32 partition called wpa_supplicant.conf which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
    	ssid="Your network SSID"
    	psk="Your WPA/WPA2 security key"
    	key_mgmt=WPA-PSK
    }
  7. Edit country=, ssid= and psk= with your information and save the file.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. You can try to connect to the Pi with ssh pi@raspberrypi (or raspberrypi.local), and if that doesn't work, login to your router to find the Pi's IP address. If you have an ASUS router they have a nice phone app to access and control the router.

If this doesn't work, then check your router for security settings like MAC address filtering or wireless client/AP isolation. Also, make sure you are editing wpa_supplicant.conf with a pure text editor (anything that adds hidden formatting codes will mess it up).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups, and where is that annoying music coming from?

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspbian Stretch: Wifi not starting on boot

Fri Nov 10, 2017 12:37 pm

@aradove: Did you modify /etc/network/interfaces? If you are using Stretch, you shouldn't need to do that. Post what you have in that file.

Edit: If you have something like this in /etc/network/interfaces, the interface will fail to start.
iface wlan0 inet static

If you want to assign static network settings, do that in /etc/dhcpcd.conf.
My advice applies to RaspiOS only. Please mention if you use another OS.

aradove
Posts: 5
Joined: Fri Apr 15, 2016 10:14 am

Re: Raspbian Stretch: Wifi not starting on boot

Mon Nov 13, 2017 12:29 pm

@SurferTim, @HawaiianPi

I followed your guide and it worked right away. So I must have done something wrong.
May it be so that I added the files on second boot of pi? Or the settings I had below?

This is what I had in my interface. Does this destroy the settings? (I removed the default commented code)

source-directory /etc/network/interfaces.d

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

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspbian Stretch: Wifi not starting on boot

Mon Nov 13, 2017 12:42 pm

This is all you should need in /etc/network/interfaces if you are using an onboard wifi unit.

Code: Select all

source-directory /etc/network/interfaces.d
You may need this if a usb wifi device

Code: Select all

source-directory /etc/network/interfaces.d

auto wlan0
allow-hotplug wlan0

iface wlan0 inet manual
My advice applies to RaspiOS only. Please mention if you use another OS.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6392
Joined: Fri Jul 29, 2011 5:36 pm

Re: Raspbian Stretch: Wifi not starting on boot

Mon Nov 13, 2017 2:06 pm

SurferTim wrote:
Mon Nov 13, 2017 12:42 pm
This is all you should need in /etc/network/interfaces if you are using an onboard wifi unit.

Code: Select all

source-directory /etc/network/interfaces.d
You may need this if a usb wifi device

Code: Select all

source-directory /etc/network/interfaces.d

auto wlan0
allow-hotplug wlan0

iface wlan0 inet manual
That /etc/network/interfaces is not needed for USB wifi devices either.
Last edited by ShiftPlusOne on Mon Nov 13, 2017 2:37 pm, edited 1 time in total.
Reason: Fix typo and rephrase for clarity.

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspbian Stretch: Wifi not starting on boot

Mon Nov 13, 2017 2:14 pm

ShiftPlusOne wrote:
Mon Nov 13, 2017 2:06 pm
No needed for USB wifi devices either.
I didn't think so, but I don't have a RPi that doesn't have built-in wifi. I use a usb wifi device with the onboard wifi, and it doesn't need that.
My advice applies to RaspiOS only. Please mention if you use another OS.

jaumeb
Posts: 8
Joined: Tue Nov 07, 2017 9:54 am

Re: Raspbian Stretch: Wifi not starting on boot

Wed Nov 15, 2017 5:54 pm

Run wpa_supplicant from a command line with
sudo wpa_supplicant -d -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0
To get lots of debugging messages. Run it with -dd for even more debugging noise.

OK, the result of the command is:

wpa_supplicant v2.4
random: Trying to read entropy from /dev/random
Successfully initialized wpa_supplicant
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'
country='GB'
ctrl_interface='DIR=/var/run/wpa_supplicant GROUP=netdev'
update_config=1
Line: 5 - start of a new network block
ssid - hexdump_ascii(len=13):
4d 4f xx xx xx 54 xx 52 xx 33 xx 32 43 MYSSID
PSK (ASCII passphrase) - hexdump_ascii(len=22): [REMOVED]
proto: 0x2
key_mgmt: 0x2
pairwise: 0x10
auth_alg: 0x1
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 0
id=0 ssid='myssid'
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=0 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
Could not read interface wlan0 flags: No such device
nl80211: Set mode ifindex 0 iftype 2 (STATION)
nl80211: Failed to set interface 0 to mode 2: -19 (No such device)
wlan0: Failed to initialize driver interface
Failed to add interface wlan0
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout

and reboot but wifi not work, insert the dongle wifi and any problems.

????
Jaume

User avatar
Milliways
Posts: 815
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Stretch: Wifi not starting on boot

Sun Nov 26, 2017 9:25 am

ShiftPlusOne wrote:
Mon Aug 21, 2017 12:30 pm
Yup, failing predictable interface names are a known issue and the next image will disable them by default.

Is everybody else who is seeing the issue missing the "ctrl_interface=/var/run/wpa_supplicant" line?
I don't know what the "failing predictable interface names" is supposed to be but apparently the 2017-09-07 release

Code: Select all

* Disable predictable network interface names for Ethernet devices
Can you please explain HOW so I can undo the change. (I know I could do a forensic analysis to find this myself.)

User avatar
B.Goode
Posts: 14628
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Raspbian Stretch: Wifi not starting on boot

Sun Nov 26, 2017 12:13 pm

Milliways wrote:
Sun Nov 26, 2017 9:25 am
ShiftPlusOne wrote:
Mon Aug 21, 2017 12:30 pm
Yup, failing predictable interface names are a known issue and the next image will disable them by default.

Is everybody else who is seeing the issue missing the "ctrl_interface=/var/run/wpa_supplicant" line?
I don't know what the "failing predictable interface names" is supposed to be but apparently the 2017-09-07 release

Code: Select all

* Disable predictable network interface names for Ethernet devices
Can you please explain HOW so I can undo the change. (I know I could do a forensic analysis to find this myself.)

Just use the appropriate option that has been added to the raspi-config utility for this purpose.

(So the forensics might be as simple as reading the raspi-config shell script to see how the change is implemented.)

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspbian Stretch: Wifi not starting on boot

Sun Nov 26, 2017 12:24 pm

I haven't checked lately, but the last time I used raspi-config, it did not use predictable interface names for wlan0, and caused me a bit of grief.

If it still doesn't rename wlan0, this will.

To use mac based interface names in Stretch
Move or remove /etc/systemd/network/99-default.link
Open /etc/systemd/network/99-default.link with a text editor (new, empty file).
Insert this:

Code: Select all

[Link]
NamePolicy=kernel database onboard slot path mac
MACAddressPolicy=persistent
Reboot
My advice applies to RaspiOS only. Please mention if you use another OS.

User avatar
Milliways
Posts: 815
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Stretch: Wifi not starting on boot

Sun Nov 26, 2017 10:41 pm

B.Goode wrote:
Sun Nov 26, 2017 12:13 pm
Milliways wrote:
Sun Nov 26, 2017 9:25 am
ShiftPlusOne wrote:
Mon Aug 21, 2017 12:30 pm
Yup, failing predictable interface names are a known issue and the next image will disable them by default.

Is everybody else who is seeing the issue missing the "ctrl_interface=/var/run/wpa_supplicant" line?
I don't know what the "failing predictable interface names" is supposed to be but apparently the 2017-09-07 release

Code: Select all

* Disable predictable network interface names for Ethernet devices
Can you please explain HOW so I can undo the change. (I know I could do a forensic analysis to find this myself.)

Just use the appropriate option that has been added to the raspi-config utility for this purpose.

(So the forensics might be as simple as reading the raspi-config shell script to see how the change is implemented.)
I have just looked through all the menu in raspi-config (on a fresh install), and can't seem to find any means of changing.

User avatar
Milliways
Posts: 815
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Stretch: Wifi not starting on boot

Mon Nov 27, 2017 2:39 am

Milliways wrote:
Sun Nov 26, 2017 10:41 pm
I have just looked through all the menu in raspi-config (on a fresh install), and can't seem to find any means of changing.
This is not included in Raspberry Pi reference 2017-09-07, which broke the feature, but is available in an updated version. (Maybe the Foundation realised the error of its ways!)

PorterDon
Posts: 70
Joined: Wed Aug 21, 2013 2:09 pm
Location: Thailand

Re: Raspbian Stretch: Wifi not starting on boot

Tue Dec 05, 2017 7:37 am

Unbelievable and unacceptable the Foundation somehow allowed these issues to flood us. I still can't get my Zero to bloody connect to wifi correctly on a static IP after hours of chasing rabbits! I don't know how the upgrade to Stretch was "managed" for wifi connection -- but I'd say somebody deserves a little "chat" at the water cooler. The Foundation has taken many, many harmful hits as a result of all this totally avoidable nonsense.

User avatar
Milliways
Posts: 815
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Stretch: Wifi not starting on boot

Tue Dec 05, 2017 7:54 am

PorterDon wrote:
Tue Dec 05, 2017 7:37 am
Unbelievable and unacceptable the Foundation somehow allowed these issues to flood us. I still can't get my Zero to bloody connect to wifi correctly on a static IP after hours of chasing rabbits! I don't know how the upgrade to Stretch was "managed" for wifi connection -- but I'd say somebody deserves a little "chat" at the water cooler. The Foundation has taken many, many harmful hits as a result of all this totally avoidable nonsense.
It is unclear which of "these issues" you are complaining about.

My problem is that the Foundation FINALLY introduced Predictable Network Names, more than a year after comparable distributions, only to get cold feet 3 weeks later.

I agree that their communication leaves much to be desired.

Most of this thread is about various ill-informed attempts to modify interface naming. I was always simple to select either the old (unpredictable) behaviour or Predictable Network Names, and now this is in raspi-config.

See How to set up networking/WiFi for a less passionate analysis.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6392
Joined: Fri Jul 29, 2011 5:36 pm

Re: Raspbian Stretch: Wifi not starting on boot

Tue Dec 05, 2017 8:01 am

PorterDon wrote:
Tue Dec 05, 2017 7:37 am
Unbelievable and unacceptable the Foundation somehow allowed these issues to flood us. I still can't get my Zero to bloody connect to wifi correctly on a static IP after hours of chasing rabbits! I don't know how the upgrade to Stretch was "managed" for wifi connection -- but I'd say somebody deserves a little "chat" at the water cooler. The Foundation has taken many, many harmful hits as a result of all this totally avoidable nonsense.
What issues would that be and how would you have done it instead? Every change has been made for a good reason and has been the result of changes upstream.

User avatar
ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6392
Joined: Fri Jul 29, 2011 5:36 pm

Re: Raspbian Stretch: Wifi not starting on boot

Tue Dec 05, 2017 8:10 am

Milliways wrote: My problem is that the Foundation FINALLY introduced Predictable Network Names,
Nothing to do with the Foundation at all. We follow Debian and this came as a result of the move to Stretch.
Milliways wrote:only to get cold feet 3 weeks later
There was a flood of people complaining and saying it's the worst thing ever. Also, at the time of release, dhcpcd would grab the interface and the rename would fail. Having it only sort of kind of work defeats the point of it. Based on the feedback on the forum, a discussion in the office and the renaming issue, we took it out. Recognising that some users would prefer predictable names, the option was added to raspi-config. A later version of dhcpcd fixed the interface renaming issue.

Return to “Troubleshooting”