I noticed that when deploying a virtual machine while using a preseed, the host name specified in the preseed is ignored and the one from DNS server is used instead.
Detailed description
The Ubuntu Server machine is deployed using:
virt-install \
--name custom-name \
--initrd-inject /some-path/preseed.cfg \
--extra-args "preseed/file=preseed.cfg" \
...
The preseed file contains, among others, the following lines (notice the custom-name
value in the second line):
...
d-i netcfg/disable_dhcp boolean true
...
d-i netcfg/get_hostname string custom-name
d-i netcfg/get_domain string pelicandd.com
d-i netcfg/get_ipaddress string 192.168.1.35
...
On the other hand, DNS server contains both the A record:
demo IN A 192.168.1.35
as well as the PTR record:
35 IN PTR demo.example.com.
Once the machine is created, it appears that /etc/hostname
contains:
demo
and that /etc/hosts
contains:
127.0.0.1 localhost
192.168.1.35 demo.example.com demo
Question
I'm not particularly happy with the fact that the deployment process accesses the DNS server to get the information. Not only does it take time, but in some circumstances, the DNS server can be down (such as the case where it's the DNS server itself which is being deployed).
What should I specify in the preseed to prevent the installer from accessing DNS to retrieve information which is already available in the preseed?
RTFM helped. From Debian's preseed example:
Which means that
netcfg/get_hostname
is irrelevant: its only purpose is to prevent the installer from asking the question in the first place.Indeed, when I set the value of
netcfg/hostname
, both/etc/hostname
and/etc/hosts
contain the values specified in the preseed, ignoring the DNS PTR record.