Ask Your Question

sudo: unable to resolve host

asked 2015-02-17 07:11:35 -0500

schegi gravatar image

updated 2015-02-17 07:16:33 -0500


on newly created ubuntu instances (this image directly downloaded from ), i always get a message 'sudo: unable to resolve host test'. It seems like the hostname is missing in the localhost declaration in /etc/hosts localhost

Changing this to localhost 'hostname_here'

solves the problem. My question now how to automate this with cloud-init?

Thy Stefan

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-17 10:48:03 -0500

Poonam Agarwal gravatar image

updated 2015-02-18 03:19:04 -0500

You can use below config to set the hosts entry automatically

hostname: node1
manage_etc_hosts: true

This may be also possible also by passing a custom script with your network settings passed as user-data during instance creation

nova boot --flavor <flavor> --image <image id> --user-data <path_to_user_data_file> somehost

But this information needs to provided explicitly during instance creation

edit flag offensive delete link more


Thx this works. Is there any option to automate this, especially then passing this using horizon i have to define this seperately for every instance to be launched.

schegi gravatar imageschegi ( 2015-02-17 12:32:47 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-02-17 07:11:35 -0500

Seen: 4,165 times

Last updated: Feb 18 '15