So I tried to build the .rpm file that Oracle gives. The installation was not 100% successful so i want to uninstall it and do it the easy way this openjdk, but now i cant install nothing cause linux tells me jdk is on the system when its not. Linux tries tries to remove it and fails blocking me from installing anything:

For example if i tried

sudo apt install openjdk-7-jdk

It gives me this:

0 upgraded, 38 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/62,5 MB of archives.
After this operation, 162 MB disk space will be freed.

Do you want to continue? [Y/n] y
Extracting templates from packages: 100%
(Reading database ... 183637 files and directories currently installed.)
Removing jdk1.8.0-101 (1.8.0101-fcs-1) ...
find: `/usr/java/*': No such file or directory
/var/lib/dpkg/info/jdk1.8.0-101.postrm: line 586: /usr/sbin/alternatives: No such file or directory
/var/lib/dpkg/info/jdk1.8.0-101.postrm: line 598: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jdk1.8.0-101 (--remove):
subprocess installed post-removal script returned error exit status 127
Errors were encountered while processing:
jdk1.8.0-101
E: Sub-process /usr/bin/dpkg returned an error code (1)
share|improve this question
1  
.rpm packages are for rpm based distributions (RedHat/CentOS, Fedora, etc), not for deb based distros like Debian and Ubuntu. Exactly how did you install the .rpm package? Do you mean the .tar.gz file? – Av4t4r Aug 25 '16 at 15:41
    
WIth the alien package i converted the .rpm to .deb. It didnt sound like a good idea but i wnated to try it. – Goamaral Aug 25 '16 at 15:45
    
Please note: this is a pure "ubuntu administration" problem. The java language tag doesn't make any sense here. – GhostCat Aug 25 '16 at 15:46
    
You right. Just removed it. – Goamaral Aug 25 '16 at 15:47
    
And then: maybe you try askubuntu.com instead. There are many subtle ways how you can fix "broken" packages. But honestly, this one might be rather hard. – GhostCat Aug 25 '16 at 15:49

Issue solved.

Analysed the file where it was getting an error and figured out what i did wrong.

I uninstalled java while the jdk was broken. As a result when i tried to uninstall jdk it would run the function present on lines 586 and 598, that referred to alternative versions of java that i had remove.

As i had already uninstalled java with no problems, those function where useless so i just edited the content of the functions,in case the rest of the script needed them to a simple:

echo "Hello World"

And as expected when i uninstalled jdk it gave me two times "Hello World". Now is fully uninstalled. Thx for all the help anyway.

share|improve this answer

Your Answer

 
discard

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.