I noticed that wifi-connect no longer has a --clear flag to delete all network credentials. Instead PR https://github.com/balena-io/wifi-connect/pull/157 removed this flag and a comment on that PR discussion suggested using nmcli. So I installed the network-manager (Raspberry Pi) and this is what I get from a single container app when I try to use the nmcli to access the current status:
root@bfdd285:/usr/src/app# nmcli g
(process:1761): libnm-glib-WARNING **: (nm-object.c:157):constructor: code should not be reached
(process:1761): GLib-GObject-CRITICAL **: object NMClient 0x1c7b098 finalized while still in-construction
(process:1761): GLib-GObject-CRITICAL **: Custom constructor for class NMClient returned NULL (which is invalid). Please use GInitable instead.
(process:1761): nmcli-CRITICAL **: Error: Could not create NMClient object.
root@bfdd285:/usr/src/app#
@jason10 I have seen this error, but cannot remember the exact cause, but here are a couple of possibilities:
Make sure that you export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket before using nmcli in the container.
If you are using a Debian Jessie base image then you may try a Debian Stretch based one. Debian Stretch is the stable Debian version currently, although Buster will be made stable soon.
Also if using nmcli in a container, do not forget to mask the NetworkManager service if you have INITSYSTEM enabled for your container. You may also try our new balenalib base images.
@majorz looking into this further, the simple case of using the nmcli is unlikely to work in all cases, at least not easily.
SSID’s are arbitrary 32 8 bit data strings. You can have 32 0x00 (null) or 32 0x20 (space) .
So the path of taking the output of nmcli, passing it through some shell processing and calling nmcli to delete network credentials is unlikely to work easily.
Here are some example SSIDs that are likely to be painful to parse:
It may be that nmcli hex encodes it’s output when these sorts of SSIDs are found. But even double spaces is likely to be a pain to process. Suggestions?