Another option/idea I'd like to provide here is the migration script
used by NetworkManager [1], to transfer NM keyfiles from
/etc/NetworkManager/system-conncetions/ into /etc/netplan. This script
is automatically run on package upgrade of NetworkManager. I understand
this does not exactly fit the usecase described by alkisg, as you'd go
from debian-box:/etc/NetworkManager/system-connections -> ubuntu-
box:/etc/NetworkManager/system-connections -> migrate.sh -> ubuntu-
box:/run/NetworkManager/system-connections
Running "./migrate.sh configure" would transfer your copied original NM
keyfiles from a different box into Netplan and re-generate them in
/run/NetworkManager/system-connections:
```bash
# Run "Netplan Everywhere" migration after debhelper (re-)started
# NetworkManager.service for us. On every package upgrade.
DIR="/etc/NetworkManager/system-connections"
if [ "$1" = "configure" ] && [ -d "$DIR" ]; then
mkdir -p /run/netplan/nm-migrate
for CON in /etc/NetworkManager/system-connections/*; do
TYPE=$(file -bi "$CON" | cut -s -d ";" -f 1)
[ "$TYPE" = "text/plain" ] || continue # skip non-keyfiles
UUID=$(grep "^uuid=" "$CON" | cut -c 6-)
if [ -n "$UUID" ]
then
# Wait for NetworkManager startup to complete,
# so we can safely use nmcli. Wait in every interation to handle
# a crashed NetworkManager in the previous migraiton step.
if ! nm-online -qs; then
echo "SKIP: NetworkManager is not ready ..." 1>&2
continue
fi
BACKUP="/run/netplan/nm-migrate/"$(basename "$CON")
ORIG_NAME=$(nmcli --get-values connection.id con show "$UUID") || \
{ echo "SKIP: $(basename "$CON") ($UUID) unknown to
NetworkManager." 1>&2 && \
continue; }
cp "$CON" "$BACKUP"
echo "Migrating $ORIG_NAME ($UUID) to /etc/netplan" 1>&2
# Touch the connection's ID (con-name) to trigger its migration.
# The Netplan integration will translate the original NM keyfile
from
# /etc/NetworkManager/system-connections/* to a YAML file located in
# /etc/netplan/90-NM-*.yaml and re-generate a corresponding keyfile
in
# /run/NetworkManager/system-connections/netplan-NM-*.nmconnection
nmcli con mod "$UUID" con-name "$ORIG_NAME" || \
(echo "FAILED. Restoring backup ..." 1>&2 && mv "$BACKUP"
"$CON" && \
rm -f "/etc/netplan/90-NM-$UUID"*.yaml)
rm -f "$BACKUP" # clear backup (if it still exists)
fi
done
rm -rf /run/netplan/nm-migrate # cleanup after ourselves
(nm-online -qs && nmcli con reload) || echo "WARNING: NetworkManager could
not reload connections ..." 1>&2
fi
```
[1] https://git.launchpad.net/network-manager/tree/debian/network-
manager.postinst#n62
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to network-manager in Ubuntu.
https://bugs.launchpad.net/bugs/2041491
Title:
Provide an option to avoid the yaml NM backend
Status in netplan.io package in Ubuntu:
Confirmed
Status in network-manager package in Ubuntu:
Confirmed
Bug description:
Hi, recently netplan added support for a yaml NM backend:
https://discourse.ubuntu.com/t/call-for-testing-networkmanager-yaml-
settings/32420
The rationale is that "the descriptive YAML layer is especially useful
in cloud environments":
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/556
It's great that you care about that user group!
Please also care for the rest of us that do not use cloud environments!
For example, I routinely review, clone, backup or even directly edit
the /etc/NetworkManager/system-connections files in my desktops and
servers, in all distributions.
Having an Ubuntu-specific way to do things will make things harder for
me. I will have to learn a new Ubuntu-specific syntax, develop scripts
and methods to convert my connections between distributions, I will
need to discover and report bugs in the netplan <=> nm mapping etc...
I.e. Ubuntu is great for the cloud, and it's awesome that you want to provide
a unified yaml-based experience for cloud-init etc.
But Ubuntu is also great outside the cloud; please allow us to continue
having a unified experience between distributions (i.e. directly using nm or
systemd-networkd) without enforcing an Ubuntu-specific way of doing things
(netplan) to us.
For Ubuntu 24.04+, please provide an option to avoid the yaml NM
backend, thank you very much!
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2041491/+subscriptions
--
Mailing list: https://launchpad.net/~touch-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp