Skip to content

Instantly share code, notes, and snippets.

Last active June 14, 2021 01:04
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?

Fix Ubuntu package cache

Had problem with Ubuntu package cache.

➜  sources.list.d sudo apt-get update                   
Hit:1 xenial InRelease
Hit:2 xenial-updates InRelease                                                                   
Hit:3 xenial-backports InRelease                                                                 
Hit:4 xenial-security InRelease
Reading package lists... Error!                    
E: Malformed Description-md5 line; includes invalid character '21!0a2ee344f1a65d3401a41cc0d42a7'
E: Malformed Description-md5 line; includes invalid character '21!0a2ee344f1a65d3401a41cc0d42a7'
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted

First tried to disable any extra package sources, but it wasn't helping at all. Problem was caused by broken package cache, so had to find a way to remove temporary cache.

Solution was found from old forum thread:

sudo rm -r /var/lib/apt/lists/*
sudo mkdir /var/lib/apt/lists/partial
sudo apt-get update
Copy link

dsmello commented May 23, 2018

thanks man, you save my day.

Copy link

VentByte commented Jan 8, 2019

Thanks man, you save my day to

Copy link

atorjmen commented Jun 6, 2019

Thanks much champion!

Copy link

codeonion commented May 28, 2020

Oh Sir, you just saved my day! Thanks! This works in Ubuntu 20.04 LTS Focal Fossa. Today is May 29th, 2020.

But I got another Error afterwards:
Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/pk.archive.ubuntu.com_ubuntu_dists_focal_universe_binary-amd64_Packages

To solve this,
I did
sudo rm -r /var/lib/apt/lists/*
and finally
sudo apt-get clean && sudo apt-get update


Copy link

works well thanks

Copy link

Thanks a lot! That worked.

Copy link

fatadz commented Jun 14, 2021


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment