[Bug 1452202] Re: ubuntu preseed install fails to set a hostname

Eric Desrochers eric.desrochers at canonical.com
Wed Oct 5 15:56:18 UTC 2016


Moving the script in preseed src code under "network-preseed.postinst"
address the vg name creation situation (see previous comment).

It basically make "netcfg/hostname",if set, to load (override the
hostname) before the "Volume Group" creation start which build the vg
name based on the hostname (/etc/hostname)

Thanks cyphermox for your help.

Eric

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1452202

Title:
  ubuntu preseed install fails to set a hostname

Status in netcfg package in Ubuntu:
  In Progress
Status in netcfg source package in Trusty:
  In Progress
Status in netcfg source package in Xenial:
  In Progress
Status in netcfg package in Debian:
  New

Bug description:
  [Impact]

   * DHCP hostname take precedence over netcfg/hostname, if set.

  The problem is that the system read the preseed file after having run
  netcfg, thus the preseed parameter cannot be loaded straight from the
  start.

  [Test Case]

   * HOWTO reproduce :

  Install Ubuntu using a preseed[1] file[2] and add the following line in the preseed recipe :
  d-i netcfg/hostname string <HOSTNAME>

  If the machine get a HOSTNAME from DHCP server or from a reverse
  lookup, netcfg/hostname doesn't take precedence.

  [1] - url=http://<WEB_SERVER>/<PRESEED_FILE>
  [2] - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt

  [Regression Potential]

   * none expected, the change is trivial.

  [Other Info]

   * Debian bug : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755848
     Patch has been submitted to Debian
   * There is an old patch introduced in 2012 [Use netcfg/hostname for the hostname if found. (Closes: #606636)] but that doesn't work as expected.
   * The submitted debdiff include a script called 56netcfg-hostname under finish-install.d that override the hostname if netcfg/hostname set at the end of the installation.

  [Original Description]

  == Comment: #0 - Edward R. Cheslek <echeslak at us.ibm.com> - 2015-04-28 18:04:01 ==
  ---Problem Description---
  An install using a preseed file fails to configure the hostname of the system being installed.

  Contact Information = echeslak at us.ibm.com

  ---uname output---
  Ubuntu 15.04 ppc64le

  Machine Type = Tuleta pKVM guest

  ---Debugger---
  A debugger is not configured

  ---Steps to Reproduce---
   set up an automated install using a preseed file.  Grub menu entry:

  menuentry "Test" {
          linux   ubuntu-installer/ppc64el/vmlinux tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false auto=true preseed/url=http://10.33.11.31/data/autoinst/ted.preseed
          initrd  ubuntu-installer/ppc64el/initrd.gz
  }

  The install will begin, and reach the hostname configuration screen,
  then stop, waiting for input.  The hostname is set in the preseed
  file, which is attached.

  Install method: http from ports.ubuntu.com

  Install disk info: n/a

  Install ISO Information: n/a

  *Additional Instructions for echeslak at us.ibm.com:
  -Post a private note with access information to the machine that the bug is occuring on.

  == Comment: #1 - SANDHYA VENUGOPALA <vsandhya at in.ibm.com> - 2015-04-29 06:08:18 ==
  Some literature that is floating around -

  when booting from an installation CD and using a preseed file on a
  network, the installer will need answers to some questions (hostname,
  network configuration, ...) before it can load the preseed file. On
  the other hand, including a customized preseed file in a setup CD will
  allow for more automation, but requires re-mastering of the CD.

  The configuration of domain and host name, and keymap are still being
  asked, even if you have them in your preseed file as shown above. So
  if you want to kickstart the preseeded installation without a single
  questions asked, append the following more options to kernel boot
  prompt:

  console-keymaps-at/keymap=us hostname=myhost domain=example.com
  locale=en_US

  Perhaps David Heller can throw some light on this and let us know if
  its bug.

  == Comment: #2 - Edward R. Cheslek <echeslak at us.ibm.com> - 2015-04-29 07:57:29 ==
  I'm booting and installing from the network.  Even if I leave the hostname related options out of my preseed, it still picks up and displays the correct hostname from dhcp.

  == Comment: #3 - David Heller <hellerda at us.ibm.com> - 2015-05-05 14:12:52 ==
  I'm not very familiar with this particular preseed option so I'm not sure how it's supposed to behave.  However, in a quick test on Ubuntu 15.04, adding "netcfg/hostname=blah" to the kernel cmdline worked: it successfully overrode the hostname from DHCP (the way it is usually set in my environment) with no other changes required.

  In the preseed however, I could not make it work, even if I commented
  out the related lines:

  #d-i netcfg/get_hostname string unassigned-hostname
  #d-i netcfg/get_domain string unassigned-domain
  d-i netcfg/hostname string blah

  And looking in the installer log, it could be a order of operations
  thing, since we see it picking up the hostname from DHCP before
  retrieving the preseed...

  # cat /var/log/syslog | egrep "hostname|seed"
  May  5 16:10:16 netcfg[2270]: INFO: DHCP hostname: "myhost"
  May  5 16:10:16 netcfg[2270]: DEBUG: Preseeding domain from global: ibm.com
  May  5 16:10:16 main-menu[301]: INFO: Menu item 'network-preseed' selected
  May  5 16:10:18 preseed: successfully loaded preseed file from ftp://9.114.211.201/install/autoinst/myhost

  That said: this doesn't tell exactly when the hostname was *set*, or
  if it should be overridden even if it is set at that point.

  IMHO it should work the same way in the preseed as it does command-
  line, regardless of order, since that is what the user is requesting.
  If the installer already "set" the hostname from DHCP info, well, it
  should set it again with what the user wants.

  But I don't know if this is supported or expected to work in all
  cases.  Frankly, I'm not even sure if this is the correct way to do it
  in preseed (although it seems like it is).

  But I think it's fair to mirror this to Ubuntu to ask.

  == Comment: #5 - Edward R. Cheslek <echeslak at us.ibm.com> - 2015-05-05 16:21:35 ==
  I can set the hostname on the linux kernel line in grub, and it will  show up correctly in the installer, but my issue is that the install still asks me to confirm that the hostname is correct.  I want to proceed through my install totally unattended.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/1452202/+subscriptions



More information about the Ubuntu-sponsors mailing list