Cloud-init overwriting hostname given to kernel on baremetal

Bug #838280 reported by Andres Rodriguez
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released

Bug Description

When PXE'ing, the hostname for the system is set via a kernel parameter. However, once installation has finished, and cloud-init starts doing is configuration based on a determined meta-data/user-data file it changes the hostname to ubuntuhost without respecting what was given to the kernel.

The kernel config for PXE is as follows:

default linux
prompt 0
timeout 1
label linux
        kernel /images/oneiric-x86_64/linux
        ipappend 2
        append initrd=/images/oneiric-x86_64/initrd.gz locale= netcfg/dhcp_timeout=120 console=ttyS0,9600n8 locale=en_US text netcfg/choose_interface=eth0 DEBCONF_DEBUG=developer priority=critical auto url=http://A.B.C.D/cblr/svc/op/ks/system/ domain=local.lan suite=oneiric

The user data includes:

apt-update: true
apt-upgrade: true
- {source: 'ppa:ensemble/ppa'}
machine-data: {ensemble-zookeeper-hosts: 'localhost:2181', machine-id: '0'}
packages: [bzr, tmux, python-setuptools, python-twisted, python-argparse, python-txaws,
  python-zookeeper, bzr, default-jre-headless, zookeeper, zookeeperd]
runcmd: [export ENSEMBLE_INSTANCE_ID=MTMxNDMwNzI0OS40ODkyODE2MzAuODE5ODY, sudo apt-get
    install -y python-txzookeeper, sudo mkdir -p /usr/lib/ensemble, 'cd /usr/lib/ensemble
    && sudo /usr/bin/bzr co lp:~fwereade/ensemble/cobbler-complete-fixes ensemble',
  cd /usr/lib/ensemble/ensemble && sudo python develop, sudo mkdir -p /var/lib/ensemble,
  sudo mkdir -p /var/log/ensemble, 'ensemble-admin initialize --instance-id=$ENSEMBLE_INSTANCE_ID
    --admin-identity="admin:W/v3qx7AN7yfII/tSptndJ7lvhU="', 'ENSEMBLE_MACHINE_ID=0
    ENSEMBLE_ZOOKEEPER=localhost:2181 python -m ensemble.agents.machine -n --logfile=/var/log/ensemble/machine-agent.log
--pidfile=/var/run/ensemble/', 'ENSEMBLE_ZOOKEEPER=localhost:2181
    python -m ensemble.agents.provision -n --logfile=/var/log/ensemble/provision-agent.log
ssh_authorized_keys: ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4kMKjQFUDiWir9LJlfWmhg7570p/3akbGvJf9SXhHeiYSkK+bGtY+UcS6Bq+UZZ32qvfjv1nZ3OzLI8eK6YkHC2oT7bihqAe80c/ObJEsAGlmfEf+2uKP+B3uW8eQm61Q35aNIx/zuInoOPV5wyieA348LThKcAkQq5w4PbOyy6tfuKwnbdhUYvMUEDVc/wFvFgNES5D5Dg+0QngS9gP7UWZrraYuh+19jtYk9gdnYUj2IPiFlDG7OCJt/Y6voWPKEVNAi1OkvwqWNRcoHAHClkMdtZQZm91mSH64vKP5djjMJgg3MsyF9HYVSXrvd0EGRF1/1BW0sYDF0WZ26F8z

I had to manually add the following for cloud-init to correctly set the hostname:

manage_etc_hosts: True
hostname: <hostname>

Related branches

Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Scott Moser (smoser) wrote :
Changed in cloud-init (Ubuntu):
status: New → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote :

Well, wrong commit number. should have said revno 435.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.1-0ubuntu16

cloud-init (0.6.1-0ubuntu16) oneiric; urgency=low

  * catch up with trunk at revision 439
  * warn on failure to set hostname (LP: #832175)
  * properly wait for all static interfaces to be up before
    cloud-init runs (depends on fix in LP:# 838968).
  * in DataSources NoCloud and OVF, do not set hostname to the
    static value 'ubuntuhost' if local-hostname is not in metadata
    (LP: #838280)
  * improve the way ssh_authorized_keys is updated, so that the
    values given will be used. (LP: #434076, LP: #833499)
  * cloud-init-notnet.conf: minor changes to config
 -- Scott Moser <email address hidden> Thu, 01 Sep 2011 21:14:09 -0400

Changed in cloud-init (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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