How do I access the /boot
partition on the SD card so that I can edit the wpa_supplicant.conf
file?

- 59,890
- 31
- 101
- 209

- 9
- 1
- 1
- 2
-
Just put the card in ANY computer and "edit". NOTE the existing file is NOT in /boot, and any file will be copied and deleted when the Pi boots. – Milliways Aug 02 '19 at 08:22
4 Answers
You will need to get access to the wpa_supplicant.conf file located in:
/etc/wpa_supplicant/wpa_supplicant.conf
Remove and mount the disk in another computer and modify the file..
You can:
-Obtain an HDMI cable for the Pi Zero W, a USB hub to connect mouse and keyboard. Edit through monitor. It's nice to have these 'tools' handy for this reason.
This has happened to me a few times, so I had a modification implemented from following this awesome resource:
Basically, when the RPi is away from any access points that it uses in wpa_supplicant.conf, it will detect AP no longer available, and automatically create it's own hotspot, so then I can connect to the RPi directly over it's WiFi hotspot. So when my home network is unavailable, I can still connect and ssh into the Pi. This creates a network, and allows other devices to connect as well to this network.
The RPi SD has 2 partitions, one is the FAT boot partition, and the other is the OS with User data etc on ext4 file system. Windows can't read this out the box, so keep that in mind if your only alternative machine to edit SD is a windows, then, a (hindsight) solution, would be to create a symlink of the wpa_supplicant.conf to the FAT side, which Windows will be able to see, assuming Windows is your only other computer to read the RPi SD. But this would need to be done when the RPi is accessible.
At this point it's probably easiest to take the SD to a linux machine, or other capable of reading and writing to that ext4 partition.
UPDATE:
There is another means to modifying the wpa_supplicant.conf file if you can only access the /boot directory.
You can simply re-create a wpa_supplicant.conf file and save it into this /boot
root directory, and upon reboot, the OS will copy this file to where the old one is.
Here is a link I found. https://www.glennklockwood.com/sysadmin-howtos/rpi-headless-boot.html

- 598
- 3
- 14
-
1Broken link? Maybe https://raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/183-raspberry-pi-automatic-hotspot-and-static-hotspot-installer – Ian Mercer Oct 20 '20 at 00:20
If you're meaning to access it on an operational Raspberry Pi: it's not in /boot
, as other have explained.
If you're meaning to create it on an SD card on another computer: /boot
is the small MS-DOS partition that shows up under Windows or Mac OS. You have to create the /boot/wpa_supplicant.conf yourself, and it will automatically be moved to the right place when you boot your Raspberry Pi.

- 9,068
- 1
- 24
- 35
The boot partition is mounted to the directory /boot
so you can just access it, for example with ls /boot
.
But you will not find wpa_supplicant.conf
there. It is located at /etc/wpa_supplicant/wpa_supplicant.conf
.

- 42,107
- 20
- 85
- 197
If a wpa_supplicant.conf
file is located in the /boot
directory of a freshly flashed Raspberry Pi OS SD card, it will be copied into /etc/wpa_supplicant
when the Pi is booted.
This wpa_supplicant.conf
file can be created and placed on the SD card using the same system you used to copy the Raspberry Pi OS image to the SD card, allowing you to boot up a Raspberry Pi for the first time and have it automatically connect to your WiFi network.
This wpa_supplicant.conf
should look something like this:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="my_wifi_ssid"
psk="my_password_in_plaintext"
key_mgmt=WPA-PSK
}
Of note, ctrl_interface=
is required for command-line utilities to communicate with wpa-supplicant. Without this, you're apt to get errors like Could not connect to wpa_supplicant.
You also have to make sure that SSH is enabled on first boot to actually access your newly minted Pi over WiFi. To do this, put an empty file named ssh into the same /boot
directory of the SD card. Raspberry Pi OS will detect this file on boot, enable SSH and remote login, and then delete this file.
From this point, you can use something like Ansible to configure the Raspberry Pi without having to plug in a keyboard, mouse, or monitor. Just be sure to change the default login/password, since anyone who can ssh to the Pi will be able to log in using the pi user account.