Yazidapple
Posts: 23
Joined: Wed Mar 23, 2016 3:06 pm

Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 11:07 am

To set any Raspberry Pi in headless mode, you'll only need your Pi with pre-loaded Raspbian OS (latest is Stretch) and your Wi-Fi network.
Make sure you know your Wi-Fi SSID and Password in order to perform headless setup.

Once you've burned/etched the Raspbian image onto the microSD card, connect the card to your working PC and you'll see the card being mounted as "boot". Inside this "boot" directory, you need to make 2 new files. You can create the files using Atom code editor.

Step 1: Create an empty file. You can use Notepad on Windows or TextEdit to do so by creating a new file. Just name the file ssh. Save that empty file and dump it into boot partition (microSD).

Step 2: Create another file name wpa_supplicant.conf . This time you need to write a few lines of text for this file. For this file, you need to use the FULL VERSION of wpa_supplicant.conf. Meaning you must have the 3 lines of data namely country, ctrl_interface and update_config

Code: Select all


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

network={
    ssid="your_real_wifi_ssid"
    scan_ssid=1
    psk="your_real_password"
    key_mgmt=WPA-PSK
}

Last edited by Yazidapple on Fri Sep 22, 2017 6:36 pm, edited 2 times in total.

DirkS
Posts: 7532
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 12:12 pm

Yazidapple wrote:
Sun Aug 20, 2017 11:07 am
Unlike Jessie, Pi loaded with newly installed Stretch won't connect to your network using the standard wpa_supplicant.conf.
You must follow the example above. You need to create 2 networks : one is real and another one can be dummy network. Weird solution I might say. Just wait for the foundation's explanation on why this issue occurred.
As far as I can see nothing has changed compared to Jessie
I did *not* create a dummy network in wpa_supplicant.conf and it connected to my AP without problems

BTW: for SSH activation the file can be named 'ssh' or 'ssh.txt'
Also make sure that you don't put the files in a directory called boot. They should be in the top level directory of the (small) partition that is *labelled* as boot.

mattmiller
Posts: 1428
Joined: Thu Feb 05, 2015 11:25 pm

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 12:18 pm

Unlike Jessie, Pi loaded with newly installed Stretch won't connect to your network using the standard wpa_supplicant.conf
i've installed 4 installs using the Stretch image headlessly using my standard wpa_supplicant.conf that I last changed in Sep 2016

Code: Select all

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


network={
    ssid="XXXX"
    scan_ssid=1
    key_mgmt=NONE
}

Heater
Posts: 7744
Joined: Tue Jul 17, 2012 3:02 pm

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 12:25 pm

So most of this opening post is incorrect?

DirkS
Posts: 7532
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 12:38 pm

Heater wrote:
Sun Aug 20, 2017 12:25 pm
So most of this opening post is incorrect?
It will work, but there's a lot of noise...

Martin Frezman
Posts: 1021
Joined: Mon Oct 31, 2016 10:05 am

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 12:38 pm

Heater wrote:
Sun Aug 20, 2017 12:25 pm
So most of this opening post is incorrect?
Most posts here are incorrect. They follow the general concept that the best way to get correct information on the net is to post incorrect information.
If this post appears in the wrong forums category, my apologies.

Heater
Posts: 7744
Joined: Tue Jul 17, 2012 3:02 pm

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 4:29 pm

Martin,
Most posts here are incorrect. They follow the general concept that the best way to get correct information on the net is to post incorrect information.
Oh my God. Of course. All these years and I have never realized what was going on!

It's not just here of course but across the whole internet.

Martin Frezman
Posts: 1021
Joined: Mon Oct 31, 2016 10:05 am

Re: Raspbian Stretch Headless Setup Procedure

Sun Aug 20, 2017 5:04 pm

Again, I am glad to have helped.
If this post appears in the wrong forums category, my apologies.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4617
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Raspbian Stretch Headless Setup Procedure

Mon Aug 21, 2017 9:34 am

It looks like wpa_supplicant doesn't start on first boot for some people and it would be nice to see some logs which might explain what the issue is.

User avatar
NickT
Posts: 264
Joined: Mon May 21, 2012 10:43 am
Location: UK

Re: Raspbian Stretch Headless Setup Procedure

Mon Aug 21, 2017 2:03 pm

I've just tried to upgrade my jessie pizerowifi board running jessie lite to stretch with no initial success. I followed the procedure outlined by @Rattus in the "Stretch has arrived" thread (1st page)

