apt-get update cannot connect to server

32,157

Solution 1

My problem was solved. I don't know what makes it works again. I tried these command unset http_proxy and unset https_proxy as @nilesh_101 suggested. One more thing I did is change proxy and then change it to default again. Thanks all you guys for answering my question!

Solution 2

I had the same problem.Then i clear all the contents of apt.conf file and it works perfectly.

Share:
32,157

Related videos on Youtube

Fingertron
Author by

Fingertron

Updated on September 18, 2022

Comments

  • Fingertron
    Fingertron over 1 year

    I try to get update on my Ubuntu 15.04 but if failed to connect to server

    me@me:~$ sudo apt-get update 
    Err http://archive.ubuntu.com vivid InRelease
    Err http://archive.ubuntu.com vivid-updates InRelease
    Err http://archive.ubuntu.com vivid-backports InRelease
    Err http://archive.ubuntu.com vivid-security InRelease
    Err http://archive.ubuntu.com vivid Release.gpg
      Unable to connect to 54.86.15.42:8080:
    Err http://archive.ubuntu.com vivid-updates Release.gpg
      Unable to connect to 54.86.15.42:8080:
    Err http://archive.ubuntu.com vivid-backports Release.gpg
      Unable to connect to 54.86.15.42:8080:
    Err http://archive.ubuntu.com vivid-security Release.gpg
      Unable to connect to 54.86.15.42:8080:
    Reading package lists... Done
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid/InRelease  
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-updates/InRelease  
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-backports/InRelease  
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-security/InRelease  
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid/Release.gpg  Unable to connect to 54.86.15.42:8080:
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-updates/Release.gpg  Unable to connect to 54.86.15.42:8080:
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-backports/Release.gpg  Unable to connect to 54.86.15.42:8080:
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/vivid-security/Release.gpg  Unable to connect to 54.86.15.42:8080:
    W: Some index files failed to download. They have been ignored, or old ones used instead
    

    I tried to find solutions but cannot fix it. Here what I tried so far:

    1. Modify in /etc/resolv.conf to:

      nameserver 8.8.8.8
      nameserver 8.8.8.4
      
    2. I tried to ping Ubuntu server

      me@me:~$ ping archive.ubuntu.com
      PING archive.ubuntu.com (91.189.91.15) 56(84) bytes of data.
      64 bytes from likho.canonical.com (91.189.91.15): icmp_seq=1 ttl=41 time=259 ms
      64 bytes from likho.canonical.com (91.189.91.15): icmp_seq=2 ttl=41 time=257 ms
      64 bytes from likho.canonical.com (91.189.91.15): icmp_seq=3 ttl=41 time=255 ms
      64 bytes from likho.canonical.com (91.189.91.15): icmp_seq=4 ttl=41 time=288 ms
      ^C
      --- archive.ubuntu.com ping statistics ---
      4 packets transmitted, 4 received, 0% packet loss, time 3003ms
      rtt min/avg/max/mdev = 255.160/265.270/288.347/13.437 ms
      
    3. In Software & Update, change server to Main Server

    4. In /etc/apt/apt.conf I found this line:

      Acquire::http::proxy 54.86.15.42:8080
      

      I tried to add # in front of it and didn't work. Then try to connect to 54.86.15.42:8080 and nothing happens. And ping to this address:

      me@me:~$ sudo ping 54.86.15.42
      PING 54.86.15.42 (54.86.15.42) 56(84) bytes of data.
      ^C
      --- 54.86.15.42 ping statistics ---
      16 packets transmitted, 0 received, 100% packet loss, time 14999ms
      

    It seems related to proxy or firewall but I don't use any of them. Does anybody know how to fix this?

    • Admin
      Admin over 8 years
      Edit your question and add the output of cat /etc/apt/apt.conf
    • Admin
      Admin over 8 years
      The output of it was added, I'm new to this forum so I'm not format code well to make it easy.
    • Admin
      Admin over 3 years
      @A.B. Thank you, that worked for me. I am a Linux novice, and an expert customer tinkered with this computer, so I could no longer download anything from any repo. Your solution worked for me.
  • Fingertron
    Fingertron over 8 years
    The content was cleared, but it don't work.
  • nilesh_101
    nilesh_101 over 8 years
    please post what is the output for this command " env | grep -i proxy "
  • Fingertron
    Fingertron over 8 years
    The output of the env | grep -i proxy is http_proxy=http://54.86.15.42:8080/ . What is that?
  • nilesh_101
    nilesh_101 over 8 years
    Did you try unset commands ? Which i hav posted above .
  • Fingertron
    Fingertron over 8 years
    The unset command was not found pro
  • nilesh_101
    nilesh_101 over 8 years
    Your output of env | grep -i proxy shows that still there is proxy.You can remove that by using 1.unset http_proxy 2. unset https_proxy
  • Fingertron
    Fingertron over 8 years
    I used the command you said, but the output of env | grep -i proxy is still the same.
  • Fingertron
    Fingertron over 8 years
    Thanks you for your enthusiasm, my problem was solved. I'm so happy now =))