Ubuntu 20.04 LTS Focal apt-get update not working

9,916

After deeper investigation, I found that the apt-get was blocked on a perimeter firewall. After allowing the traffic for apt-get application, everything worked fine.

Share:
9,916

Related videos on Youtube

sikas
Author by

sikas

Updated on September 18, 2022

Comments

  • sikas
    sikas over 1 year

    So, here is my problem. I know it has been reported a lot, but somehow, it is kinda different.

    I'm using Linux Ubuntu 20.04 LTS on a VM, and was able to successfully install the image with no problems.

    syspass@syspass:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04 LTS
    Release:        20.04
    Codename:       focal
    

    Now, I'm trying to update the repo to be able to install some packages that I need to be able to deploy some systems on the the machine. However, I'm not able to due to a Connection Error

    syspass@syspass:~$ sudo apt-get update
    Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
      Connection failed [IP: 91.189.88.152 80]
    Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
      Connection failed [IP: 91.189.88.152 80]
    Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
      Connection failed [IP: 91.189.88.152 80]
    Err:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
      Connection failed [IP: 91.189.88.152 80]
    Reading package lists... Done
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Connection failed [IP: 91.189.88.152 80]
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Connection failed [IP: 91.189.88.152 80]
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Connection failed [IP: 91.189.88.152 80]
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-security/InRelease  Connection failed [IP: 91.189.88.152 80]
    W: Some index files failed to download. They have been ignored, or old ones used instead.
    

    So, I did some digging, and found that the IP Address is indeed reachable from the VM (Note: ping is blocked over the network for security purposes)

    syspass@syspass:~$ nslookup archive.ubuntu.com
    Server:         127.0.0.53
    Address:        127.0.0.53#53
    
    Non-authoritative answer:
    Name:   archive.ubuntu.com
    Address: 91.189.88.142
    Name:   archive.ubuntu.com
    Address: 91.189.88.152
    Name:   archive.ubuntu.com
    Address: 2001:67c:1360:8001::23
    Name:   archive.ubuntu.com
    Address: 2001:67c:1360:8001::24
    
    syspass@syspass:/var/tmp$ tracepath -4 -b archive.ubuntu.com
     1?: [LOCALHOST]                      pmtu 1500
     1:  _gateway (10.8.4.254)                                 1.047ms
     1:  _gateway (10.8.4.254)                                 1.068ms
     2:  10.8.6.1 (10.8.6.1)                                   1.030ms
     3:  10.8.5.2 (10.8.5.2)                                   1.446ms
     4:  10.2.240.254 (10.2.240.254)                           2.673ms
     5:  no reply
     6:  no reply
     7:  197.246.5.49 (197.246.5.49)                          11.161ms pmtu 1492
     7:  no reply
     8:  no reply
     9:  no reply
    10:  no reply
    11:  no reply
    12:  no reply
    13:  no reply
    14:  actiontoad.canonical.com (91.189.88.152)            131.035ms reached
         Resume: pmtu 1492 hops 14 back 14
    

    So, I decided to do a bit of further digging, and found that the required resource is indeed reachable!

    syspass@syspass:~$ wget http://archive.ubuntu.com/ubuntu/dists/focal/InRelease
    --2020-12-08 09:39:29--  http://archive.ubuntu.com/ubuntu/dists/focal/InRelease
    Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.152, 91.189.88.142, 2001:67c:1360:8001::24, ...
    Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.152|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 264892 (259K)
    Saving to: ‘InRelease’
    
    InRelease                          100%[=============================================================>] 258.68K   345KB/s    in 0.8s
    
    2020-12-08 09:39:30 (345 KB/s) - ‘InRelease’ saved [264892/264892]
    
    syspass@syspass:~$ curl -vvv http://archive.ubuntu.com/ubuntu/dists/focal/InRelease --HEAD
    *   Trying 91.189.88.142:80...
    * TCP_NODELAY set
    * Connected to archive.ubuntu.com (91.189.88.142) port 80 (#0)
    > HEAD /ubuntu/dists/focal/InRelease HTTP/1.1
    > Host: archive.ubuntu.com
    > User-Agent: curl/7.68.0
    > Accept: */*
    >
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    < Date: Tue, 08 Dec 2020 09:42:06 GMT
    Date: Tue, 08 Dec 2020 09:42:06 GMT
    < Server: Apache/2.4.29 (Ubuntu)
    Server: Apache/2.4.29 (Ubuntu)
    < Last-Modified: Thu, 23 Apr 2020 17:34:17 GMT
    Last-Modified: Thu, 23 Apr 2020 17:34:17 GMT
    < ETag: "40abc-5a3f8a874d840"
    ETag: "40abc-5a3f8a874d840"
    < Accept-Ranges: bytes
    Accept-Ranges: bytes
    < Content-Length: 264892
    Content-Length: 264892
    < Cache-Control: max-age=0, proxy-revalidate
    Cache-Control: max-age=0, proxy-revalidate
    < Expires: Tue, 08 Dec 2020 09:42:06 GMT
    Expires: Tue, 08 Dec 2020 09:42:06 GMT
    
    <
    * Connection #0 to host archive.ubuntu.com left intact
    

    My /etc/apt/sources.list file is below as well in case it can help:

    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://archive.ubuntu.com/ubuntu focal main restricted
    # deb-src http://archive.ubuntu.com/ubuntu focal main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
    # deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://archive.ubuntu.com/ubuntu focal universe
    # deb-src http://archive.ubuntu.com/ubuntu focal universe
    deb http://archive.ubuntu.com/ubuntu focal-updates universe
    # deb-src http://archive.ubuntu.com/ubuntu focal-updates universe
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://archive.ubuntu.com/ubuntu focal multiverse
    # deb-src http://archive.ubuntu.com/ubuntu focal multiverse
    deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
    # deb-src http://archive.ubuntu.com/ubuntu focal-updates multiverse
    
    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
    # deb-src http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse