debian apt packages hash sum mismatch

2020-02-02 08:20发布

问题:

From the Debian command line, I'm getting a hash sum mismatch after executing aptitude update; aptitude upgrade. Below is the command line output. I've tried an aptitude clean, but this does not seem to help. I've also done a few google searches, but nothing seems to help. I've been getting the mismatch error for a few days.

Any help is appreciated.


Resolving dependencies...
open: 405; closed: 880; defer: 58; conflict: 78.
The following packages will be upgraded:
  apache2.2-bin apt-utils aptdaemon aptdaemon-data avahi-daemon bind9-host dnsutils ekiga gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gstreamer0.10-alsa gstreamer0.10-ffmpeg
  gstreamer0.10-plugins-base gstreamer0.10-x host libapt-inst1.5 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1 libavahi-gobject0
  libavahi-ui-gtk3-0 libavahi-ui0 libavutil51 libbind9-80 libcapi20-3 libcogl-common libcogl9 libdbus-glib-1-2 libdns88 libgconf2.0-cil libgssapi-krb5-2 libgssrpc4
  libgstreamer-plugins-base0.10-0 libisc84 libisccc80 libisccfg82 libk5crypto3 libkrb5-3 libkrb5support0 liblwres80 libmp3lame0 libmtp-common libmtp-runtime libmtp9
  libpostproc52 libruby1.8 libswscale2 libsystemd-login0 libtag1-vanilla libtag1c2a libxml2 libxml2-utils linux-headers-3.2.0-4-686-pae linux-headers-3.2.0-4-common
  linux-image-3.2.0-4-686-pae linux-libc-dev linux-source-3.2 python-aptdaemon python-aptdaemon-gtk python-aptdaemon.gtk3widgets python-aptdaemon.gtkwidgets
  python-libxml2 python-numpy ruby1.8 telepathy-gabble unattended-upgrades xserver-xorg-video-ati xserver-xorg-video-radeon
The following packages are RECOMMENDED but will NOT be installed:
  krb5-locales
70 packages upgraded, 0 newly installed, 0 to remove and 168 not upgraded.
Need to get 4322 kB/136 MB of archives. After unpacking 7982 kB will be used.
Do you want to continue? [Y/n/?]
Get: 1 http://www.deb-multimedia.org/ testing/main libavutil51 i386 8:1.0.5-dmo1 [111 kB]
Get: 2 http://www.deb-multimedia.org/ testing/main libmp3lame0 i386 1:3.99.5-dmo2 [338 kB]
Get: 3 http://www.deb-multimedia.org/ testing/main libpostproc52 i386 8:1.0.5-dmo1 [79.6 kB]
Get: 4 http://www.deb-multimedia.org/ testing/main libswscale2 i386 8:1.0.5-dmo1 [126 kB]
Get: 5 http://www.deb-multimedia.org/ testing/main libtag1-vanilla i386 1.8-dmo1 [257 kB]
Get: 6 http://www.deb-multimedia.org/ testing/main libtag1c2a i386 1.8-dmo1 [9396 B]
Get: 7 http://www.deb-multimedia.org/ testing/main gstreamer0.10-ffmpeg i386 1:0.10.13-dmo1 [3402 kB]
Fetched 4322 kB in 35s (121 kB/s)                                                                                                                                                
E: Failed to fetch http://www.deb-multimedia.org/pool/main/f/ffmpeg-dmo/libavutil51_1.0.5-dmo1_i386.deb: Hash Sum mismatch
E: Unable to correct for unavailable packages

回答1:

Try using apt-get:

apt-get clean
rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
apt-get upgrade


回答2:

