Specific files are causing this error, like

Err:7 http://in.archive.ubuntu.com/ubuntu bionic/main i386 Packages 

Err:4 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages

I have tried all the solutions posted in similar questions, but it still seems to happen.

I've tried fixes from the following questions but still no luck: sudo apt-get update failes due to Hash Sum mismatch

"hash sum mismatch" error when doing update

"apt-get update" always failed to fetch

Also I am behind a proxy, so I have added these lines to etc/apt/apt.conf

Acquire::http::proxy "http://<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<proxy>:<port>/";
Acquire::https::proxy "https://<proxy>:<port>/";`
  • Strangely, the update happens when I run sudo apt-get update for the second time. – Harish Oct 15 '18 at 6:45
  • Ah, I just replied to your other post where you had the same issue but switching from apt to apt-get did fix the problem. Did you find any solution? – Trey Nov 30 '18 at 22:22
  • and I found a possible solution; added below. – Trey Nov 30 '18 at 22:44

I have no good explanation for why this might work, but it just did for me, when I got these errors trying to do sudo apt install emacs25 or sudo apt-get install emacs25. So in case it works for others:

This install of emacs25/bionic,now 25.2+1-6 amd64 required several dependent packages, namely:

  1. emacs25-bin-common/bionic,now 25.2+1-6 amd64
  2. emacs25-common/bionic,bionic,now 25.2+1-6 all
  3. emacs25-el/bionic,bionic,now 25.2+1-6 all
  4. emacsen-common/bionic,bionic,now 2.0.8 all

I wanted to see if I could narrow down what the particular problem file was, since they were all throwing hash sum errors, so I tried to install emacs25-common. Same issue (though it had dependencies on all the other three numbered above).

Then I tried sudo apt install emacs25-el. This worked, and curiously, the first dependency it installed was emacs25-common — the one I'd just tried to install unsuccessfully. It installed emacs25-common and the other three packages (all except for emacs25 itself) successfully.

Then I did sudo apt install emacs25. This, too, worked.

So this is voodoo, but I would suggest trying to install the dependencies separately first, trying different dependencies, until one does install, and then trying again.

My guess would be that something server-side was being cached, and breaking the normal order of requests resulted in a cache miss allowing the original file to be re-checksummed, but that's a total stab in the dark.

(After the above was done I was able to install the suggested package using sudo apt install emacs25-common-non-dfsg without issues.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.