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

Bug#772523: preseeding get_domain using DHCP is broken

Package: netcfg
Version: 1.125
Severity: important


I'm trying to preseed d-i to run a fully automated installation, using
jessie beta2. I'm trying to use a DHCP config, with the hostname being
set from reverse DNS and the domain set by the DHCP server using the
domain-name DHCP option (isc-dhcp's "option domain-name").

What currently happens is that I'm getting a priority=high input prompt
for the domain name, prefilled with the DHCP domain name. FWIW, I've
verified that the udhcpc lease file contains the domain name and that a
manual invocation of udhcpc results in /tmp/domain_name being prefilled
with my domain.

The log output is:
netcfg[342]: DEBUG: State is now 1 
netcfg[342]: DEBUG: State is now 2 
netcfg[342]: DEBUG: State is now 5 
debconf: --> GET netcfg/hostname
netcfg[342]: DEBUG: Using DNS to try and obtain default hostname
netcfg[342]: DEBUG: Getting default hostname from rDNS lookup of
autoconfigured address
netcfg[342]: DEBUG: Hostname found: d-i-test.eqiad.wmnet
netcfg[342]: DEBUG: d-i-test.eqiad.wmnet is a valid FQDN
netcfg[342]: DEBUG: We have a real FQDN
debconf: --> SET netcfg/get_hostname d-i-eqiad
netcfg[342]: DEBUG: Preseeding domain from global: eqiad.wmnet
debconf: --> SET netcfg/get_domain eqiad.wmnet
debconf: --> INPUT high netcfg/get_hostname
debconf: --> GET netcfg/get_hostname
netcfg[342]: DEBUG: State is now 5 
debconf: --> INPUT high netcfg/get_domain

What I think happens is:

0) netcfg_activate_dhcp gets called; state is AUTOCONFIG.
   netcfg_autoconfig() gets called, and in turn netcfg_dhcp(). udhcpc is
   started, gets a lease and writes the domain to DOMAINFILE. netcfg_dhcp()
   reads the domain name from /tmp/domain_name, sets domain to
   "eqiad.wmnet" and have_domain to 0.

1) Multiple states transition. DHCP State is now HOSTNAME (5).
   preseed_hostname_from_fqdn() is getting called, with globals
   have_domain=1, domain="eqiad.wmnet". This sets netcfg/get_domain to
   "eqiad.wmnet" and netcfg/get_hostname to the non-FQDN part of the
   hostname ("d-i-test").

2) netcfg_get_hostname() gets called, with accept_domain=1, which sets
  the global have_domain=0 at the top, but never sets it back to 1, as
  it only does so if netcfg/get_hostname is an FQDN, which it isn't

3) DHCP State is now DOMAIN (6). netcfg_get_domain() gets called with
   have_domain=0 and prompts.

Looking at the code, it looks like *removing* the domain name from my
DHCP config entirely would work, as d-i would then fallback to splitting
the FQDN into a domain part as well.

The whole behavior seems like very buggy to me; specifically, (2) seems
flawed, as it unconditionally sets have_domain to 0 and only sets it
back under certain specific conditions (= FQDN), entirely ignoring all
the work that preseed_hostname_from_fqdn() does.


Reply to: