/srv/irclogs.ubuntu.com/2024/09/23/#netplan.txt

tuxcrafter58hello all I am migrating some systems from ubuntu 20 to ubuntu 22 and the way network-manager / netplan are behaving is very different and is causing me issue.15:22
tuxcrafter58nmcli con add type wifi con-name hq-wifi ifname wlan0 ssid "{{vault_nmcli_hq_ssid}}" used to create this file /etc/NetworkManager/system-connections/hq-wifi.nmconnection15:22
tuxcrafter58however on ubuntu 22 i do not have any files in /etc/NetworkManager/system-connections/ anymore15:22
tuxcrafter58however I do see files under /etc/netplan/ but they are sorted by some UUID and everytime I run nmcli con add type wifi con-name hq-wifi it creates a new file with UUID15:22
tuxcrafter58causing me to have many config files for the same network name15:22
tuxcrafter58I am looking for a way to know if nmcli con add type wifi con-name hq-wifi has been created without the use of any uuid if possible15:22
tuxcrafter58Is there a way change some config file so files are stored under /etc/NetworkManager/system-connections/  again?15:23
tuxcrafter58or is there a way to use nmcli con add type wifi con-name hq-wifi ifname wlan0 ssid and have config file under /etc/netplan/ that matches the con-name instead of generating a new file with an uuid, i now got a few hundred uuid config files all for the same wifi network.15:25
=== tuxcrafter58 is now known as tuxcrafter
slyontuxcrafter: I guess you could you "nmcli con show hq-wifi", which will error out if that connection-profile does not exist15:29
slyonalternatively, check the connection profiles generated by Netplan in /run/NetworkManager/sytem-connections. but I think those would also contain the UUID in the file name. In addition to the SSID15:30
tuxcrafter# nmcli con show hq-wifi | wc -l15:30
tuxcrafter535915:30
tuxcrafterIsn't it a bug that the same connection can have multiple uuids?15:30
tuxcrafterls -hal /run/NetworkManager/system-connections/ all those files are based on an UUID not on the nmcli con-name15:32
danilogondolfothey can have the same name but not uuids, as far as I know15:32
tuxcrafterI could not see the option to use nmcli con add with an UUID instead of the con-name, is there an option I am missing there?15:32
danilogondolfoso you create connections but never delete them?15:32
danilogondolfohow did you delete connections before? By deleting them from /etc/NetworkManager/system-connections?15:34
tuxcrafterit used to be that con-name corresponded to a config file, so I would check for /etc/NetworkManager/system-connections/hq-wifi.nmconnection but this does not work anymore15:35
tuxcrafterunless there is an option to revert back to this behaviour that I am missing.15:35
danilogondolfoas slyon said, you can check it with "nmcli con show hq-wifi" or look for a file with "hq-wifi" in its name in /run/NetworkManager/sytem-connections. But you need to delete the old files first now.15:40
danilogondolfoif you want to drop all the connections quickly you can delete /etc/netplan/90-NM-* and run netplan apply15:41
danilogondolfoand now you need to delete the connection after finishing your tests with "nmcli con del hq-wifi"15:42
slyonI guess you could also call `nmcli con del hq-wifi` to have all connection profiles with that name be deleted.15:43
slyonbtw: There's no way to revert back to /etc/NetworkManager/system-connections/*.nmconnection profiles. Netplan was chosen to be the single source of network configuration, as found in /etc/netplan/15:44
tuxcrafterOkay so the only way is to use nmcli con show hq-wifi to check if the connection exist15:45
tuxcrafterno more reliable way to check through the file system15:45
slyonyou could "sudo netplan get | yq" and filter/process that as needed through yq, or any other YAML processing logic. But that might be overkill, given the `nmcli` commands from above.15:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!