Public bug reported: Right now, if there is no 'local-hostname' in a DataSource's meta-data, then cloud-init will default the domain portion of the fqdn to be 'localdomain'. I did this because determining a system's fully qualified domain name is non-trivial, especially if this is occuring while network interfaces might be coming up or are not up. See the manpage of 'hostname' for warnings around '--fqdn'.
This was affecting our cobbler based installed systems. The ensemble/juju scripts were using 'hostname -f' to get a hostname that would be reachable. (That is still non-ideal due to the issues in hostname(1)). These instances would be provisioned to have an entry in /etc/hosts like: IP FQDN ALIAS [ALIAS2 [ ... ] ] but cloud-init would then update the entry to have 'localdomain' as there was no local-hostname. So, The solution proposed is: - boot instance with old cloud-init - verify it has cloud-init written entry in /etc/hosts 127.0.1.1 server-912.localdomain server-912 on ec2, 'localdomain' would be 'internal'. In either case, modify this, so that it the domain is 'mydomain' rather than 'localdomain' (so you can verify cloud-init changed that after reboot) - add seed content without a local-hostname sudo rm -Rf /var/lib/cloud/ sudo mkdir -p /var/lib/cloud/seed/nocloud-net python -c 'import boto.utils, pprint; md=boto.utils.get_instance_metadata(); del md["local-hostname"]; pprint.pprint(md);' > /tmp/meta-data sudo cp /tmp/meta-data /var/lib/cloud/seed/nocloud-net/meta-data sudo touch /var/lib/cloud/seed/nocloud-net/user-data - sudo reboot # after reboot, 'hostname -f' should will show 'localdomain' # $ hostname -f # server-912.localdomain # and /etc/hosts has been updated by cloud-init. That is the bug we want to fix. With our fixed available, we can then: - now, update /etc/hosts to have '$(hostname).mydomain' again sudo sed -i '/^127.0.1.1/d' /etc/hosts echo "127.0.1.1 $(hostname).mydomain $(hostname)" | sudo tee -a /etc/hosts - now, install new cloud-init sudo dpkg -i cloud-init_0.6.2_all.deb - clean meta-data for d in /var/lib/cloud/*; do [ "${d%seed}" = "$d" ] && sudo rm -Rf $d; done - reboot - verify that the host should now have: $ hostname -f server-912.mydomain ProblemType: Bug DistroRelease: Ubuntu 11.10 Package: cloud-init 0.6.1-0ubuntu17 ProcVersionSignature: User Name 3.0.0-11.17-virtual 3.0.4 Uname: Linux 3.0.0-11-virtual x86_64 ApportVersion: 1.22.1-0ubuntu2 Architecture: amd64 Date: Wed Sep 14 17:13:08 2011 Ec2AMI: ami-00000085 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable PackageArchitecture: all ProcEnviron: LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: cloud-init UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: cloud-init Importance: Undecided Assignee: Scott Moser (smoser) Status: In Progress ** Affects: cloud-init (Ubuntu) Importance: Medium Assignee: Scott Moser (smoser) Status: Confirmed ** Tags: amd64 apport-bug ec2-images oneiric -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to cloud-init in Ubuntu. https://bugs.launchpad.net/bugs/850206 Title: cloud-init should try harder to get domainname in fallback case To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/850206/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs