实际上,我试图在 Ubuntu 16.04 上安装 Java(用于 Hadoop)。但每当我尝试运行 sudo apt-get update 时,我总是收到以下错误:
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_main_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_restricted_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_restricted_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_restricted_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_restricted_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_universe_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_universe_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_universe_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_universe_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_multiverse_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_multiverse_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_multiverse_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_multiverse_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_restricted_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_restricted_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_restricted_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_restricted_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_universe_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_universe_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_universe_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_universe_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_multiverse_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_multiverse_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_multiverse_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_multiverse_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_main_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_main_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_main_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_main_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_restricted_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_restricted_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_restricted_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_restricted_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_universe_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_universe_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_universe_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_universe_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_multiverse_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_multiverse_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_multiverse_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial-backports_multiverse_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_main_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_main_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_main_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_main_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_universe_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_universe_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_universe_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_universe_i18n_Translation-en (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_multiverse_binary-amd64_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_multiverse_binary-i386_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_multiverse_binary-all_Packages (1)
E: Unable to parse package file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_xenial-security_multiverse_i18n_Translation-en (1)
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted
此后,每当我运行以下命令时:
sudo apt-get install default-jdk
我总是收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package default-jdk
答案1
E: Unable to parse package file
在显示这样的错误之前必须有一些行:
E: Unable to parse package file /var/lib/apt/lists/…
你需要
sudo rm -i /var/lib/apt/lists/*
sudo apt update
做不是忘记第一个命令中的星号 *!