This is usually because your hostname will not resolve. The best way to fix this is to make sure that /etc/hosts is consulted by your resolver first by editing /etc/host.conf and putting the hosts line first. Then, simply put an entry in /etc/hosts for your local machine. If you have no local network, change your localhost line:
127.0.0.1 foo.example.com foo localhost
Otherwise, simply add another entry for your host. Consult the relevant man pages for more details.
You should be able to successfully ping -c1 `hostname` when you are done.