在 Ubuntu14.04LTS 上安装 gcc4.9 出现“哈希总和不匹配”错误

在 Ubuntu14.04LTS 上安装 gcc4.9 出现“哈希总和不匹配”错误

我尝试在 Ubuntu 14.04 上安装 gcc4.9 并运行:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

出现以下错误:

...
W: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/Packages  Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old  ones used instead

我输入http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/Packages进入浏览器得到“未找到”的答复。

尝试再安装:

sudo apt-get install gcc-4.9

以下内容:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gcc-4.9:i386 : Depends: cpp-4.9:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
                Depends: gcc-4.9-base:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
                Depends: binutils:i386 (>= 2.24) but it is not going to be installed
                Depends: libgcc-4.9-dev:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
                Depends: libc6:i386 (>= 2.11) but it is not going to be installed
                Depends: libcloog-isl4:i386 (>= 0.17) but it is not going to be installed
                Depends: libgmp10:i386 but it is not installable
                Depends: libisl15:i386 (>= 0.15) but it is not going to be installed
                Depends: libmpc3:i386 but it is not installable
                Depends: libmpfr4:i386 (>= 3.1.3) but it is not going to be installed
                Depends: zlib1g:i386 (>= 1:1.1.4) but it is not installable
                Recommends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not going to be installed

由于“哈希值不匹配”错误,无法下载软件包列表——这对我不起作用。

任何建议对我来说都很有用:-)

答案1

如果你将 URL 修剪回文件夹,像这样

http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/

然后它在浏览器中就可以工作了,你可以看到 Packages 文件有一个 gzip 和 bzip2 压缩副本。你可以下载这个文件并将其放在 /var/cache/apt/archives/list 或 /var/cache/apt/archives/ 中,这样可能会跳过失败的步骤。

更新:查看 ppa 的页面,我发现还有另一个链接效果更好,试试这个

sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa

相关内容