I'm running an Ubuntu Server 12.04.5 LTS and when I type sudo su
it takes 30+ seconds to open the shell. Searching on internet, this problem seems related to the file /etc/hosts
and /etc/hostname
.
This isn't really a problem for me to wait, however this is affecting other programs (especially sSMTP wich I use for sending mails from PHP) and Apache is giving the classical "could not reliably determine the server's fully qualified domain name".
So I've checked the hosts file and corrected it, and now the apache error is gone but the other problems persist. sudo su
now takes about 10-15 seconds.
Output of uname -n
, hostname
and hostname -f
is:
server.example.com
Output of hostname -a
:
server
Contents of /etc/hosts
:
127.0.0.1 localhost.localdomain localhost
127.0.1.1 server.example.com server
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
This server has a public IPv4 address and the DNS record for server.example.com
is correct.
If I try ping server
or ping server.example.com
they work as expected (resolving to 127.0.1.1
)
The server is also running openvpn with less than 10 clients, but disabling the service has no consequences.
Things tried so far:
1) Changing hostname to "localhost": this solves the problem, but isn't acceptable;
2) This version of /etc/hosts
(not working):
127.0.0.1 localhost.localdomain localhost server.example.com
127.0.1.1 server.example.com server
::1 ip6-localhost ip6-loopback server.example.com
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
3) Current version of /etc/hosts
(not working):
127.0.0.1 localhost.localdomain localhost
127.0.1.1 server.sistema3.it server
::1 ip6-localhost ip6-loopback localhost
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I've run many servers in the past and this is the only one having this problem. I'm completely stuck, any help is very appreciated. Thanks.
I've also posted this question over to AskUbuntu, but maybe is better ServerFault for this kind of problem.
tcpdump -i lo port 53
,tcpdump -i eth0 port 53
...strace
if only the commandsudo su
presents the problem?