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

Brian Murray brian at ubuntu.com
Thu Sep 6 17:44:56 UTC 2012


** Changed in: hostname (Ubuntu)
   Importance: Undecided => Wishlist

-- 
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:
  hostname.conf should prefer kernel cmdline 'hostname=' to contents of
  /etc/hostname

Status in “hostname” package in Ubuntu:
  New

Bug description:
  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/ubuntu/+source/hostname/+bug/1046405/+subscriptions




More information about the foundations-bugs mailing list