can you upgrade from jessie to stretch ...
yes though it would probably be quicker to download and start again
however
sudo apt-get update && sudo apt-get dist-upgrade -y
reboot
then edit
/etc/apt/sources.list
/etc/apt/sources.list.d/raspi.list
and change jessie to stretch
in
/etc/apt/sources.list.d/raspi.list
remove the staging

then
sudo apt-get update
sudo apt-get dist-upgrade
ignore errors , answer Y to all questions [there will be a few] - you can make copies of any that you want to keep
reboot
sudo apt-get auto-remove
then
lsb_release -a ; uname -as


I found no reference to staging anywhere but carried on with no significant errors. I have on my zerowifi, apache2, php, mysql and fail2ban.
The lsb_release gives 'command not found', although the /proc shows the correct version number and the kernel is correct.

Now the interesting bit:
The pizerowifi board won't connect at all, even though I tried the creating dummy network bit in wpa_supplicant.conf.
If I look on my router's 'connected devices' web page from my PC, I can see the pi as being connected but I can't putty to it.
If I take the sd card out of the pizero and put it into my PiB with a wifi dongle in a usb, then I can putty to it Ok!
It's almost as though there were no drivers for the onboard wifi chip in the zero.
Any suggestions for diagnostics and hopefully a fix woul be much appreciated.

One snag is that I have no HDMI or composite video TV available to me, it has to be ssh or nothing

Andy.ICT2U
Posts: 1
Joined: Sat Sep 02, 2017 9:57 am

Re: Raspbian Stretch Headless Setup Procedure

Sat Sep 02, 2017 10:09 am

Hi there,

