Setting hostname via config is not reflected in /etc/hosts

Bug #768296 reported by Avishai Ish-Shalom
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Invalid
Medium
Unassigned
cloud-init (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

When setting the hostname using the hostname attribute (cc_set_hostname plugin), cc_update_etc_hosts will ignore the modified hostname and use the default hostname instead.

Revision history for this message
Scott Moser (smoser) wrote :

You are correct that setting hostname in cloud-config does not update /etc/hosts.
The value that you set in cloud-config should be correctly written to '/etc/hostname' (by cc_set_hostname).

If you also set 'manage_etc_hosts: True' then your hostname will also be written to /etc/hosts.

So, to do what you want:
#cloud-config
manage_etc_hosts: True
hostname: my-hostname-here

Do you think that is acceptable ?

I'm marking this as "Incomplete", please comment back and either move it to 'New' or 'Invalid' (or whatever state you might think is best).

Changed in cloud-init:
importance: Undecided → Medium
status: New → Incomplete
Scott Moser (smoser)
tags: added: ec2-images uec-images
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Marking confirmed in Ubuntu's cloud-init, and subscribing Marc Cluet, who is hitting some issues with this, when trying to run a rabbitmq-server in an Ubuntu cloud instance.

It seems that the rabbitmq-server needs to be able to resolve the system's host name.

We're trying to figure out the best way to do that. Marc had a proposed patch that added it in the rabbitmq-server's package's postinst, but that implementation was at least initially rejected.

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

I'm marking this invalid in both ubuntu and cloud-init upstream.
If cloud-config like the following does not do what you want, please re-open:
#cloud-config
manage_etc_hosts: True
hostname: my-hostname-here

Changed in cloud-init:
status: Incomplete → Invalid
Changed in cloud-init (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
James Falcon (falcojr) wrote :
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.