5

Whenever I try to install something, I get the same error:

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/repo.mongodb.org_apt_ubuntu_dists_bionic_mongodb-org_4.0_multiverse_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.

I've tried to do the following:

sudo rm -r /var/lib/apt/lists/*    
sudo apt-get clean && sudo apt-get update

which was the solution proposed in many places, but it didn't work.
Does anybody know how to fix this?

zx485
  • 2,426
  • Have the same problem, seems that started yesterday, additionally the PGP key validation results in error : W: GPG error: https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release: The following signatures were invalid: BADSIG 68818C72E52529D4 MongoDB 4.0 Release Signing Key packaging@mongodb.com – sborpo Mar 19 '20 at 03:24

4 Answers4

7

Remove mongo lists in:

/etc/apt/sources.list.d

then:

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update
hloop
  • 71
3

I seemed to have to do the following, which is a combination of several posts I've seen that didn't work for me.

1: Remove all mongo lists in /etc/apt/sources.list.d

cd /etc/apt/sources.list.d && sudo rm -rf mongo*

2: Remove everything in /var/lib/apt/lists/

sudo rm -rvf /var/lib/apt/lists/*

3: Clean

sudo apt clean

4: Update

sudo apt update
1

Same problem Ubuntu 18.04.4 LTS

Solution: Use the following commands in this order

cd /etc/apt/sources.list.d

Move or remove mongodb-org-4.0.list, here I moved it with mv, use rm insteand to delete.

sudo mv mongodb-org-4.0.list /home/ 

(Remember to change the directory, provide where you want to put it so that you can still reuse it if things go wrong)

remove all lists

sudo rm -vf /var/lib/apt/lists/*

regenerate them

sudo apt-get update

Now you can use again Software Updater.

Onyr
  • 153
0

Remove the problematic repositories, then try removing the MergeList, and then regenerate it:

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update
Farzin
  • 101
  • 3