The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,534 other followers in /etc/hosts for your hostname?

Posted by jpluimers on 2017/04/07

Coming from an OpenSuSE background, I was a bit surprised to find in the /etc/hosts file to point to the hostname in Raspbian distributions.

It means you have to change at least these files when altering the hostname:


In addition to those, I also changed these:


After altering these files, you want to run this (via: Pi Town: Change a Raspberry Pi’s Hostname without Rebooting [WayBack])

sudo /etc/init.d/ start

This prevents In order to prevent messages like sudo: unable to resolve host raspberrypi without rebooting.

The seems to be a Debian thing: Chapter 5. Network setup – 5.1.1. The hostname resolution [WayBack] has

The IP address in the second line of this example may not be found on some other Unix-like systems. The Debian Installer creates this entry for a system without a permanent IP address as a workaround for some software (e.g., GNOME) as documented in the bug #719621.

The <host_name> matches the hostname defined in the “/etc/hostname“.

For a system with a permanent IP address, that permanent IP address should be used here instead of

For a system with a permanent IP address and a fully qualified domain name (FQDN) provided by the Domain Name System (DNS), that canonical <host_name>.<domain_name> should be used instead of just <host_name>.

via: linux – Why does my hostname appear with the address rather than in /etc/hosts? – Server Fault [WayBack]

There isn’t a great deal of difference between the two; 127/8 (eg: => are all bound to the loopback interface.

The reason why is documented in the Debian manual here:

Ultimately, it is a bug workaround; the original report is here:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: