Manual creation of NetworkManager connection file fails (Error: Unknown connection)
The NetworkManager.conf
man page notes of the base config file plugin:
For security, it will ignore files that are readable or writeable by any user or group other than root.
In this case the result is "Unknown connection". chown
your connection to root and chmod
it 0600 to match those created by NetworkManager.
More generally, connection files are very sensitive to spelling and nmcli
a) will ignore a connection entirely if anything is wrong and b) won't tell you about typos in its normal output. However, see /var/syslog (default, configurable) for NetworkManager messages. NetworkManager doesn't seem to notice permission or ownership changes on their own so touch
the file to have it re-scanned in those cases.
I had created a connection file with the incorrect line
key-mgmt=wpa2-psk
...that value should have been simply "wpa-psk" and only the log file had been telling me where the problem was:
Sep 17 12:26:05 ahost NetworkManager[2477]: keyfile: updating /etc/NetworkManager/system-connections/ATT2
Sep 17 12:26:05 ahost NetworkManager[2477]: keyfile: error: invalid or missing connection property 'key-mgmt'
Related videos on Youtube
Comments
-
nicolaus-hee over 1 year
Objective: I am trying to set up a 3G connection using NetworkManager 0.9.4 via command line. I have previously succeeded (see this question) by setting up the connection through the nm-applet (GUI in X) but now I need to replicate this on many machines and therefore want to do it via command line as part of an installation bash script that does this among other things.
My approach: I have written a bash script that creates this connection file and places it in
/etc/NetworkManager/system-connections/
:[connection] id=viettel uuid=df62d4f8-0699-11e5-8996-ab1b9b4c6754 type=gsm autoconnect=false [ppp] lcp-echo-failure=5 lcp-echo-interval=30 [ipv4] method=auto [serial] baud=115200 [gsm] number=*99# password-flags=1 apn=e-connect
The file looks exactly like the (working) file created by the GUI tool before.
I added
monitor-connection-files=yes
to/etc/NetworkManager/NetworkManager.conf
so NM would notice changed configuration files during runtime.Problem: However, when trying to establish a connection (
sudo nmcli con up id viettel
), I get this error:Error: Unknown connection: viettel.
And indeed, when running
sudo nmcli con list
to see the connections that NM is aware of, I get an empty list:NAME UUID TYPE TIMESTAMP-REAL
I saw that some people recommend running
nmcli con reload
to refresh this list but that command is not available in the latest stable NM package for my system (see below) and it shouldn't be needed withmonitor-connection-files=yes
anyway, as far as I understand. I tried restarting the NM service and rebooting, both without success.So it looks like NM is simply not looking for the connection file in the right place or has some sort of list of available connections that was not refreshed after the new file was added.
My question: How do I make NM aware of the new connection file? Any other advice what to do next?
System information: I am running this on a Raspberry Pi 2 with Raspbian Wheezy (all packages updated). NetworkManager is version 0.9.4 (I saw that there are a newer versions available but apparently not released as stable debian package for the RPi)
Thanks a lot for you help!