[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1035349: regression: 'hostname' preseed alias for netcfg/get_hostname takes precedence over DHCP hostname



On Mon, 1 May 2023 at 17:53, Cyril Brulebois <kibi@debian.org> wrote:
>
> James Addison <jay@jp-hosting.net> (2023-05-01):
> > I understand that line of thinking, but we note that we have already
> > received feedback on Salsa[1] from a user whose Bookworm installation
> > workflow has been affected, and confirmed that the reported problem
> > exists.
>
> And that user mentioned hostname=unassigned-hostname which would be
> addressed if we were to implement what I mentioned?

Yep, fair point!

> Initially it looked like specific values were expected to lead to a
> particular behaviour, but if we've been encouraging people to expect
> *any* fallback values specified there, that's indeed another story.
>
> (I had mentioned before “unassigned-hostname” wasn't to be seen in any
> packages but “unassigned-domain”/“unnassigned-domain” definitely have
> some specific handling.)

I do see that guestfs-tools references[1] them, and I suppose other
downstream software could do as well.  But within the installer's
components, I don't think that they have any special meaning.

> I have some pending yet unrelated things to investigate on the preseed
> side; I'm not sure I'll want to be testing each and every possible
> combination (esp. tweaking the configuration of the DHCP server behind
> the virtualization layer), but I should be able to test the water.

Totally reasonable, yep.  I'll try to get familiar with the process of
rebuilding the installer's initrd.

Currently I think that a relevant patch should:

  * Unset the hostname, or set the hostname to '(none)', so that the
installer's netcfg ignores[2] and is unaware of an install-time
hostname.
  * Within env2debconf, attempt to find a hostname specified on the
kernel command-line:
    * The parameter may appear as a 'hostname=value', or
'hostname?=value' key=value pair.
    * The parameter must appear strictly before any '---' delimiter_
in the line.
  * If a hostname was found:
    * Create a local 'hostname' variable within the env2debconf'
script containing the hostname's value.
    * Ensure that the 'seen' flag is assigned appropriately:
      * The value should be empty if the hostname was matched using
'hostname=value'.
      * The value should be non-empty if the hostname as matched using
'hostname?=value'.
  * If no hostname was found:
    * Do nothing.

As I wrote up those criteria, they expanded and became more
complicated than I initially realized, so perhaps there could be
further hidden complexity here.  I'll do my best to prepare and test a
patch anyway.

[1] - https://sources.debian.org/src/guestfs-tools/1.48.3-4/customize/hostname.ml/?hl=125#L129

[2] - https://sources.debian.org/src/netcfg/1.185/dhcp.c/?hl=578#L580


Reply to: