Problem with apt-get update on Ubuntu 20.04 lts

23,433

Solution 1

apt-get clean worked! Thanks for the help from all of you.

Solution 2

The reason this happens is because not all the mirrors get updated at the same time. For a variety of reasons, updates get rolled out on a schedule and can take a few days for all the mirrors to be in sync.

If you see this problem, the best solution is to just take a nap or wait until the following day. If you'd like confirmation, or to see when your mirrors are updated, you can actually just look here. That will show you the status of mirrors, including how far behind they may be in the sync process.

You can also change your mirrors to new ones, which might be a good idea if it's a major security issue that you're updating to fix.

If you decide to change your mirrors, open 'Software & Updates' from your 'Preferences' and the very first tab has a drop down menu labeled 'Download From:' and pick alternative mirrors. If you're curious, it's generally considered best practice to pick the mirrors that are geologically closest to you.

Solution 3

In my case, I had to change the Ubuntu Software Update server from Brazil to the USA, then run:

$ apt-get clean
$ apt-get update

And that worked.

Solution 4

I had the same problem today! (Ubuntu 21.10)
I changed from "Brazil" to "Main Server"
Then typed:

sudo apt clean  
sudo apt update

And now things are working as intended

Solution 5

On the top right of the screen a red ! was displayed. When I clicked it a message said there is either a network problem or a problem with the sources and I should click Show updates to update the sources manually or check them. When I clicked Show updates the update manager said the software on my pc is actual. First I thought this is just a temporary problem but a few days later there was the same problem.

KGIII's answer helped me. Thanks! He posted, changing the mirrors could solve the problem. For me it works, with the difference that he posted "it's generally considered best practice to pick the mirrors that are geologically closest to you" and I chose Main server.

Then updates have been downloaded!

Today the same error happened again so I set Server for My Country again!
===========================================================

After that, update download works.

Share:
23,433
Maurício Pires
Author by

Maurício Pires

Updated on September 18, 2022

Comments

  • Maurício Pires
    Maurício Pires over 1 year

    When I type in the sudo apt-get update I get this output

    Hit:1 http://br.archive.ubuntu.com/ubuntu focal InRelease
    Hit:2 https://repo.steampowered.com/steam stable InRelease                     
    Get:3 http://br.archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]     
    Hit:4 http://dl.google.com/linux/chrome/deb stable InRelease                   
    Get:5 http://br.archive.ubuntu.com/ubuntu focal-backports InRelease [98,3 kB]
    Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease               
    Hit:7 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease
    Get:8 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [318 kB]
    Get:9 http://br.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [190 kB]
    Get:10 http://br.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [119 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Ign:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata
    Ign:34 http://br.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata
    Ign:35 http://br.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata
    Get:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [196 kB]
    Err:11 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata
      File has unexpected size (195784 != 195720). Mirror sync in progress? [IP: 200.236.31.4 80]
      Hashes of expected file:
       - Filesize:195720 [weak]
       - SHA256:620989b440f546d66d39a063c6e8c049e6f716f0da9f510ebf1da727be3f5844
       - SHA1:96786274267a2bfce9c0b3c6bbc7b8e4076d08d8 [weak]
       - MD5Sum:6b22100a971f517dd23973ba9a242c8c [weak]
      Release file created at: Fri, 07 Aug 2020 18:58:05 +0000
    Get:34 http://br.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [177 kB]
    Err:34 http://br.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata
      
    Get:35 http://br.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [2.468 B]
    Err:35 http://br.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata
      
    Get:36 http://br.archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
    Get:37 http://br.archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
    Get:38 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [3.096 B]
    Get:39 http://br.archive.ubuntu.com/ubuntu focal-backports/universe i386 Packages [2.268 B]
    Get:40 http://br.archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [1.448 B]
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Ign:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata
    Get:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.972 B]
    Err:41 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata
      File has unexpected size (1976 != 1972). Mirror sync in progress? [IP: 200.236.31.4 80]
      Hashes of expected file:
       - Filesize:1972 [weak]
       - SHA256:3d9adb8ec018eafe9e452377669976073b7e893d89a0664392c1435c2d256b7e
       - SHA1:347c09e2129d07363b358e6459655fa191ce9de8 [weak]
       - MD5Sum:a16154af0d5dc497f1d7d365cbd29897 [weak]
      Release file created at: Fri, 07 Aug 2020 18:58:28 +0000
    Fetched 212 kB in 2s (124 kB/s)
    Reading package lists... Done
    E: Failed to fetch http://br.archive.ubuntu.com/ubuntu/dists/focal-updates/main/dep11/Components-amd64.yml.xz  File has unexpected size (195784 != 195720). Mirror sync in progress? [IP: 200.236.31.4 80]
       Hashes of expected file:
        - Filesize:195720 [weak]
        - SHA256:620989b440f546d66d39a063c6e8c049e6f716f0da9f510ebf1da727be3f5844
        - SHA1:96786274267a2bfce9c0b3c6bbc7b8e4076d08d8 [weak]
        - MD5Sum:6b22100a971f517dd23973ba9a242c8c [weak]
       Release file created at: Fri, 07 Aug 2020 18:58:05 +0000
    E: Failed to fetch http://br.archive.ubuntu.com/ubuntu/dists/focal-updates/universe/dep11/Components-amd64.yml.xz  
    E: Failed to fetch http://br.archive.ubuntu.com/ubuntu/dists/focal-updates/multiverse/dep11/Components-amd64.yml.xz  
    E: Failed to fetch http://br.archive.ubuntu.com/ubuntu/dists/focal-backports/universe/dep11/Components-amd64.yml.xz  File has unexpected size (1976 != 1972). Mirror sync in progress? [IP: 200.236.31.4 80]
       Hashes of expected file:
        - Filesize:1972 [weak]
        - SHA256:3d9adb8ec018eafe9e452377669976073b7e893d89a0664392c1435c2d256b7e
        - SHA1:347c09e2129d07363b358e6459655fa191ce9de8 [weak]
        - MD5Sum:a16154af0d5dc497f1d7d365cbd29897 [weak]
       Release file created at: Fri, 07 Aug 2020 18:58:28 +0000
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    I've tried doing sudo rm -rf /var/lib/apt/lists/* but the problem still persists.