Change location of networkmanager config file


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 :

Can someone please point me howto specify this? (or if it is not possible !)


NB: I can modify our custom OS if needed

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.

Hi, for the connectivity check you may indeed configure it through the config.json as you noted.

For changing the log level of NetworkManager you may use its D-Bus API or access it through a wrapper library: NetworkManager/examples at main · NetworkManager/NetworkManager · GitHub

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

1 Like

I was indeed affraid of a volume that may take a while to mount !
Your solution might work.
I will keep you updated !
Thanks a lot

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

Thanks again,
see you.