1

I am using Ubuntu 14.04 and my college provides us software repositories which we can access from inside the campus. I tried installing java and only after that I started getting the hash mismatch error:

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:
 openjdk-7-jdk : Depends: openjdk-7-jre (= 7u51-2.4.6-1ubuntu4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

After this, I tried this solution, but even after removing the files in the partial folder, even on removing the entire lists folder, if I update using apt-get, I still get the error or warning:

W: Failed to fetch gzip:/var/lib/apt/lists/partial/repo.iitd.ernet.in_ubuntu_dists_trusty_main_binary-i386_Packages  Hash Sum mismatch

I tried installing some other packages like vim, and it installed normally. So I don't think it's interfering with the installation of all packages. But, if I try installing the openjdk-7-jre or the icedtea-7-plugin, from my software sources I get the same error as shown above.

I also tried:

sudo apt-get clean

None of the above solutions helped.

How do I solve this hash mismatch problem without reinstalling the system because that's the last thing on my mind right now!

PS: I am not downloading softwares from any server outside of the college and have only enabled repositories provided by my college.

Vivek Pradhan
  • 861
  • 5
  • 13
  • 25

1 Answers1

3

The broken packages must be removed first.
Open up your Terminal and execute the commands below:

sudo dpkg -r openjdk-7-jre openjdk-7-jdk
sudo apt-get install -f

Then, for example you can install Oracle Java 8 with these commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Use the command java -version to check the version you installed.

Naveen
  • 9,365
  • 11
  • 43
  • 70