ephemeral/enlistment nodes should dhcp with correct hostname

Bug #1046405 reported by Scott Moser on 2012-09-05
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
High
Scott Moser

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)

Related branches

Scott Moser (smoser) wrote :
Scott Moser (smoser) wrote :

I discussed this with slangasek in #ubuntu-devel today, and he preferred not to have this in /etc/init/hostname.conf as it does incur a for for the shell, and can be done elsewhere.

http://irclogs.ubuntu.com/2012/09/05/%23ubuntu-devel.html#t16:57

Changed in hostname (Ubuntu):
importance: Undecided → Wishlist
Scott Moser (smoser) wrote :

I came across this:
 http://www.kernel.org/doc/Documentation/frv/booting.txt

| (*) ip=<ip>::::<host>:<iface>:<cfg>
|
| Configure the network interface. If <cfg> is "off" then <ip> should
| specify the IP address for the network device <iface>. <host> provide
| the hostname for the device.
|
| If <cfg> is "bootp" or "dhcp", then all of these parameters will be
| discovered by consulting a BOOTP or DHCP server.
|
| For example, the following might be used:
|
| ip=192.168.73.12::::frv:eth0:off
|
| This sets the IP address on the VDK motherboard RTL8029 ethernet chipset
| (eth0) to be 192.168.73.12, and sets the board's hostname to be "frv".

So its possible we can already do this.

Scott Moser (smoser) on 2012-09-14
no longer affects: hostname (Ubuntu)
summary: - hostname.conf should prefer kernel cmdline 'hostname=' to contents of
- /etc/hostname
+ ephemeral/enlistment nodes should dhcp with correct hostname
Scott Moser (smoser) wrote :

This went in under revno 1002.

description: updated
Changed in maas:
assignee: nobody → Scott Moser (smoser)
status: New → Fix Committed
Scott Moser (smoser) wrote :

Note, this change caused regression in multi-device systems (bug 1052660) and is being reverted.
For at least temporarily, we will move back to 'ip=dhcp'
https://code.launchpad.net/~smoser/maas/lp1052660/+merge/125046

Scott Moser (smoser) wrote :

I moved this back to 'Confirmed' as I backed the change out.

Changed in maas:
status: Fix Committed → Confirmed
Changed in maas:
status: Confirmed → Triaged
importance: Undecided → High
Scott Moser (smoser) wrote :

I've just added a package named 'cloud-initramfs-dyn-netconf' to the cloud-initramfs-tools package.
We'll utilize this package to fix this bug in the following manner.
 * add cloud-initramfs-dyn-netconf to the ephemeral images
 * boot with cmdline including 'ip=::::<hostname>:BOOTIF' and 'BOOTIF=MA:CA:DD:RE:SS'
 * cloud-initramfs-dyn-netconf will change the string 'BOOTIF' in the ip= to the actual interface name that is found on the system to have the provided BOOTIF.
 * open-iscsi's initramfs package will then call 'configure_networking' which will use the modified value of ip=.

Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.