Ask Your Question
0

sudo: unable to resolve host

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

schegi gravatar image

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

Hi,

on newly created ubuntu instances (this image directly downloaded from ubuntu.com ), 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

127.0.0.1 localhost

Changing this to

127.0.0.1 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
1

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

Poonam Agarwal gravatar image

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

You can use below config to set the hosts entry automatically

#cloud-config
hostname: node1
fqdn: node1.example.com
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

Comments

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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 3,520 times

Last updated: Feb 18 '15