[Bug 1046405] Re: hostname.conf should prefer kernel cmdline 'hostname=' to contents of /etc/hostname

Scott Moser smoser at ubuntu.com
Fri Sep 14 19:03:46 UTC 2012


** Also affects: maas
   Importance: Undecided
       Status: New

** No longer affects: hostname (Ubuntu)

** Summary changed:

- hostname.conf should prefer kernel cmdline 'hostname=' to contents of /etc/hostname
+ ephemeral/enlistment nodes should dhcp with correct hostname

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to hostname in Ubuntu.
https://bugs.launchpad.net/bugs/1046405

Title:
  ephemeral/enlistment nodes should dhcp with correct hostname

Status in MAAS:
  Fix Committed

Bug description:
  Note: This bug has been changed to maas as a project, and its
  implementation changed significantly.  See the original bug report
  below.

  Instead of having hostname.conf read a kernel parameter, I've
  validated via packet inspection that at least in quantal, klibc's
  ipconfig seems to correctly send hostname as whatever is provided on
  the cmdline.

  The format is:
   ip=::::<hostname>

  
  | It would be nice if /etc/init/hostname.conf allowed the kernel cmdline to
  | override the value in /etc/hostname.  This is useful in the netboot case
  | where the kernel cmdline can be controlled on a per MAC basis, but the
  | filesystem is read-only.

  | At this point I'm looking for input on possible fallout of a change like
  | this.

  | Here is the suggested /etc/init/hostname.conf:
  | #
  | # This task is run on startup to set the system hostname from /etc/hostname,
  | # falling back to "localhost" if that file is not readable or is empty and
  | # no hostname has yet been set.
  | description     "set system hostname"
  | start on startup
  | task
  | script
  |  { read cmdline < /proc/cmdline || : } >/dev/null 2>&1
  |  if hn="${cmdline#*hostname=}" && [ "$hn" != "${cmdline}" ]; then
  |     hn="${hn%% *}"
  |     echo "setting hostname ${hn}" >/dev/console
  |     exec hostname "${hn}"
  |  fi
  |  exec hostname -b -F /etc/hostname
  |end script

  ProblemType: Bug
  DistroRelease: Ubuntu 12.10
  Package: hostname 3.11ubuntu1
  ProcVersionSignature: Ubuntu 3.5.0-13.14-generic 3.5.3
  Uname: Linux 3.5.0-13-generic x86_64
  ApportVersion: 2.5.1-0ubuntu4
  Architecture: amd64
  Date: Wed Sep  5 11:53:36 2012
  EcryptfsInUse: Yes
  InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
  ProcEnviron:
   TERM=xterm
   PATH=(custom, user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: hostname
  UpgradeStatus: Upgraded to quantal on 2011-11-07 (303 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas/+bug/1046405/+subscriptions




More information about the foundations-bugs mailing list