canonical / canonical/cloud-init

[Azure] Published hostname (ddns) gets reset on reboot after `hostnamectl set-hostname`

Open
#3,136 1 comment 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1755260](https://bugs.launchpad.net/cloud-init/+bug/1755260)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2018-03-12T18:35:26.628172+00:00
date_fix_committed = None
date_fix_released = None
id = 1755260
importance = low
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1755260
milestone = None
owner = paul-meyer
owner_name = Paul Meyer
private = False
status = triaged
submitter = paul-meyer
submitter_name = Paul Meyer
tags = []
duplicates = []

_Launchpad user **Paul Meyer(paul-meyer)** wrote on 2018-03-12T18:35:26.628172+00:00_

Verified on Azure, using Trusty (Canonical:UbuntuServer:14.04.5-LTS:14.04.201803080) (cloud-init 0.7.5-0ubuntu1.22)

1. create a Trusty VM:
az vm create -g paulmey-test -n ubuntu14 --image Canonical:UbuntuServer:14.04.5-LTS:latest
2. On the VM, edit /etc/waagent.conf to set Provisioning.MonitorHostName=y and restart the agent.
This sets waagent to ifdown/ifup when it detects a hostname change such that the new hostname is
sent on the DHCP request, which in Azure populates the instance DNS.
3. verify 'nslookup ubuntu14' shows a DNS record for the initial hostname (ubuntu14)
4. run 'hostnamectl set-hostname seeifitsticks' to change the hostname
5. Wait a minute for the update to propagate, verify that 'nslookup seeifitsticks' now shows a DNS
record for the new hostname. Verify that /etc/hostname is updated. Verify that 'nslookup ubuntu14'
no longer returns a valid DNS record.
6. reboot the vm
7. Once back up, notice that the hostname is seeifitsticks. However, 'nslookup seeifitsticks' returns
NXDOMAIN, which 'nslookup ubuntu14' shows a DNS record.

From the cloud-init log, it looks like cloud-init sets the hostname to whatever is in the ovf-env.xml during interface bounce. On Xenial, the data source is loaded from cache, which is why this code does not even run.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.