Today, I encountered with the following error when I try to update my Ubuntu 20.04 LTS desktop system.
$ sudo apt update
Sample output:
Get:1 http://ny-mirrors.evowise.com/ubuntu focal InRelease [265 kB] Hit:2 http://linux.teamviewer.com/deb stable InRelease Hit:3 http://ppa.launchpad.net/costales/yaru-colors-folder-color/ubuntu focal InRelease Hit:4 http://ny-mirrors.evowise.com/ubuntu focal-updates InRelease Hit:5 http://ny-mirrors.evowise.com/ubuntu focal-backports InRelease Hit:6 http://ny-mirrors.evowise.com/ubuntu focal-security InRelease Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease Fetched 265 kB in 3s (99.8 kB/s) Reading package lists... Error! E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_binary-i386_Packages E: The package lists or status file could not be parsed or opened.
I tried again with the graphical Synaptic package manager. But no luck! I got the same error!
This is one of the common problem in Ubuntu and Debian-based systems.
After reading the output a bit carefully, I understood that the the package lists or status file is corrupted for some reason, so it could not be parsed.
For those wondering, the status file contains the information about the installed deb packages. We can solve this issue by removing the damaged package list and status file and regenerate them as described below.
Fix "Encountered a section with no Package: header" Error In Ubuntu
Step 1. First, remove the damaged package list using command:
$ sudo rm /var/lib/apt/lists/* -vf
The above command will delete all the package source listing from your Ubuntu system.
Here is the sample output from my Ubuntu 20.04 LTS desktop:
rm: cannot remove '/var/lib/apt/lists/auxfiles': Is a directory removed '/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_InRelease' removed '/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages' removed '/var/lib/apt/lists/linux.teamviewer.com_deb_dists_stable_InRelease' removed '/var/lib/apt/lists/linux.teamviewer.com_deb_dists_stable_main_binary-amd64_Packages' removed '/var/lib/apt/lists/linux.teamviewer.com_deb_dists_stable_main_binary-i386_Packages' removed '/var/lib/apt/lists/lock' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_Contents-amd64.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_Contents-i386.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_InRelease' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_main_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_multiverse_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_restricted_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-backports_universe_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_Contents-amd64.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_Contents-i386.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_InRelease' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_main_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_multiverse_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_restricted_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_restricted_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_restricted_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_restricted_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_Contents-amd64.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_Contents-i386.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_InRelease' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_main_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_multiverse_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_multiverse_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_multiverse_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_restricted_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_restricted_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_restricted_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_restricted_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-security_universe_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal_universe_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_Contents-amd64.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_Contents-i386.lz4' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_InRelease' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_main_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_multiverse_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_restricted_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_restricted_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_restricted_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_restricted_i18n_Translation-en' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_binary-amd64_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_binary-i386_Packages' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_cnf_Commands-amd64' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_dep11_Components-amd64.yml.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_dep11_icons-48x48.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_dep11_icons-64x64.tar.gz' removed '/var/lib/apt/lists/ny-mirrors.evowise.com_ubuntu_dists_focal-updates_universe_i18n_Translation-en' rm: cannot remove '/var/lib/apt/lists/partial': Is a directory removed '/var/lib/apt/lists/ppa.launchpad.net_costales_yaru-colors-folder-color_ubuntu_dists_focal_InRelease' removed '/var/lib/apt/lists/ppa.launchpad.net_costales_yaru-colors-folder-color_ubuntu_dists_focal_main_binary-amd64_Packages' removed '/var/lib/apt/lists/ppa.launchpad.net_costales_yaru-colors-folder-color_ubuntu_dists_focal_main_binary-i386_Packages' removed '/var/lib/apt/lists/ppa.launchpad.net_costales_yaru-colors-folder-color_ubuntu_dists_focal_main_i18n_Translation-en'
Step 2. Now, run the following command to rebuild the package source listing:
$ sudo apt update
This will take a while depends upon your Internet speed. Be patient!
Step 3. Once the package listing is regenerated, do a full update by running the following commands one by one:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
Step 4. After updating the Ubuntu system, clear the package cache:
$ sudo apt autoclean
$ sudo apt autoremove
Step 5. Finally, close all opened programs and reboot your system:
$ sudo reboot
The problem should be gone by now.
Step 6: Just in case if you still see the same error, remove the status file and rebuild it using following commands:
$ sudo rm /var/lib/dpkg/status
$ sudo touch /var/lib/dpkg/status
$ sudo apt update
Don't forget to perform a full system update and clean the apt cache and then reboot your system.
Solutions to other common problems in Ubuntu:
- How To Fix Broken Ubuntu OS Without Reinstalling It
- How To Fix Busybox Initramfs Error On Ubuntu
- Fix “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu
- Fix “W: Some index files failed to download.” Error In Ubuntu
- Fix ‘E: The package cache file is corrupted, it has the wrong hash’ Error In Ubuntu
- How To Fix “E: Could not get lock /var/lib/dpkg/lock” Error On Ubuntu
- Fix “dpkg: error: parsing file ‘/var/lib/dpkg/updates/0014′” Error In Ubuntu
Hope this helps.
2 comments
Thank you
It solved my problem
It solved my problem too (was in the update on Discord).
Thank you very much!