无法使用 apt-get install 安装软件:哈希总和不匹配且无法获取错误

无法使用 apt-get install 安装软件:哈希总和不匹配且无法获取错误

我有一台 Ubuntu 16.10 64 位机器。

当我尝试执行时sudo apt-get install cmake,出现以下错误:

After this operation, 20.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 cmake amd64 3.5.2-2ubuntu1 [2,779 kB]
Err:1 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 cmake amd64 3.5.2-2ubuntu1
  Hash Sum mismatch
  Hashes of expected file:
   - SHA256:28f7a54d94e32027321460169ddf7c66d627e96a275612e371064192b4f1fe75
   - SHA1:be57190df55b20ddfc192570cd225436fa60caf0 [weak]
   - MD5Sum:454e05c9e6ae224d3416b04f2a876699 [weak]
   - Checksum-FileSize:2778872 [weak]
  Hashes of received file:
   - SHA256:d3981d14c6c2d2d0c42cc7dd00b42264e5e94f7bb2d5908ae3bbcc707e8a881b
   - SHA1:9c2716a4ff17005f7a9f4c9b6cf9c370a5a813ef [weak]
   - MD5Sum:9118651936fd4509d1dd98b662678ac6 [weak]
   - Checksum-FileSize:2778872 [weak]
  Last modification reported: Wed, 29 Jun 2016 15:10:18 +0000
Fetched 2,779 kB in 7min 48s (5,926 B/s)                                       
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/c/cmake/cmake_3.5.2-2ubuntu1_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA256:28f7a54d94e32027321460169ddf7c66d627e96a275612e371064192b4f1fe75
    - SHA1:be57190df55b20ddfc192570cd225436fa60caf0 [weak]
    - MD5Sum:454e05c9e6ae224d3416b04f2a876699 [weak]
    - Checksum-FileSize:2778872 [weak]
   Hashes of received file:
    - SHA256:d3981d14c6c2d2d0c42cc7dd00b42264e5e94f7bb2d5908ae3bbcc707e8a881b
    - SHA1:9c2716a4ff17005f7a9f4c9b6cf9c370a5a813ef [weak]
    - MD5Sum:9118651936fd4509d1dd98b662678ac6 [weak]
    - Checksum-FileSize:2778872 [weak]
   Last modification reported: Wed, 29 Jun 2016 15:10:18 +0000
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

当我运行时sudo apt-get update出现以下错误。

#lot of lines like the next two lines
Get:30 http://us.archive.ubuntu.com/ubuntu yakkety-updates/multiverse amd64 Packages [4,653 B]
Get:32 http://us.archive.ubuntu.com/ubuntu yakkety-updates/multiverse Translation-en [2,076 B]
Fetched 816 kB in 23min 40s (574 B/s)                                          
Reading package lists... Done
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/yakkety-updates/main/dep11/icons-64x64.tar  Could not open file /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_yakkety-updates_main_dep11_icons-64x64.tar.gz - open (13: Permission denied) [IP: 91.189.91.26 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/yakkety-updates/universe/dep11/Components-amd64.yml.gz  
E: Some index files failed to download. They have been ignored, or old ones used instead.

有人能告诉我如何解决这个问题吗?谢谢。

答案1

你可以试试:

sudo apt-get -o 'Acquire::http::No-Cache=true; Acquire::http::Pipeline-Depth=0;' install NAMEHERE

apt bug 解释如下:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810796

答案2

删除导致问题的存储库条目。

您遇到的问题是由于安装了比 Ubuntu 版本更早的存储库。这导致您看到未满足的依赖关系中断。

解决方法是删除有问题的存储库条目。您可以通过以下方式识别此问题:雅克蒂参考您的错误信息:

错误:1 http://us.archive.ubuntu.com/ubuntu雅克蒂/主 amd64 cmake amd64 3.5.2-2ubuntu1

删除该条目,然后使用以下命令更新存储库缓存:

$ sudo apt update
$ sudo apt upgrade

如果您需要安装为较新的操作系统版本制作的某些东西,您将必须手动编译它及其必要的依赖项。

或者,您可以寻找为您的 Ubuntu 安装制作的 PPA,您将其标记为 Ubuntu 16.04。

答案3

系统设置选择软件和更新。从印度服务器更新您的操作系统需要一些时间,系统更新完成后尝试安装您想要的软件。

相关内容