Bit of a newbie on getting a Pi setup so apologies if these seems obvious questions (or I'm missing some of the high level details in some of the other traffic). I'm just creating a new Stretch Lite Pi3 system and I'm unable to get SSH operating. I have a wired connection to my router and I can get the IP address associated with the new build. I'm expecting that I could use the Stretch Lite kernel 4.9 (16/8/2017) on the https://www.raspberrypi.org/downloads/raspbian/ download page and SSH to it immediately without needing to operate via keyboard and screen (assuming I was using a wired connection) - is this an invalid assumption or valid but maybe too earlier in the release cycle of the OS and there's a little debugging to still be done to ensure a seamless installation of the Stretch Lite build?
Is this any different for the Full Stretch build or should I go back to a NOOBS download for now?

Cheers
Andy

PS My main goal is to get a headerless GeoServer suite set up so thought of using Stretch Lite to minimise overheads. I'll need Jetty, node, Postgres etc. so maybe the stretch lite is the wrong direction anyway? Thoughts?

klricks
Posts: 4759
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Raspbian Stretch Headless Setup Procedure

Sat Sep 02, 2017 1:21 pm

Andy.ICT2U wrote:
Sat Sep 02, 2017 10:09 am
Hi there,

Bit of a newbie on getting a Pi setup so apologies if these seems obvious questions (or I'm missing some of the high level details in some of the other traffic). I'm just creating a new Stretch Lite Pi3 system and I'm unable to get SSH operating. I have a wired connection to my router and I can get the IP address associated with the new build. I'm expecting that I could use the Stretch Lite kernel 4.9 (16/8/2017) on the https://www.raspberrypi.org/downloads/raspbian/ download page and SSH to it immediately without needing to operate via keyboard and screen (assuming I was using a wired connection) - is this an invalid assumption or valid but maybe too earlier in the release cycle of the OS and there's a little debugging to still be done to ensure a seamless installation of the Stretch Lite build?
Is this any different for the Full Stretch build or should I go back to a NOOBS download for now?

Cheers
Andy

PS My main goal is to get a headerless GeoServer suite set up so thought of using Stretch Lite to minimise overheads. I'll need Jetty, node, Postgres etc. so maybe the stretch lite is the wrong direction anyway? Thoughts?
ssh is not enabled by default. As mentioned in this thread you need to put the SD card back into your PC and create an empty file with the name ssh or ssh.txt and put it in the root level of the card. (the only folder you can see in Windows). Now put the SD back into the RPi. If successful the ssh will be enabled and the ssh file will be deleted.

Do not use NOOBs for a headless install.

If you don't need any GUI then use lite version otherwise use the full version.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

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

Re: Raspbian Stretch Headless Setup Procedure

Sun Sep 03, 2017 4:50 am

I was testing something out for a reply in another thread and burned a fresh Raspbian Stretch SD card for that. I also made an "ssh" file and added my wpa_supplicant.conf. The system booted, connected to my router, and I was able to SSH into it with no trouble whatsoever.

I had also tested Stretch-Lite a day or two ago on my Pi-Zero without any problems either.

Actually, there was one problem, but it doesn't seem to be related to the OP. However, the minimal wpa_supplicant.conf file that was often recommended with Jessie:

Code: Select all

network={
	ssid="Your network SSID"
	psk="Your WPA/WPA2 security key"
}
will no longer work with Stretch. So use the full wpa_supplicant.conf file with Raspbian Stretch.

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
}
Technically, all you need is that first line and the minimal file info, but who know when that will change again.

Code: Select all

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

network={
	ssid="Your network SSID"
	psk="Your WPA/WPA2 security key"
}
My password is the last 8 digits of Pi.

Ryan780
Posts: 2
Joined: Wed Sep 06, 2017 2:12 pm

Re: Raspbian Stretch Headless Setup Procedure

Wed Sep 06, 2017 2:14 pm

I can confirm after many hours of trying to use Stretch with my old WPA_supplicant file that worked fine with Jessie that you do in fact need to set it up this way. 5 different attempts with the old file on multiple SD cards did not work. This worked first try.

Heater
Posts: 7744
Joined: Tue Jul 17, 2012 3:02 pm

Re: Raspbian Stretch Headless Setup Procedure

Wed Sep 06, 2017 2:37 pm

Which file do you mean?

That presented by our opening poster is wrong. If not wrong misleading.

That presented by HawaiianPi seems to be correct. It's the way I have been doing things for ages anyway. Even on Jessie.

mattmiller
Posts: 1428
Joined: Thu Feb 05, 2015 11:25 pm

Re: Raspbian Stretch Headless Setup Procedure

Wed Sep 06, 2017 3:10 pm

Which file do you mean?
They mean the simplistic wpa_supplicant.conf that worked on Jessie doesn't work on Stretch - we need the more comprehensive one now

Heater
Posts: 7744
Joined: Tue Jul 17, 2012 3:02 pm

Re: Raspbian Stretch Headless Setup Procedure

Wed Sep 06, 2017 4:41 pm

OK. I think I have missed a memo somewhere. I have always used a wpa_supplicant.conf like that posted by HawaiianPi above. As I have seen recommended since longer than I an remember. Never knew anything less worked at all.

rdragon78
Posts: 2
Joined: Thu Sep 07, 2017 6:31 am

Re: Raspbian Stretch Headless Setup Procedure

Thu Sep 07, 2017 6:43 am

I've now done the exact config that HawiianPi has suggested 5 times and still unable to connect to my rpi zero w with the latest stretch lite image. However I'm having a different problem it seems.

It appears that the WiFi config works because the host shows up on my router's DHCP leases page. According to my router the pi has an IP address and everything. But when I try to ping it I get:

Code: Select all

Destination host unreachable.
And of course, since I can't ping it, I obviously can't ssh to it either. It's just the strangest thing. The pi has an IP address, but it won't answer a ping?! Before you ask, yes, I've also tried to just SSH to it and unsurprisingly that won't work either.

This very same procedure works perfectly every time with jessie lite. Does anyone have any clue as to what it might be? Any ideas would be highly appreciated. I don't have a mini HDMI connector to be able to connect it to a monitor. I really am just trying to get this thing to work headless.

UPDATE 2017-09-07:
For whatever reason, the problem I was having with Destination host unreachable turned out to be due to some sort of wifi signal degradation issue. The pi was sitting right next to the laptop from which I was trying to ping it and apparently the little on-circuit antenna on the pi zero w just didn't like that. I moved the pi to another room and lo-n-behold it started pinging just fine.

So, in conclusion... the wpa_supplicant.conf file as earlier described by HawaiianPi worked just fine on Raspbian stretch. The little on-circuit radio antenna on the pi zero w is turning out to be less than adequate for reliable wifi connections, so I'm gonna have to re-think this whole zero w strategy. I might do better with a standard pi zero with a full-sized wifi USB dongle hanging from it, maybe even one with a real antenna.
Last edited by rdragon78 on Thu Sep 07, 2017 9:51 pm, edited 1 time in total.

CirKorn
Posts: 2
Joined: Wed Sep 10, 2014 1:29 am

Re: Raspbian Stretch Headless Setup Procedure

Thu Sep 07, 2017 9:06 pm

Going to put in another me too, that using configuration instructions for previous versions do not work for headless setup. The full wpa_supplicant.conf is needed, and the ssh file is needed also.

Burn fresh MicroSD Card

Code: Select all

sudo dd bs=4M if=~/Downloads/{yourimage.img} of=/dev/mmcblk0
Eject SD card, and reinsert to mount

Find location of the mount point
Change to the boot directory of the MicroSD card.
Then create an empty file called ssh

Code: Select all

df
cd /media/{your-username}/boot
touch ssh
Now create a wpa_supplicant.conf file with knowledge gained from above.

Code: Select all

nano wpa_supplicant.conf
wpa_supplicant.conf:

Code: Select all

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

network={
    ssid="myssid"
    scan_ssid=1
    psk="mypass"
    key_mgmt=WPA-PSK
}
Hopefully this helps someone!

mattmiller
Posts: 1428
Joined: Thu Feb 05, 2015 11:25 pm

Re: Raspbian Stretch Headless Setup Procedure

Fri Sep 08, 2017 5:25 pm

The little on-circuit radio antenna on the pi zero w is turning out to be less than adequate for reliable wifi connections,
There will always be circumstances with things like WiFi in which they are problematical

I've got about 6 PiZeroW scattered around my house working 24/7 working as IR signal repeaters and controlling NeoPixel lights and apart from the occasional lockup, they work fine

Lockups prob due to my code :)

