How to analyze a "[Waiting for headers]" problem during "apt-get update"?

Solution 1:

Better still, just do:

apt-get -o Debug::Acquire::http=true update

Solution 2:

I was able to fix it. http://debian.sur5r.net/i3/ (quantal, universe) did not respond. After disabling it, apt-get update succeeds.

Tips for the next one that runs into this problem:

  1. Start synaptic and disable sources until Reload no longer hangs. Especially, 3rd party sources seem to be candidates.
  2. Reactive your sources until you hit the one that causes problems.

synaptic is great for diagnostics. When Reload hangs and you abort it, it prints out the current repository. In my case, it was exactly the bad one:

Failed to fetch http://debian.sur5r.net/i3/dists/quantal/InRelease  
Some index files failed to download. They have been ignored, or old ones used instead.