Ubuntu – I have problem executing apt-get

14.04apt

My Ubuntu Version is 14.04 Kylin. I deleted something wrongly when I tried to remove Java. And since that I got problem executing apt-get.

kael@ASUS:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  jdk1.8.0-45
0 to upgrade, 0 to newly install, 1 to remove and 65 not to upgrade.
1 not fully installed or removed.
After this operation, 245 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 258011 files and directories currently installed.)
Removing jdk1.8.0-45 (1.8.045-1) ...
/var/lib/dpkg/info/jdk1.8.0-45.postrm: line 586: /usr/sbin/alternatives: No such file or directory
/var/lib/dpkg/info/jdk1.8.0-45.postrm: line 598: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jdk1.8.0-45 (--remove):
 subprocess installed post-removal script returned error exit status 127
Errors were encountered while processing:
 jdk1.8.0-45
E: Sub-process /usr/bin/dpkg returned an error code (1)

Best Answer

If all other options fail, do what i did. other info, i got myself here by trying to install the rpm jdk8 pachage on linux mint 17(ubuntu)

sudo rm -ri /usr/java/

it will ask for password then ask to make sure you want to delete that directory. press "y" and enter/return

then open /var/lib/dpkg/info/ as root and delete any files with "jdk1.8.0-xx.xxxx" once done deleting run

sudo dpkg -r --force-all jdk1.8.0-45

if you are trying to install jdk 8. this page will be of help because it worked for me.(linux mint 17 cinnamon 64bit) http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/

Related Question