Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
easily installed..thanks @Naveen – vineet sah Aug 13 '15 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.