Coming from an OpenSuSE background, I was a bit surprised to find 127.0.1.1 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/hostname.sh start
This prevents In order to prevent messages like
sudo: unable to resolve host raspberrypi without rebooting.
127.0.0.1 seems to be a Debian thing: Chapter 5. Network setup – 5.1.1. The hostname resolution [WayBack] has
The IP address
127.0.1.1in 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 “
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>.
There isn’t a great deal of difference between the two; 127/8 (eg: 127.0.0.0 => 127.255.255.255) are all bound to the loopback interface.
The reason why is documented in the Debian manual here:http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution
Ultimately, it is a bug workaround; the original report is here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316099