0

This question has been previously asked here, but was closed due to be being too localized. Many people on that thread disagreed with the closure and it was never answered. How do I configure two NICs in ubuntu-server preseed?

I am attempting to configure my /etc/network/interfaces file during installation, for an end result of an out-of-the-box dnsmasq DHCP/DNS server. My preseeding file works fine and installs the OS automatically without user input. I am attempting to use the d-i late_command to overwrite the default /etc/network/interfaces file with my own interfaces file, however it doesn't seem to be doing anything.

I have stored the new interfaces file in the preseed folder, along with my .seed file. I am using this code in my preseed file to overwrite the interfaces file with my new one.

d-i late_command string cp /cdrom/preseed/interfaces /target/etc/network/interfaces

I have also tried a few different ways to do this using different commands, such as:

d-i late_command string in-target sudo rm /etc/network/interfaces && mv /cdrom/preseed/interfaces /target/etc/network/interfaces

But none of those have worked either.

My full preseed file:

#Ubuntu Server 16.04 LTS unattended installation main file

#Partioning
d-i partman-auto/init_automatically_partition select Guides - use entire  disk
d-i partman-auto/method string regular
d-i partman/choose_partition select finish
d-i partman/confirm_write_new_label boolean true
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

#Clock
clock-setup clock-setup/utc boolean true
clock-setup clock-setup/utc-auto boolean true
d-i time/zone string Europe/London
d-i clock-setup/ntp boolean true

#Network
d-i netcfg/get_hostname string lab-router
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select auto
choose-mirror-bin mirror/http/proxy string  

#Locale
d-i debian-installer/locale string en_GB
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string gb
d-i keyboard-configuration/layoutcode strinsg gb

#User configuration
d-i passwd/user-fullname string Router
d-i passwd/username string router
d-i passwd/user-password password router
d-i passwd/user-password-again password router
d-i user-setup/allow-password-weak boolean true
user-setup-udeb user-setup/encrypt-home boolean false

#Grub Config
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian_ boolean true
d-i finish-install/reboot_in_progress note
grub-installer grub-installer/only_debian boolean true

#Packages
tasksel tasksel/first select none
pkgsel pkgsel/update-policy select none #No automatic updates. 

#Execution after installation
d-i late_command string cp /cdrom/preseed/interfaces /target/etc/network/interfaces

Help pls? :P

ARM
  • 1

1 Answers1

2

It seems that once the installer is done the configuration in the file.

/etc/network/interfaces

will overwrite this one

/target/etc/network/interfaces

You might want to replace your late_command line with this instead.

#Execution after installation
d-i late_command string cp /cdrom/preseed/interfaces /etc/network/interfaces

I am using a similar method in my preseed to configure my network. Note that if you will be using a script to configure /etc/network/interfaces, you will need to run it with busybox ex:

d-i late_command string wget http://url/to/script -O ./script.sh; \
ash ./script.sh;

or

./script.sh

if your script has the shebang

#!/bin/ash