I created and inserted wpa_suplicant.conf into my raspbian image after dding it to the micro sd. However, after I plugged it in the raspberry pi, I had to manually click on the wifi icon on the tray and activate it. After it, the wifi connected itself, proving the wpa_supplicant.conf file works.

What should I change in the micro sd card to make wifi turn on in the first boot?

It looks like it waits for me to complete the region and timezone in the welcome window that appears on the first boot. However I already configured the region in wpa_supplicant.conf, so what should I do?


2 Answers 2


Revised Answer:

Flash your SD card using rpi-imager instead of using dd. Use the "Advanced Options", and select the "Skip first-run wizard" option. That should give you a system that boots as you want - start on first boot with no human intervention.

rpi-imager may be installed in the usual way using the apt tools.
See below for details

Original Answer:

You should read the instructions for setup of the wireless LAN in the official documentation. There are lots instructions on the Internet (and some here in SE) that have been outdated by changes in RPi OS over the years. If you haven't changed any of the networking config files, the instructions in the official docs should resolve your issue.

If you follow them, and still have problems, please edit your question and explain what you have tried. We'll try to help you get this sorted.

Edits to address the OP's comments below:

From the instructions cited above, here's an alternative to adding the country code with raspi-config:

Alternatively, you can edit the wpa_supplicant.conf file and add the following. (Note: you need to replace 'GB' with the 2 letter ISO code of your country. See Wikipedia for a list of 2 letter ISO 3166-1 country codes.)


If you don't know your country code, look here. And don't overlook two other things: 1) Place your wpa_supplicant.conf file in the /boot directory (ref), and 2) do not use Windows to create the wpa_supplicant.conf file - unless you remove the dreaded CR-LF hidden characters from the file before copying it to /boot.

Another edit (Mar 19, 2021)

Dmitry has now discovered that /etc/xdg/autostart/piwiz.desktop (a.k.a. first run wizard) is preventing your RPi Desktop system from automatically booting as the RPi Lite system does. Changes to that code are a possibility, but there may be another way:

The latest version of Raspberry Pi Imager has a set of "Advanced Options" that allow you to input the data required by piwiz.desktop, and it has an option to skip the first run wizard (aka piwiz.desktop)

And so - if you flash your SD card using rpi-imager using the "Advanced Options", and select the Skip first-run wizard, that should give you a system that boots as you want - start on first boot with no human intervention.

Install rpi-imager from the command line in the usual way:

$ sudo apt-get update && sudo apt-get upgrade

Caveat: as indicated previously, I am unable to verify this on my system, and so I am simply taking the documentation at face value.

  • 1
    That's where I learned how to create my own wpa_supplicant. The raspi-config, and other commands, however, are for running while booted on raspbian. I want to edit things before running the raspbian, on the sd card
    – PPP
    Mar 12, 2021 at 8:24
  • @LucasZanella: What things specifically? AFAIK, any changes you make in wpa_supplicant or raspi-config will persist across boots. Could you explain what you're unable to do?
    – Seamus
    Mar 12, 2021 at 8:36
  • 1
    I'm making the modifications before the first boot, on my computer, just after I write to the microSD. Raspbian has a prompt screen on the first boot that let you select the region, and based on that, it rewrites my wpa_supplicant file with the selected region. Not only that, it only activates the wifi after I complete this window. I want wifi to work on first boot without any interaction with this window
    – PPP
    Mar 12, 2021 at 14:47
  • @LucasZanella: If that's what you want, then I suggest you read the instructions in the link in my answer. Apparently you need to read them again. Look carefully for the sentence that begins with, Alternatively, you can edit the wpa_supplicant.conf file and add the following.
    – Seamus
    Mar 13, 2021 at 5:48
  • I did this, this is my wpa_supplicant.conf: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=BR . However, raspbian refuses to activate the wifi unless I fill the information on the window or click activate wifi on the tray icon, on the first boot
    – PPP
    Mar 14, 2021 at 2:09

All tutorials I have seen which activate WiFi on the first boot use the Lite OS version. Perhaphs that's what is preventing it from activating automatically in your case (I understand you use the GUI). One notable difference is the first boot wizard, which can be deactivated by removing


or running sudo apt purge piwiz (you need to login to the Pi via SSH or chroot into Pi root fs on a system with working apt).

Another source of problems is the content of wpa_supplicant.conf itself. The recommended file for headless setup looks like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<Insert 2 letter ISO 3166-1 country code here>

 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"

Make sure you use UNIX line endings.

  • My wpa_supplicant.conf is exacly as this one, but it won't work on raspbian full desktop. Maybe some other file must be edited to tell the raspbian first bot wizard that it does not need to be run, and also that wifi can be activated by default
    – PPP
    Mar 16, 2021 at 21:06
  • @LucasZanella Try removing piwiz.desktop file. Mar 17, 2021 at 8:02
  • That might do the trick! This guide claims that piwiz.desktop is actually deleted after the first use. The only potential hitch is there are some other things that are set with this (language, keyboard, timezone), so they may need to be set elsewhere. Good find!
    – Seamus
    Mar 17, 2021 at 8:25
  • @Seamus piwiz can be re-run at a later time, either manually or using a script which checks for certain conditions. Then there's dpkg-reconfigure tzdata / dpkg-reconfigure keyboard-configuration which should do the same thing. The real question is whether non-wokring WiFi is really the wizard's doing Mar 17, 2021 at 9:04
  • 1
    @LucasZanella: I think the point is this: piwiz demands that the user provide information needed to start WiFi. But if that information can be supplied ahead of time (as is done in the Lite RPi distro), then piwiz can be eliminated.
    – Seamus
    Mar 17, 2021 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.