I'm currently playing around with debian-installer at home (using Devuan Linux) over PXE boot and would like to have the installer ask for a hostname and domain with pre-set default value for the domain only and unsure if this is possible? The intention is that if I can learn how preseeding works I hope to bring this knowledge to my workplace in the hope we can make Ubuntu easier for our support teams to deploy, as it is very much manual at present.
To my understanding, in order for netboot to occur (and I'm hoping Devuan netboot works in much the same way as Debian as much of the documentation I've read has actually been Debian) netcfg must complete before it obtains its preseed file from TFTP which means in order to force the installer re-run the netcfg portion of setup I have to perform...
d-i preseed/early_command string kill-all-dhcp; netcfg
d-i netcfg/hostname seen false d-i netcfg/domain string network-name.int d-i netcfg/domain seen false
...in order to get debian-installer to ask the question, but also provide a default value.
This page suggests this is true: https://www.debian.org/releases/stable/amd64/apbs05.html.en
...specifically: B.5.2. Using preseeding to change default values
It is possible to use preseeding to change the default answer for a question, but still have the question asked. To do this the seen flag must be reset to “false” after setting the value for a question.
This Reddit article suggests someone else also tried this to no avail with 'seen' set to both false and true: https://www.reddit.com/r/debian/comments/7ak9h0/debian_preseed_installation_no_dialog_for/
I also read elsewhere that debconf priority has a role to play here also. The netboot vesamenu.c32 included with the Devuan netboot files specifies 'priority=critical' on the kernel command-line, but I understand the hostname and domain dialog boxes are high priority instead, and as a result do not appear regardless unless debconf priority is set to high. Doing so, causes the installer to ask for hostname as desired, but sadly after providing one also presents a menu asking what the next step should be. I played about with setting priority to high on the kernel command-line, then having the preseed run the above kill-all-dhcp;netcfg line to reinit networking and force it to ask for a hostname, and THEN changing priority level again to critical using:
debconf debconf/priority critical
... (as shown in the above reddit post at the top of the preseed file given) but sadly this resulted in the installer not presenting the hostname question or the domain question, and running through fully-automated install with no questions being asked.
One blog article I read (unfortunately can't find this in my list of open tabs) suggested that order of the commands in the preseed file doesn't matter, leading me to believe I can't change priority after answering the hostname question
At the moment, priority on the kernel command-line is set to critical, in preseed.cfg I specify the following relevant section:
## Locale/Keymap configuration d-i debian-installer/locale string en_GB d-i keyboard-configuration/xkb-keymap select gb ## Network configuration (none, just use DHCP) d-i netcfg/choose_interface select auto ## Hostname configuration d-i preseed/early_command string kill-all-dhcp; netcfg debconf debconf/priority high d-i netcfg/hostname string CHANGETHIS d-i netcfg/hostname seen false d-i netcfg/domain string network-name.int d-i netcfg/domain seen false debconf debconf/priority string critical
I know I could resolve this by having debian-installer run a custom script at the end to change the hostname in /etc/hostname and update /etc/hosts prior to reboot, but I wanted to have the installation source untouched so any future upgrades require as little steps as possible to get working (hopefully get away with just modifying the preseed, instead of having to customise and update scripts to work with the latest OS version), plus another article I had read suggested I can only specify d-i preseed/late_command and/or d-i preseed/early_command once so I'd rather save that for a future situation where preseed really isn't able to handle something we need.