Hash sum mismatch when apt-get update Ubuntu 20.04 VM with Multipass
Asked Answered
P

3

24

My issue is the following:

I start a new multipass VM which is Ubuntu 20.04 version (I do not specify it, just launch). First command in my new VM is:

sudo apt-get update

Where I already have some error:

Err:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:1291458 [weak]
   - SHA256:407e1e5f8188d9a38dec308c87203aadb16cb4ac173b729005525c4d824317c9
   - SHA1:47f50537ae094c725a60e90bf5e72d563a73abb2 [weak]
   - MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
  Hashes of received file:
   - SHA256:fc9c8ae3385f3b2cdb7c52c8e4ee5fa5074c843155b7ce4786b3ce3c97fe8c3f
   - SHA1:59b7721865c7a9c1b313ce11f11aefa4c7951fd4 [weak]
   - MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
   - Filesize:1291458 [weak]
  Last modification reported: Mon, 28 Sep 2020 16:55:59 +0000
  Release file created at: Tue, 29 Sep 2020 10:33:40 +0000
Get:7 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [69.3 kB]
Err:7 http://security.ubuntu.com/ubuntu focal-security/main Translation-en
Err:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:8627544 [weak]
   - SHA256:46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1
   - SHA1:7bce310e1f03066e04653926de275118ec09b4d9 [weak]
   - MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
  Hashes of received file:
   - SHA256:b2f7c8b1b81060721c7f414843b41eda6760b7814fddeefd5abbf9f2bd4a9fd0
   - SHA1:b07e3465964e50b87630eea2c05faff5253efa0d [weak]
   - MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
   - Filesize:8627544 [weak]
  Last modification reported: Thu, 23 Apr 2020 17:34:17 +0000
  Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
