Bug#1031643: preseeding hostname=foo via the kernel command line seems to be ignored
Source: preseed
Followup-For: Bug #1031643
X-Debbugs-Cc: carnil@debian.org, andi@debian.org, freyermuth@physik.uni-bonn.de
Hi folks,
This is nitpicky, but I think there is an important-ish further detail to
report.
The fix applied does repopulate the 'hostname' variable so that env2debconf can
read from it and place it into the 'netcfg/get_hostname'[1] preseed variable; so
far, so good.
However: the hostname in the running Debian installer masks the intended
behaviour of 'netcfg/get_hostname', because netcfg's DHCP logic prefers[2]
to read the running system's hostname, when it is non-empty.
I've confirmed this behaviour by netbooting from the Bookworm RC 2 installer;
DHCP configuration of a hostname is ignored when the command-line hostname is
present.
(note: a similar setting, 'netcfg/hostname' is available that takes precedence
over DHCP[2] hostname values, but it's a separate setting, and is not our
documented[3] behaviour of the 'hostname' preseed alias)
Suggestions:
This was found following some related documentation discussion[4] on Salsa. In
that discussion, Martin Samuelsson suggests a fix that I think should work:
We should (un)set the d-i system's hostname to the 'empty' hostname early in
the installer session.
That could happen in env2debconf -- or it could be placed even earlier in the
installer scripts (since it's only relatively recently that Linux 6.0 began
reading a hostname, we should be confident that d-i works OK without one
configured).
I'm doing some testing to confirm the fix currently.
Thanks,
James
[1] - https://sources.debian.org/src/netcfg/1.185/dhcp.c/#L578
[2] - https://sources.debian.org/src/netcfg/1.185/debian/netcfg-common.templates/?hl=145#L160
[3] - https://www.debian.org/releases/stable/amd64/apbs02.en.html#preseed-aliases
[4] - https://salsa.debian.org/installer-team/installation-guide/-/merge_requests/25
Reply to: