It turns out that the latest RaspberryPi OS (bookworm) now uses NetworkManager to mange wifi networks. It’s easy to disable NetworkManager and continue to use the implementation I’ve built above that uses wpa_supplicant, it’s just a matter of:
sudo systemctl disable --now NetworkManager.service
(The wpa_supplicant packages are all present and ready to be used directly on the newer images if needed - I think NetworkManager may just be a wrapper on top of wpa_supplicant).
However this brings up the question as to whether I should go back to the drawing board and re-implement this whole implementation using NetworkManager.
It is possible to achieve the same results in principle, I familiarised myself with the basic command line to configure NetworkManager yesterday and configure a simultaneous Access Point and client connection. I couldn’t find this documented that clearly elsewhere so here are the basic commands for anyone else interested:
1. Create a virtual interface for the access point:
sudo iw dev wlan0 interface add ap0 type __ap
2. Give the access point a name and password:
sudo nmcli dev wifi hotspot ifname ap0 ssid emonPi password emonpi2016
3. Connect to client WiFi (e.g home network):
sudo nmcli dev wifi connect MY_SSID password MY_PASSKEY ifname wlan0
4. Scan for WiFi networks on access point interface:
sudo nmcli device wifi list ifname ap0
easier to process format:
nmcli --get-values ssid,mode,signal,security device wifi list ifname ap0
5. Re-scan for WiFi networks on access point interface:
sudo nmcli device wifi rescan ifname ap0
6. Connect and disconnect from an interface:
sudo nmcli dev connect wlan0
sudo nmcli dev disconnect wlan0
Do I go back to the drawing board and explore the use of NetworkManager?
- Advantages: Minimal package changes on bookworm+ RaspberryPi OS images.
- Disadvantages: back to the drawing board, requires NetworkManager package installation on older images, dont know if it will install cleanly and work on older images? There are examples of installation on images as far back as 2015…
I’ve already spent a lot of development time on this before and over Christmas and there’s lots of other things I should attend to so as ever its also a question of how best to allocated my development time… Are there other reasons I should perhaps stick to the direct wpa_supplicant approach implemented so far above?