Get:17 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB]
Err:17 http://archive.ubuntu.com/ubuntu focal/universe Translation-en
Get:18 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Err:20 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en
Get:21 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [375 kB]
Err:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:374700 [weak]
   - SHA256:35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c
   - SHA1:380d462e7356a2ce3e1598f4588a5e5ff0afadff [weak]
   - MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
  Hashes of received file:
   - SHA256:6d8b94194f56ad754d1e2b04dbaa421c81a6b539bc045713b6ad0a0d40ffd340
   - SHA1:be4ec3facb19f7272637f36337a050e5826335a3 [weak]
   - MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
   - Filesize:374700 [weak]
  Last modification reported: Tue, 29 Sep 2020 07:15:53 +0000
  Release file created at: Tue, 29 Sep 2020 10:33:56 +0000
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [142 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [9876 B]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [43.6 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [10.8 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [175 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [92.7 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [5952 B]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [11.6 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [3892 B]
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [480 B]
Get:33 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
Get:34 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:35 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [3088 B]
Get:36 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [1448 B]
Get:37 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [224 B]
Get:38 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 15.9 MB in 11s (1399 kB/s)
Reading package lists... Done
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/universe/binary-amd64/by-hash/SHA256/46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:8627544 [weak]
    - SHA256:46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1
    - SHA1:7bce310e1f03066e04653926de275118ec09b4d9 [weak]
    - MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
   Hashes of received file:
    - SHA256:b2f7c8b1b81060721c7f414843b41eda6760b7814fddeefd5abbf9f2bd4a9fd0
    - SHA1:b07e3465964e50b87630eea2c05faff5253efa0d [weak]
    - MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
    - Filesize:8627544 [weak]
   Last modification reported: Thu, 23 Apr 2020 17:34:17 +0000
   Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/universe/i18n/by-hash/SHA256/a9c6ca6ce2913776bf753ae5132c7814139880784e98672525b4059c61f209dd
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/multiverse/i18n/by-hash/SHA256/224cafd684a26e8bce3dfca4daf33b853c9273d13e4ada6161ce9ef38f1a567c
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/binary-amd64/by-hash/SHA256/35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:374700 [weak]
    - SHA256:35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c
    - SHA1:380d462e7356a2ce3e1598f4588a5e5ff0afadff [weak]
    - MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
   Hashes of received file:
    - SHA256:6d8b94194f56ad754d1e2b04dbaa421c81a6b539bc045713b6ad0a0d40ffd340
    - SHA1:be4ec3facb19f7272637f36337a050e5826335a3 [weak]
    - MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
    - Filesize:374700 [weak]
   Last modification reported: Tue, 29 Sep 2020 07:15:53 +0000
   Release file created at: Tue, 29 Sep 2020 10:33:56 +0000
E: Failed to fetch store:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_focal-security_main_binary-amd64_Packages.xz  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:1291458 [weak]
    - SHA256:407e1e5f8188d9a38dec308c87203aadb16cb4ac173b729005525c4d824317c9
    - SHA1:47f50537ae094c725a60e90bf5e72d563a73abb2 [weak]
    - MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
   Hashes of received file:
    - SHA256:fc9c8ae3385f3b2cdb7c52c8e4ee5fa5074c843155b7ce4786b3ce3c97fe8c3f
    - SHA1:59b7721865c7a9c1b313ce11f11aefa4c7951fd4 [weak]
    - MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
    - Filesize:1291458 [weak]
   Last modification reported: Mon, 28 Sep 2020 16:55:59 +0000
   Release file created at: Tue, 29 Sep 2020 10:33:40 +0000
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/main/i18n/by-hash/SHA256/66c9979e0ab12165a3ab86f426e3e910d52933bce60ab14fa80a596e1733b0b3
E: Some index files failed to download. They have been ignored, or old ones used instead.

I have tried the some solution what I had found on the web but none of them worked.

Solution 1:

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update -o Acquire::CompressionTypes::Order::=gz
sudo apt-get update && sudo apt-get upgrade

Solution 2

sudo rm -rvf /var/lib/apt/lists/*
echo "APT::Cache-Limit "100000000";" >> /etc/apt/apt.conf.d/70debconf

Solution 3

sudo rm -rvf /var/lib/apt/lists/* 
&& sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad 
&& sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status 
&& sudo apt-get update

Solution 4

sudo apt-get autoclean && sudo apt-get autoremove -y && sudo apt-get update

Solution 5

sudo rm -rf /var/lib/apt/lists
sudo apt-get clean
sudo apt-get update

I also tried to add Ubuntu keyserver:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

Here is my source.list

deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu focal universe
deb http://archive.ubuntu.com/ubuntu focal-updates universe
deb http://archive.ubuntu.com/ubuntu focal multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse

I would appreciate any suggestion! Thanks

ps: on my WSL2 everything works fine.

Polinski answered 29/9, 2020 at 12:51 Comment(0)
H
40

In my case with the same problem the following solution worked:

sudo su -
mkdir /etc/gcrypt
echo all >> /etc/gcrypt/hwf.deny
apt-get update

My environment
Windows 10.0.19041.508
Vagrant 2.2.10
VirtualBox 6.1.14r140239
ubuntu/focal64 Vagrant Box

I've found the answer and the explanation here:
askubuntu.com/questions/1235914/hash-sum-mismatch-error-due-to-identical-sha1-and-md5-but-different-sha256

I tried to install Docker (get-docker.sh) in the VM and got very similar error: "Failed to fetch https://download.docker.com ... Hash Sum mismatch". So I think this type of issues are not related to the VM, but to the Windows 10 host machine. I changed Hyper-V launch type to off and rebooted the system:

bcdedit /set hypervisorlaunchtype off

I'm not really understand why but both of the problems are gone.

Halflight answered 1/10, 2020 at 14:55 Comment(3)
This worked for me (VirtualBox on Windows 10 host, Xubuntu vdi). It fixed both apt and the software store that kept freezing when renewing the cache no matter which mirror I chose.Cowans
Perfect answer, Tried all the ones OP did and this is the only one that worked.Infiltration
Worked :) in Ubuntu 20.04.Eladiaelaeoptene
V
13

This worked for me: i went to system updater and changed update from local server to update from main server, then i ran sudo apt update and it worked. i hope it works for you too

Vitalis answered 29/9, 2020 at 12:51 Comment(2)
This worked for me, but on server you need to change /etc/apt/sources.list urls from http://{{region}}.archive.ubuntu.com/ubuntu to http://archive.ubuntu.com/ubuntuVentriculus
@Ventriculus thank you for that. Fixed my problem. Ubuntu 20.04, Thinkpad X1 Extreme Gen 2, janky install script messed up my sources.list I believe.Hak
S
1

This worked for me:

sudo apt-get clean

sudo rm -r /var/lib/apt/lists/*
Starve answered 25/3, 2022 at 5:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.