I have been asked by one of my teammate to modify networkmanager.conf config file to eg. change loglevel or activate connectivity check.
I have read that " The location of the main file and configuration directories may be changed through use of the –config, –config-dir, –system-config-dir, and –intern-config argument for NetworkManager, respectively." (source : https://www.systutorials.com/docs/linux/man/5-NetworkManager.conf/).
Can someone please point me howto specify this? (or if it is not possible !)
I will keep this post updated with my work notes, if it can be usefull for others!
So far, I have found that Systemd is responsible for starting Networkmanager (and many more : balenaOS - Docs).
systemd file is located at /lib/systemd/system/NetworkManager and contain the “start command” ExecStart=/usr/sbin/NetworkManager --no-daemon.
If I would add –config /path/to/my/configfile I think that I should do it in this file.
Anyway… That leads to other questions that make me feel like its a bad idea:
what happend if /path/to/my/configfile is not available?
can I specify After= directive to wait for the ovlume containing /path/to/my/configfile to be mounted ?
I have found that I can configure the connectiity check part of config file through config.json as in Network Setup on balenaOS - Balena Documentation
I still miss some configuration but I have to check if it is mandatory or not.
I would definitely recommend interacting through the NetworkManager API for more advanced use-cases as it is quite feature rich. I would especially recommend using NetworkManager native library libnm which supports many programming languages through gobject-introspection: NetworkManager/examples/python/gi at main · NetworkManager/NetworkManager · GitHub
What exactly do you expect your /path/to/my/configfile to point to that it won’t be available?
Some kind of mount that might take a little while, or rather something that might never exist?
In the first case, you might be able to make a script/service that watches for it to become available, and only starts NetworkManager after that; ex by specifying Before=NetworkManager.
If you are not opposed to modifying the NetworkManager service file, you could try adding RequiresMountsFor=/path/to/my/configfile
Sorry for the delay,
We have chosen another path, partially based on your recommendations :
We keep in mind DBus solution for Update NM loglevel, but we did it inside in our OS (which was a case study for me to create a small " Yocto 101" talk for my teammates).
We started development of an “nmcli wrapper” (as there are no full / prod ready stuff in Rust) to implement our own business rules
We plan to use config.json alongside configizer to set ConnectivityCheck stuff