9

On googling this error it seems that a lot of people are having this issue.

apt-get upgrade hangs at 0% [waiting for headers] apt-get install apache2 hangs at 0% [waiting for headers]. Some apt-get commands are working, but only certain packages.

Any ideas? I don't think this is an issue with slow repos because I've had it up for a long while and it hasn't budged from 0%. I have edited sources.list but I removed the lines I added when this issue presented itself and it hasn't made a difference.

Any clues would be really useful.

Braiam
  • 69,112

5 Answers5

7

Try to change the server selecting update manager, definitions,downloading from, then select a server more near you. and then try again.

Edit: see this link on how to add it by editing sources.list. How can I get apt to use a mirror close to me, or choose a faster mirror?

Celso
  • 432
4

The easiest approach consist of following commands:

sudo apt-get clean

&

sudo apt-get update

then

sudo apt-get install <package_name>

Cheers

Let me know if it works

3

I had to

sudo apt-key update
sudo apt-get update

From manpages:

apt-key is used to manage the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted.

Stiin
  • 512
  • 5
  • 11
1

If you are using a proxy server and have those settings in your user environment, try:

sudo -E apt update

to run the command as root but using your current user's environment.

O Sharv
  • 111
1

(Just reposting this as the original was inexplicably deleted)

I noticed this problem on a VM running Xenial in a data centre this week that had been running for 10 years ( upgraded through many Ubuntu LTS releases in that time).

I got tcpdump running to log requests to the URLs in /etc/apt/sources.list and didn't see any requests when I ran apt-get update

e.g.

 tcpdump -i eth0 host archive.ubuntu.com

If I tried to fetch from the host using wget , it worked fine

e.g.

wget archive.ubuntu.com/

Eventually I found that the ISP had set a proxy for apt in /etc/apt/apt.conf on my VM back in 2009 when the VM was first activated.

Acquire
{
  http 
  {
      Proxy "http://apt2.memset.net:3128";
  };
};

Evidently the proxy recently stopped working correctly.

I deleted the block above from my /etc/apt.conf and normality was restored

Noddy
  • 21