sqlgrey: Can’t connect to TCP port

I encountered this error:

2007/06/11-01:33:22 sqlgrey (type Net::Server::Multiplex) starting! pid(2063) Binding to TCP port 2501 on host localhost
2007/06/11-01:33:22 Can't connect to TCP port 2501 on localhost [Invalid argument] at line 88 in file /usr/lib/perl5/vendor_perl/5.8.8/Net/Server/Proto/TCP.pm
2007/06/11-01:33:22 Server closing! shutdown() on unopened socket GEN0 at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/IO/Socket.pm line 242.

when trying to get sqlgrey running on a new machine. One guy in germany seems to have hit the problem, but that wasn’t resolved (online anyway).

Doing so strace’es on sqlgrey indicated a DNS lookup failure. Eventually I traced this to a missing line in /etc/hosts:

127.0.0.1  localhost.localdomain  localhost

add that line, and startup succeeds (or moves on to subsequent errors).