"Hash Sum mismatch" when installing chef-server-core on Ubuntu 16.04 using apt repo

Good day,

I am starting over to work on Chef on Ubuntu 16.04, Xenial, and I got this problem when installing chef-server-core using apt repo.

$ sudo apt-get install apt-transport-https
$ wget -qO - https://packages.chef.io/chef.asc | sudo apt-key add -
$ echo "deb https://packages.chef.io/repos/apt/stable xenial main" | sudo tee /etc/apt/sources.list.d/chef-stable.list
$ sudo apt update
$ sudo apt install chef-server-core -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  chef-server-core
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 577 MB of archives.
After this operation, 1,738 MB of additional disk space will be used.
Get:1 https://packages.chef.io/repos/apt/stable xenial/main amd64 chef-server-core amd64 12.9.1-1 [577 MB]
Err:1 https://packages.chef.io/repos/apt/stable xenial/main amd64 chef-server-core amd64 12.9.1-1                                                                                                                  
  Hash Sum mismatch
Fetched 577 MB in 38s (15.0 MB/s)                                                                                                                                                                                  
E: Failed to fetch https://packages.chef.io/repos/apt/stable/ubuntu/16.04/chef-server-core_12.9.1-1_amd64.deb  Hash Sum mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Is Ubuntu 16.04 not supported yet to install with apt repo? or Am I doing wrong?
Please help.

Thank you,
Dongwon

Hi,
Ubuntu 16.04 is totally supported. However, APT in 16.04 doesn’t support SHA1 checksums by default, and the software that generates our apt repositories hasn’t yet been updated to generate SHA256. We’ll fix that as soon as we can, but in the meantime, you can do:

echo "Acquire::ForceHash \"sha1\";" | sudo tee -a /etc/apt/apt.conf.d/02-chefpackagesfix

and then rerun apt update.
Sorry about that,
-Thom

That helped a lot. Thank you!

@thommay: thanks for the workaround. Would be nice so see a pointer placed on the Ubuntu download page until this is fixed. It took me an hour to find this workaround given “Has Sum MIsmatch” is a very common error due to transparent caching proxies, etc corrupting files…

I’d also like to suggest that, instead of forcing all apt packages to validate using SHA1 (now deprecated as it isn’t considered strong enough for security reasons), one can alternatively us the -o option with apt-get. E.g.:

sudo apt-get upgrade chefdk -o Acquire::ForceHash="sha1"
1 Like