If deleting /var/lib/apt/lists/* does not work...
(esp. if you're behind a proxy), fix "Hash Sum Mismatch" like this:

Create file /etc/apt/apt.conf.d/99fixbadproxy
with this content

Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy    true;

See also here



回答3:

In my case the following solution didn't work for me:

  • /var/lib/apt/lists/*
  • Changing servers to "principal server" (or some other foreing server)

I still was having the same repository giving me the "Hash sum mismatch" error.

I solved trying this solution:

  1. go to "Software & updates"
  2. Uncheck all repositories from the "Ubuntu Software" section
  3. Select the "Autentication" section
  4. Delete all entries
  5. Make a sudo apt update (with no repositories it sould end very soon)
  6. re-open "Software & Updates" -> "Ubuntu Software" and re-check al your needed repositories
  7. try again with sudo apt update

Good luck.



回答4:

Replace your /etc/apt/sources.list with:

deb http://http.debian.net/debian/ jessie main
deb http://http.debian.net/debian/ jessie-backports main
deb http://security.debian.org/ jessie/updates main

Then I'd also run:

sudo apt-key update -y
sudo apt-get update -y
sudo apt-get upgrade -y

That should do the trick.

@source: https://www.lowendtalk.com/discussion/62567/apt-get-hash-sum-mismatch-debian-jessie



回答5:

EDIT: My ubuntu installation has crashed. I am not sure about the exact reason, but this hack is the prime suspect.

I faced a similar issue

Get:1 http://in.archive.ubuntu.com/ubuntu artful/main amd64 openjdk-8-jre-headless amd64 8u144-b01-2 [27.3 MB]                                                                                                                                                                 
Err http://in.archive.ubuntu.com/ubuntu artful/main amd64 openjdk-8-jre-headless amd64 8u144-b01-2                                                                                                                                                                             
  Hash Sum mismatch
Hashes of expected file:
 - SHA256:46924d3fdb329b18b652bc3410f1f2c92ef1259b9a7d66bb1c5d3804b42a8c1c
 - SHA1:0097b24ef75249d381c7c3f3fb6b36593720c15e [weak]
 - MD5Sum:1ff35c4d8a2bed71dceba105801cf567 [weak]
 - Filesize:27256930 [weak]
Hashes of received file:
 - SHA256:ea6892eb6ce7cdc1674a46719302cdbf1b9d485e36bccd27247591527423bb6d
 - SHA1:8c19fbdc9f534d8d3c304374bf0c8e7b05cb620b [weak]
 - MD5Sum:1ff35c4d8a2bed71dceba105801cf567 [weak]
 - Filesize:27256930 [weak]
Last modification reported: Sat, 30 Sep 2017 20:08:32 +0000

Fortunately, the hash mismatch occurred only for one package. Since I was absolutely sure that the package that got downloaded was the intended one, I simply edited out the InRelease file.

The steps I followed: 1. grep for the expected has in /var/lib/apt/lists

sudo grep 46924d3fdb329b18b652bc3410f1f2c92ef1259b9a7d66bb1c5d3804b42a8c1c *
  1. In my case it was

    in.archive.ubuntu.com_ubuntu_dists_artful_main_binary-amd64_Packages

  2. Replaced the hash values of expected file with the hash values of received file.

  3. The upgrade went through.


回答6:

I had the similar issue while installing Tizen GBS package.

Only the below solution helped me:

  1. Manually download missed *.deb packages
  2. Copy packages to the /var/cache/apt/archives
  3. Run install command again

In this case apt tool checks the local availability of the package first. If it is present under /var/cache/apt/archives path, then a download step (with hash-sum mismatch error) is skipped.

Example:

wget http://download.tizen.org/tools/latest-release/Ubuntu_16.04/amd64/librpm-tizen_4.11.0.1.tizen20140530-tizen20140723_amd64.deb

sudo cp librpm-tizen_4.11.0.1.tizen20140530-tizen20140723_amd64.deb /var/cache/apt/archives


回答7:

Upgrade apt with sudo apt-get install apt



回答8:

sometime reverse proxy(apache,nginx,...) and network will make checksum issue, we can try http proxy of different region to solve the problem:

apt-get update -o Acquire::http::Proxy="$HTTP_PROXY"  -o Debug::Acquire::http=true