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:


Output of hostname -a:


Contents of /etc/hosts:   localhost.localdomain   localhost   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

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):   localhost.localdomain   localhost   server.example.com   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):       localhost.localdomain   localhost       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.

  • 1
    You're trying to fix the problem and jumping to conclusions without doing any diagnoses... I agree that such timeouts may very well come from name resolution trouble... Try a tcpdump on port 53 for example to see if it's doing DNS lookups that generate errors or the like: tcpdump -i lo port 53, tcpdump -i eth0 port 53...
    – Marki
    Commented Jan 11, 2015 at 16:04
  • Thanks for your comment. I've tried that and I see you are correct: no traffic on port 53, so the problem must be somewhere else. How can I do an strace if only the command sudo su presents the problem?
    – JohnKiller
    Commented Jan 12, 2015 at 21:18

1 Answer 1


I've finally found the problem, and it wasn't a server issue.

It was a setting in the client, Putty. X11 Forwarding was enabled, and caused all the issues. Switched that off.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .