今天,我在尝试更新我的 Ubuntu 20.04 LTS 桌面系统时遇到了以下错误。
$ sudo apt update
示例输出:
Get:1 https://ny-mirrors.evowise.com/ubuntu focal InRelease [265 kB] Hit:2 https://linux.teamviewer.com/deb stable InRelease Hit:3 https://ppa.launchpad.net/costales/yaru-colors-folder-color/ubuntu focal InRelease Hit:4 https://ny-mirrors.evowise.com/ubuntu focal-updates InRelease Hit:5 https://ny-mirrors.evowise.com/ubuntu focal-backports InRelease Hit:6 https://ny-mirrors.evowise.com/ubuntu focal-security InRelease Hit:7 https://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.
我再次尝试使用 Graphical Synaptic 包管理器。 但没有运气! 我遇到了同样的错误!
这是基于 Ubuntu 和 Debian 的系统中的常见问题之一。
仔细阅读输出后,我了解到由于某种原因包列表或状态文件已损坏,因此无法解析。
对于那些想知道的人,状态文件包含有关已安装 deb 包的信息。 我们可以通过删除损坏的包列表和状态文件并按如下所述重新生成它们来解决此问题。
修复“遇到没有包的部分:标题”在 Ubuntu 中的错误
步骤1。 首先,使用命令删除损坏的包列表:
$ sudo rm /var/lib/apt/lists/* -vf
上面的命令将从您的 Ubuntu 系统中删除所有包源列表。
这是我的 Ubuntu 20.04 LTS 桌面的示例输出:
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'
第2步。 现在,运行以下命令来重建包源列表:
$ sudo apt update
这将需要一段时间,具体取决于您的 Internet 速度。 要有耐心!
第 3 步。 重新生成包列表后,通过一一运行以下命令来进行完整更新:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
步骤4。 更新Ubuntu系统后,清除包缓存:
$ sudo apt autoclean
$ sudo apt autoremove
第 5 步。 最后, close 所有打开的程序并重新启动系统:
$ sudo reboot
这个问题现在应该已经解决了。
第 6 步: 如果您仍然看到相同的错误,请删除状态文件并使用以下命令重建它:
$ sudo rm /var/lib/dpkg/status
$ sudo touch /var/lib/dpkg/status
$ sudo apt update
不要忘记执行完整的系统更新并清理 apt 缓存,然后重新启动系统。
Ubuntu其他常见问题的解决方法:
- 如何在不重新安装的情况下修复损坏的 Ubuntu 操作系统
- 如何修复 Ubuntu 上的 Busybox Initramfs 错误
- 修复 Ubuntu 中“子进程 /usr/bin/dpkg 返回错误代码 (1)”
- 修复“W:某些索引文件无法下载。” Ubuntu 中的错误
- 修复“E:包缓存文件已损坏,它具有错误的哈希”错误在 Ubuntu 中
- 如何修复Ubuntu上的“E:无法获得锁定/var/lib/dpkg/lock”错误
- 修复 Ubuntu 中的“dpkg: error: parsing file ‘/var/lib/dpkg/updates/0014′”错误
希望这可以帮助。
APTDebianLinuxLinux 命令Linux 故障排除Ubuntu