我无法安装任何适用于 Ubuntu 12.04 的软件包。即使清除了以下文件后也是如此:
/var/lib/dpkg/lists/partial/* /var/lib/dpkg/lists/*
/var/cache/apt/*
更改了存储库并尝试了apt-get clean
Ubuntu 论坛提供的所有其他解决方案。但都不起作用,我之前遇到过同样的问题,并重新安装了 Ubuntu。但这不是永久的解决方案。
:~$ sudo apt-get update
95% [1 Sources bzip2 0 B] [Waiting for headers] [Waiting for headers]bzip2: (stdin) is not a bzip2 file.
98% [2 Packages bzip2 0 B] [Connecting to archive.ubuntu.com (91.189.92.201)]bzip2: (stdin) is not a bzip2 file.
100% [6 Translation-en bzip2 0 B] [Waiting for headers] 154 B/s 0sbzip2: (stdin) is not a bzip2 file.
Fetched 5,722 B in 14s (403 B/s)
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en Encountered a section with no Package: header
E: Some index files failed to download. They have been ignored, or old ones used instead.
希望 Ubuntu 开发人员一定知道解决这个问题的快速方法。这是所有 Ubuntu 用户都面临的一个非常普遍的问题,无法解决。请创建一个全局常见问题解答来解决这个问题。
答案1
只需删除 /var/lib/apt/lists 目录的内容:
sudo rm -fR /var/lib/apt/lists/*
然后运行:
sudo apt-get update