I'm currently in the progress of preseeding a Debian installation with custom setup scripts running after the actual installation to create a simple installer that will create everything that I need.
Now I found how to install additional packages and added the NetworkManager package, to simplify networking stuff. However the device has multiple ethernet interfaces and installing NetworkManager during the Debian installation creates the file
/etc/NetworkManager/system-connections/Wired connection 1. However that file is configured incorrectly for the actual system. So if I remove it while NetworkManager is off and reboot, everything is working just fine. But having the file makes NetworkManager label all interfaces as "Wired connection 1" and only one interface can be active, etc. All in all, that file needs to go.
Now I first tried just removing the file during the script I invoke wiht
preseed/late_command (the script runs and removes the file, I checked that). But upon booting into the system after the installation the file is back. Next I tried stopping the NetworkManager service before removing the file with
in-target systemctl stop NetworkManager, but that just gives me the lovely log line
in-target: Running in chroot, ignoring request. And naturally that also doesn't work.
How I can install NetworkManager during preseeding with a blank "system-connections" configuration?
In summary the relevant (and working) lines from my
d-i pkgsel/include string ... network-manager ... d-i preseed/late_command string sh /.../postinstall.sh
and in my
postinstall.sh I tried
in-target rm /etc/NetworkManager/system-connections/*
(which actually removes the file in that moment) and
in-target systemctl stop NetworkManager in-target rm /etc/NetworkManager/system-connections/*
As suggested I tried removing the connection with
This is my script:
in-target nmcli con delete $(in-target nmcli -g uuid con)
And this is the result:
May 6 09:16:43 log-output: + in-target May 6 09:16:43 log-output: nmcli -g uuid con May 6 09:16:43 log-output: dpkg-divert: warning: diverting file '/sbin/start-stop-daemon' from an Essential package with rename is dangerous, use --no-rename May 6 09:16:43 in-target: Error: Could not create NMClient object: Could not connect: No such file or directory. May 6 09:16:44 log-output: + in-target nmcli con delete May 6 09:16:44 log-output: dpkg-divert: warning: diverting file '/sbin/start-stop-daemon' from an Essential package with rename is dangerous, use --no-rename May 6 09:16:44 in-target: Error: Could not create NMClient object: Could not connect: No such file or directory.