Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install Docker - Hash sum mismatch (Ubuntu 18.04, Vagrant, Virtualbox)

I just can't install Docker in a fresh image of Ubuntu 18.04 (in Virtualbox, using Vagrant). I am using the instruction from the official site:

https://docs.docker.com/install/linux/docker-ce/ubuntu/

Or the short command from https://github.com/docker/docker-install:

curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh

And always got the same errors - Hash sum mismatch:

Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_19.03.8~3-0~ubuntu-bionic_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA512:600f2d9b51024e5866a6256f2d08b4e733a6c8428e334d81de483a7138cbe9db00e8d67673a88d46c80ef0aa673e2f0183f8fd58226575a3a6a843f955c49e2a
    - SHA256:22fe06851dde23200c835641e234760bbb60b79abc3b2a1fbbd1a9b0f1a2e9d0
    - SHA1:7292df34a82e58cab0e45af61036ec19c81eb199 [weak]
    - MD5Sum:8d62aefa851deb2f0739b4a1fd232322 [weak]
    - Filesize:22879338 [weak]
   Hashes of received file:
    - SHA512:265e3e4f877e4d060098d88527258335a08c9b421fabd5573bb5c951fd337c2d157c418132ff6a54568e85c6bd0da3e1b66c51196410016b4b409d1cef2df4cd
    - SHA256:3d15d2e2a7bacc0840aea09400970328d853eb369585e97ce33c8bebbc5c4d37
    - SHA1:da5b39535801e35493cd2f7c6f2b176263bd7da4 [weak]
    - MD5Sum:a4e2e8ec89b2d98c218b3931d7845f50 [weak]
    - Filesize:22879338 [weak]
   Last modification reported: Wed, 11 Mar 2020 19:46:26 +0000
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
like image 631
James Bond Avatar asked Apr 04 '20 11:04

James Bond


3 Answers

I'm also seeing this problem with a large number of packages in multiple Linux distributions. All in VirtualBox 6.1.6 on Windows 10. Errors include Hash Sum mismatch, LZMA compression corruption, GZIP corruption, and Squashfs decompression failures. Basically anything that involves a checksum.

It seems unlikely that I have downloaded 4 distributions (and dozens of packages) and they're all faulty. Disabling Hyper-V does seem to improve things.

like image 188
Silver Avatar answered Oct 17 '22 15:10

Silver


OK guys, as I can understand, this is the fault of the Virtualbox. Because I don't see this problem in Vagrant when I using the hyperv provider at the same box.

The version of the Virtualbox is 6.1.4 r136177 (Qt5.6.2).

I have check how virtual OS download the packages (just by download it by direct link using wget) and I saw that hashsum of the downloaded package is really different from the original (but the size is absolutely equal). I have download the same package in the host OS, and the hashsum has match to original.

Output error and the hashsum of the downloaded package inside the virtual OS (different from original):

The hashsum of the downloaded package inside the virtual OS

The hashsum of the downloaded package at the host OS (equal to original):

The hashsum of the downloaded package at the host OS

like image 3
James Bond Avatar answered Oct 17 '22 16:10

James Bond


I was also having these issues constantly!

My setup was Virtual Box 6.1.6 with Vagrant 2.2.7 running on a Win10 host.

Using the above idea that the issue might be inherent to Virtual Box rather than Ubuntu, I uninstalled Virtual Box 6.1.6 then installed an older version of Virtual Box (6.0.10) and re-installed Vagrant 2.2.7. I also uninstalled Hyper-V from Windows.

With these system and software changes made, the automatic Docker provisioning of Vagrant worked as expected without any hash mismatch messages. This worked for me and I hope it helps someone else also.

like image 3
Kurt Le Breton Avatar answered Oct 17 '22 16:10

Kurt Le Breton