0

I try to install gcc4.9 on Ubuntu 14.04 and run:

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

with following error:

...
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

I type http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/Packages into the browser getting 'not found' reply.

try to install anymore:

sudo apt-get install gcc-4.9

with following:

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

Trouble downloading packages list due to a "Hash sum mismatch" error --this doesn't work to me.

Any suggestions will be great to me:-)

Johnson Lai
  • 101
  • 2
  • 1
    Troubleshooting a hash sum mismatch in the `Packages` file is a little different I think: see [How can I troubleshoot `apt-get update` giving Hash Sum mismatch](http://askubuntu.com/questions/673647/how-can-i-troubleshoot-apt-get-update-giving-hash-sum-mismatch) – steeldriver Oct 16 '16 at 14:07
  • See this [answer](http://askubuntu.com/questions/311842/how-do-i-fix-apt-errors-w-failed-to-fetch-hash-sum-mismatch), same thing . – Hayder Ctee Oct 16 '16 at 15:41
  • Hash sum mismatch usually happens when the PPA is getting updates (or the repositories). The only solution then is to wait a bit; it usually will resolve itself in a little while. – Thomas Ward Oct 19 '16 at 11:12
  • @ThomasWard maybe it's due to my poor connection to ppa source in China. – Johnson Lai Oct 20 '16 at 13:34
  • Does this answer your question? [How do I resolve unmet dependencies after adding a PPA?](https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa) – karel Feb 17 '22 at 03:02

1 Answers1

0

if you trim the url back to the folder like this

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

then it works in the browser and you can see that there is a gzip and bzip2 compressed copy of the Packages file. You could download this file and put it in /var/cache/apt/archives/list or /var/cache/apt/archives/ it might skip the failing step.

update: looking at the ppa's page i can see there is another link that will work better , try this

sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
Amias
  • 5,207
  • 20
  • 33
  • I download the `Pakages.gz` from the url, and put it in /var/cache/apt/archives/ , it doesn't work.I just wonder the original url is broken, how other guys upgrade their gcc? – Johnson Lai Oct 17 '16 at 08:28
  • un gzip Packages.gz so that Packages is in /var/cache/apt/archives or possibly the list folder in that folder – Amias Oct 17 '16 at 08:39
  • I un gzip Package.gz and move it to `var/cache/apt/archives`, or `var/cache/apt/archives/list`(I don't have list folder here so I create one).But I think the list folder is `/var/lib/apt/lists`, so I also put Packages there, don't work. – Johnson Lai Oct 17 '16 at 10:36
  • and I find there is `ppa.launchpad.net_ubuntu-toolchain-r_test_ubuntu_dists_trusty_main_binary-amd64_Packages` and `ppa.launchpad.net_ubuntu-toolchain-r_test_ubuntu_dists_trusty_main_binary-amd64_Packages.decomp.FAILED` in the folder `/var/lib/apt/lists/partial`. – Johnson Lai Oct 17 '16 at 10:38
  • there is probably a usefull message in that file – Amias Oct 17 '16 at 11:20
  • looking at the webpage for the PPA shows it is restricted to specific group members so thats probably why it doesn't work for you. Have you tried https://launchpad.net/~ubuntu-toolchain – Amias Oct 17 '16 at 11:23
  • this works - sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa – Amias Oct 19 '16 at 11:02
  • it return `Note, selecting 'gcc-4.9-base' for regex 'gcc-4.9' gcc-4.9-base is already the newest version.` I think the 'hash sum mismatch' problem is due to my poor connection to ppa source in china. One time I accidently didn't get the 'hash sum mismatch' problem of ppa, and install gcc4.9 successfully, but not this time. – Johnson Lai Oct 20 '16 at 13:33
  • could also be that the back end is load balanced but not all nodes are in sync – Amias Oct 21 '16 at 10:01