Through the Raspberry Pi Imager, it has become very easy to configure your Pi’s WiFi connection.
However, there is only space for one network configuration. But what if you are building a digital picture frame as a present and want to have the network pre-configured, e.g., for your parents’ place?
You want your frame to be up and running when it is unwrapped, don’t you?
Fortunately, adding a second or even more networks is very easy. So when you move your photo frame to a new location, you turn it on and immediately have a WiFi connection.
Raspberry Pi OS changed the way it manages Wi-Fi networks with Bookworm, and Trixie, the current release, works the same way. So this is the updated version for adding pre-configured wifi networks. The wpa_supplicant.conf file is no longer used to configure Wi-Fi connections at all. Instead, the operating system uses NetworkManager to manage network connections, including Wi-Fi.
How to add another WiFi network
The method for configuring Wi-Fi connections on current Raspberry Pi OS is as follows:
NetworkManager stores Wi-Fi connection information in .nmconnection files located in the /etc/NetworkManager/system-connections/ directory (Raspberry Pi forum thread, bookworm-feedback issue #72).
So type
cd /etc/NetworkManager/system-connections/
With ls you can see
preconfigured.nmconnection
which you created by using the Raspberry Pi Imager network settings.
You can now add further pre-configured networks by creating another *.nmconnection file.
Let’s say you set up the network for your parents’ place.
Enter
sudo nano parents.nmconnection
and paste the following text:
[connection]
id=second_wifi
uuid=95b17351-297c-4d9c-90f9-669d3ab81464
type=wifi
[wifi]
mode=infrastructure
ssid=YOUR_SSID_HERE
[wifi-security]
key-mgmt=wpa-psk
psk=YOUR_PASSWORD_HERE
[ipv4]
method=auto
[ipv6]
addr-gen-mode=default
method=auto
[proxy]
Replace YOUR_SSID_HERE with the network name and add YOUR_PASSWORD_HERE.
Do not keep the uuid= line from the example above either. Every connection profile needs its own unique UUID, so generate a fresh one with
uuidgen
and copy and paste that number into the config file, replacing the one shown here.
Save and close the file.
You can enter as many *.nmconnection files as you like. NetworkManager will check which of those networks it can actually see and use the relevant one.
Finally, for each *.nmconnection file, add the file permission with like
sudo chmod 600 /etc/NetworkManager/system-connections/parents.nmconnection
Conclusion
If you are planning to give away your home-brewed Raspberry Pi photo frame, it is super easy and ultimately very convenient to enter the access data to other WiFi networks at a time when you still have the hardware in your possession.
Was this article helpful?
Thank you for your support and motivation.