Issue
I have a network interface problem with my preseed.
Here is my preseed (I put only the data related to the network):
d-i debian-installer/add-kernel-opts string net.ifnames=0
d-i netcfg/choose_interface select auto
d-i netcfg/choose_interface select eth0
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/get_ipaddress string 192.168.0.50
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string debian-template
When Debian is deployed, in the file /etc/network/interfaces
the interface is always named ens192 instead of eth0 despite the addition of: d-i debian-installer/add-kernel-opts string net.ifnames=0
.
The IP configuration is invalid, and I have to rename the interface to eth0 and restart the network service.
what should I change so that the preseed names the interface eth0 instead of ens192?
Solution
The kernel options will obviously only apply after the next reboot.
The installer offers a hook to run arbitrary code after it's done from a preseed
so you could use that to rename the interface and restart your network config.
d-i preseed/late_command string /usr/local/libexec/your-fix-script
Obviously, something will need to have created /usr/local/libexec/your-fix-script
at an earlier stage. You can run arbitrary shell commands from this hook, but it probably makes sense to put them in a file if they are nontrivial.
Answered By - tripleee