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've tried installing Sun JDK from sudo add-apt-repository ppa:eugenesan/java, it failed with the following:

--2012-05-05 15:50:09--
Resolving (
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [following]
--2012-05-05 15:50:09--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [following]
--2012-05-05 15:50:09--
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: `./jdk-7u3-linux-x64.tar.gz'

     0K .....                                                 100% 20.5M=0s

2012-05-05 15:50:09 (20.5 MB/s) - `./jdk-7u3-linux-x64.tar.gz' saved [5307/5307]

Download done.
sha256sum mismatch jdk-7u3-linux-x64.tar.gz
Oracle JDK 7 is NOT installed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:

So apparently it's trying to fetch a bad URL. I've installed Java manually, but now the package is stuck as a half-installed and every time I apt-get install anything, the error appears again.

apt-get install -f shows "1 not fully installed or removed." package and fails with the same error. I've tried dpkg -P oracle-java7-installer, but it fails as well.

How to remove this half-installed package?

share|improve this question
See answer here:… – Sriram Murali Oct 1 '13 at 18:24
up vote 10 down vote accepted

Awww yeahh.. I've been able to finally remove after finding this post the following way: sudo find /var/lib/dpkg -exec grep -l "oracle-java7-installer" {} \; showed a bunch of files, I've added exit 0 to first line by typing sudo gedit /var/lib/dpkg/info/oracle-java7-installer.prerm, saved file and closed gedit. Finally, after I was back on command line, typed sudo dpkg -P oracle-java7-installer and it worked.

share|improve this answer
By the way, if you want to fix the half-installed package rather than manually installing Java, the answer here should facilitate that. – Eliah Kagan May 23 '12 at 14:33
Worked fine! In my case I had to edit /var/lib/dpkg/info/oracle-java8-installer.postinst and add an exit 0 there. – user334639 Aug 13 '15 at 2:07

sudo rm /var/lib/dpkg/info/oracle-java7-installer*

sudo apt-get purge oracle-java7-installer*

sudo rm /etc/apt/sources.list.d/java

sudo apt-get update

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer

share|improve this answer

Use 'Synaptic Package Manager' to remove OR fix broken packages

To download and install 'Synaptic Package Manager' type the following command in the terminal >>

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install synaptic
share|improve this answer
Does not work. Marked the package for removal, clicked "apply" - the package is still there. I'm guessing it gets the same error – Fluffy May 5 '12 at 13:10

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.