In contemporary Debian and Ubuntu, /etc/hosts should look like this:
127.0.0.1 localhost
127.0.1.1 foo
where "foo" is the Linux hostname and the content of /etc/hostname.
If the machine has a permanent IP address (123.45.67.89) and FQDN
(foo.bar.com) then it should look like this:
127.0.0.1 localhost
123.45.67.89 foo.bar.com foo
In the latter case "hostname -f" returns "foo.bar.com".
This is standard in Debian and Ubuntu and satisfies a number of desiderata:
* The hostname resolves to an address which resolves back the hostname or its FQDN variant
* "localhost" resolves to 127.0.0.1 which resolves back to "localhost"
* Each hostname resolves to a single IP address
* Each IP address resolves to a single canonical hostname
* The Linux hostname is resolvable
If software does not work with this configuration then that software is buggy.
That hostname -i returns 127.0.1.1 is not a bug.
In contemporary Debian and Ubuntu, /etc/hosts should look like this:
127.0.0.1 localhost
127.0.1.1 foo
where "foo" is the Linux hostname and the content of /etc/hostname.
If the machine has a permanent IP address (123.45.67.89) and FQDN
(foo.bar.com) then it should look like this:
127.0.0.1 localhost
123.45.67.89 foo.bar.com foo
In the latter case "hostname -f" returns "foo.bar.com".
This is standard in Debian and Ubuntu and satisfies a number of desiderata:
* The hostname resolves to an address which resolves back the hostname or its FQDN variant
* "localhost" resolves to 127.0.0.1 which resolves back to "localhost"
* Each hostname resolves to a single IP address
* Each IP address resolves to a single canonical hostname
* The Linux hostname is resolvable
If software does not work with this configuration then that software is buggy.
It looks to me as if this report can be closed.