![无法在 Ubuntu 16.04 上找到软件包 default-jdk](https://linux22.com/image/1150173/%E6%97%A0%E6%B3%95%E5%9C%A8%20Ubuntu%2016.04%20%E4%B8%8A%E6%89%BE%E5%88%B0%E8%BD%AF%E4%BB%B6%E5%8C%85%20default-jdk%20.png)
实际上,我试图在 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
做不是忘记第一个命令中的星号 *!