I've seen many people posting that WiFi devices aren't working 2 inches from the router even with 30db gain antennas so that's not a unique issue :)

In engineering terms, the Pi3 antenna is quite advanced and considered to be quite an improvement on the one on the Pi3

Having said all that, as long as you don't need to use the USB port then you get do the same job for the same price by using a PiZero, adaptor and USB WiFi dongle

If you don't want it sticking outside the footprint of the PiZero and don't mind a bit of hack soldering, then you can attach one directly to the test pins on the underside

http://www.recantha.co.uk/blog/?p=13795

which also saves the cost of the adaptor

jlowe
Posts: 13
Joined: Wed Apr 29, 2015 1:27 am

Re: Raspbian Stretch Headless Setup Procedure

Fri Sep 08, 2017 11:29 pm

ShiftPlusOne wrote:
Mon Aug 21, 2017 9:34 am
It looks like wpa_supplicant doesn't start on first boot for some people and it would be nice to see some logs which might explain what the issue is.
Have P3 with cable works fine.. remove cable, reboot.. does not connect.

I'm using 'lite .. what logs would help?

I got it working by adding

Code: Select all

network={
        ssid="......xxxxx"
        psk="the password"
        }

to /etc/wpa-supplicant/wpa-supplicant.conf

..jay

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4617
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Raspbian Stretch Headless Setup Procedure

Sat Sep 09, 2017 2:08 am

jlowe wrote:I'm using 'lite .. what logs would help?
Everything journalctl outputs.

jlowe
Posts: 13
Joined: Wed Apr 29, 2015 1:27 am

Re: Raspbian Stretch Headless Setup Procedure

Sun Sep 10, 2017 1:08 am

Didn't see your note until now.. will do tomorrow.. if not too late
..jay

cleo
Posts: 1
Joined: Sun Sep 10, 2017 1:39 am

Re: Raspbian Stretch Headless Setup Procedure

Sun Sep 10, 2017 1:44 am

HawaiianPi wrote:
Sun Sep 03, 2017 4:50 am
will no longer work with Stretch. So use the full wpa_supplicant.conf file with Raspbian Stretch.

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
}
Just wanted to say thanks. I have been using my wpa template for sometime until I had to wipe my PI3 tonight. I couldn't understand what the difference was, until now.

jlowe
Posts: 13
Joined: Wed Apr 29, 2015 1:27 am

Re: Raspbian Stretch Headless Setup Procedure

Tue Sep 12, 2017 2:10 pm

ShiftPlusOne wrote:
Sat Sep 09, 2017 2:08 am
jlowe wrote:I'm using 'lite .. what logs would help?
Everything journalctl outputs.
Sorry it took me so long.
.. started with lite. change PW, WIFI country, expanded filesystem
rebooted.
added to /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

network={
        ssid="......xxxxx"
        psk="the password"
        }
.. rebooted and wifi connected, with no problem.
I saved journalctl each step, Don't think they would help.. /etc/wpa_supplicant/wpa_supplicant.conf
just needed to be updated.

Maybe raspi-config could help with that.

if you still want journalctl logs, let me know.

..jay

Return to “General discussion”

Who is online

Users browsing this forum: asavah, Google [Bot] and 40 guests