How i configure my /etc/host on Ubuntu?

October 5, 2014 10.7k views

Hi, i created hostname: '', but, how i configure the etc/host?

My actual hosts is this localhost mysite mysite

Is correct?

But when i execute

sudo service hostname restart

This error appears:

stop: Unknow instance 
hostname stop/waiting

The command hostname return and the hostname -f return

2 Answers

That's fine, the hostname service runs hostname -b -F /etc/hostname (see /etc/init/hostname.conf) which exits after setting the hostname, so it doesn't continue running.

Your /etc/hosts file looks proper, are you experiencing any issues with your hostname config?

  • @kamaln7 i need change the /etc/init/hostname.conf and modify the value description?

    The only problem I have is the message 'stop: Unknown instance
    hostname stop / waiting '

  • No, you do not need to change anything. Everything should work fine as is. hostname is not a service, it's a program that runs once, sets the hostname, and exists.

    stop: Unkown instance

    basically means that the hostname program is not running, which is OK.

  • Ok, thanks very much kamaln7. You save my day.

I am having similar issue where I am unable to stop a service ( i am trying to stop freeradius )

stop: Unknown instance:

  • Now i stop/reload the Apache.

    sudo service apache2 reload
    sudo service apache2 stop
    sudo service apache2 start
Have another answer? Share your knowledge.