Goamaral
Goamaral

Reputation: 309

JDK is not present on the system but the system says it needs to be removed

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)

Upvotes: 1

Views: 299

Answers (1)

Goamaral
Goamaral

Reputation: 309

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.

Upvotes: 1

Related Questions