This service automatically configures and manages WiFi connections on your Raspberry Pi using NetworkManager. No need for a monitor or keyboard. Can directly edit the config file on the SD card from your computer.
Place these files directly in the root folder of your Raspberry Pi SD card. These will then be available under /boot/firmware/ when you are on the PI via ssh:
wifi_config.txt: Configuration file for WiFi networkswifi-setup.sh: Main script that configures WiFi connectionswifi-setup.service: Systemd service filesetup-wifi-service.sh: Installation script
- Copy all files directly to the root folder of your Raspberry Pi micro SD card:
wifi_config.txtwifi-setup.shwifi-setup.servicesetup-wifi-service.sh
-
Insert the SD card into your Raspberry Pi and power it on.
-
Wait for the Raspberry Pi to boot up.
-
Connect to the Raspberry Pi via SSH using the following command:
ssh pi@raspberrypi.localOr use whatever IP address or network name you have set for the Raspberry Pi.
- Make the installation script executable:
sudo chmod +x /boot/firmware/setup-wifi-service.sh- Run the installation script:
sudo /boot/firmware/setup-wifi-service.sh- Edit the WiFi configuration: You can edit the configuration file directly on the SD card from your computer. So if you move somewhere to a new wifi you can just plug in the SD card and edit the file to setup a new wifi. No screen required.
sudo nano /boot/firmware/wifi_config.txtThe format you can see in the example file.
SSID,password,priority
Example:
HomeWifi,YourPassword,3
YourIphoneHotSpot,YourPassword,2
YourHotSpot,YourPassword,1
Higher priority number = higher priority (tried first). Automatically connects to the next one if the first one is not available.
Here some commands that might be useful:
Check the logs at:
sudo tail -f /var/log/wifi-setup.log- Check service status:
sudo systemctl status wifi-setup.service- Restart service:
sudo systemctl restart wifi-setup.service- Stop service:
sudo systemctl stop wifi-setup.service- Disable service:
sudo systemctl disable wifi-setup.serviceUpdate and restart the service after a change:
sudo cp wifi-setup.sh /usr/local/bin/
sudo systemctl restart wifi-setup.service
sudo systemctl status wifi-setup.service
sudo journalctl -u wifi-setup.service -fIf you encounter any issues:
- Check the service logs:
sudo journalctl -u wifi-setup.service -f- Verify the configuration file exists:
ls -l /boot/firmware/wifi_config.txt- Check NetworkManager status:
sudo systemctl status NetworkManager- View available WiFi networks:
nmcli device wifi list- View all configured networks:
nmcli connection show | grep wifi