Re: Programmatically manage no-auto-default.state file?



On Wed, 2022-08-10 at 09:01 +0300, Andrei Borzenkov via networkmanager-
list wrote:
When automatic connection is deleted/modified, interface is added to
/var/lib/NetworkManager/no-auto-default.state. Is there any device
property to show "no-auto-default" state? Is there any command/D-Bus
API
to remove interface from this list?


there is no such API.

I guess you can delete the file, or modify it with "sed". That gets
complicated, because NetworkManager only loads the file ones and writes
it anew at unpredictable times. To get it right, you'd have to stop NM,
modify the file, start NM.

Btw, `sudo NetworkManager --print-config` prints the content of the no-
auto-default.state flag. Note that as NetworkManager loads the file
only once and remembers it, the running NetworkManager may not have
cached what --print-config shows.


Why do you want that?

"no-auto-default" flag prevents the creation of the "Wired connection
1" profiles. The "Wired connection 1" profile gets generated for
ethernet (depending on "no-auto-default" setting), so that you could
boot a unconfigured machine, and it would connect automatically. E.g.
if you boot a new VM, that it connects using DHCP.

The device ends up in /var/lib/NetworkManager/no-auto-default.state
because the user manually deleted or modified the generated "Wired
connection 1". If the user did so already, then they are already "on
the machine" and messed with it. At this point, if the user wants a
profile, they can just create one and don't need to rely on "Wired
connection 1". There is no other magic to "Wired connection 1".


Thomas



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]