Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just updated my server from Debian 5 to Debian 6 and now when I try to git pull (Or any git command it seems) I get this:

ssh: connect to host port 22: Connection timed out
fatal: The remote end hung up unexpectedly

I had set up gitosis as well. Also I'm not sure if its related but when I do ssh localhost I get ssh: Could not resolve hostname localhost: Name or service not known. Same for if I type out SSH is working though, as I'm using it to connect to the server. Any idea whats causing this?


My hosts file: ruinvalor localhost localhost.localdomain
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
ff02::3         ip6-allhosts





passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
share|improve this question
Do you have the IPv4 and IPV6 entries for localhost in the /etc/hosts of the server ? ssh uses DNS and DNS uses the hosts file, and IPv6 disabling, works different from lenny to squeeze. – poisonbit Apr 17 '11 at 18:19
@poisonbit I think so, I posted the contents of my hosts file above – Telanor Apr 17 '11 at 18:27
"Could not resolve hostname localhost" points to some problem on that file... maybe " localhost.localdomain localhost" as a first line, then with your other aliases ? loopback network is so everything should continue working with this test. – poisonbit Apr 17 '11 at 18:43
What's in your /etc/resolv.conf and the files line of your /etc/nsswitch.conf? – justarobert Apr 17 '11 at 18:54
@poisonbit I made the changes, didnt seem to help. @justarobert: I posted the contents of those two files above – Telanor Apr 17 '11 at 19:32
up vote 0 down vote accepted

I found out what the problem was. iptables was restoring rules before the localhost adapter was initiated. For some reason after the upgrade the rules file became invalid, making the restore fail and causing the localhost adapter to not be loaded.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.