web-dev-qa-db-fra.com

Impossible de supprimer JDK - / usr / sbin / alternatives: aucun fichier ou répertoire de ce type

Lorsque j'essaie de supprimer Java avec Sudo apt-get remove jdk1.8.0-40, je reçois ceci:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  jdk1.8.0-40
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
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 ... 231488 files and directories currently installed.)
Removing jdk1.8.0-40 (1.8.040-1) ...
find: `/usr/Java/*': No such file or directory
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 586: /usr/sbin/alternatives: No such file or directory
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 598: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jdk1.8.0-40 (--remove):
 subprocess installed post-removal script returned error exit status 127
Errors were encountered while processing:
 jdk1.8.0-40
E: Sub-process /usr/bin/dpkg returned an error code (1)

Sortie de ls -1 /var/cache/apt/archives/*jdk*:

openjdk-7-jre_7u75-2.5.4-1~trusty1_AMD64.deb
openjdk-7-jre-headless_7u75-2.5.4-1~trusty1_AMD64.deb

Sortie de Sudo dpkg --purge --force-all jdk1.8.0-40:

(Reading database ... 231488 files and directories currently installed.)
removing jdk1.8.0-40 (1.8.040-1) ...
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 586: /usr/sbin/alternatives: No such file or directory
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 598: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jdk1.8.0-40 (--purge):
subprocess installed post-removal script returned error exit status 127
Errors were encountered while processing:
 jdk1.8.0-40

En essayant l'édition, j'obtiens ceci:

(Reading database ... 231488 files and directories currently installed.)
Removing jdk1.8.0-40 (1.8.040-1) ...
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 586: /usr/sbin/alternatives: Permission denied
/var/lib/dpkg/info/jdk1.8.0-40.postrm: line 598: /usr/sbin/alternatives: Permission denied
dpkg: error processing package jdk1.8.0-40 (--remove):
 subprocess installed post-removal script returned error exit status 126
Errors were encountered while processing:
 jdk1.8.0-40
E: Sub-process /usr/bin/dpkg returned an error code (1)
1
Adrian Christensen

Essayez de créer un fichier dans ce dossier et d’exécuter la commande de désinstallation puis:

Sudo mkdir -p /usr/Java
Sudo touch /usr/Java/aa
Sudo touch /usr/sbin/alternatives
Sudo apt-get remove jdk1.8.0-40

MODIFIER:


Essayez ceci: echo "" | Sudo tee /var/lib/dpkg/info/jdk1.8.0-40.postrm

0
Helio
/usr/sbin/alternatives: No such file or directory

Il n'y a pas de /usr/sbin/alternatives dans Debian, Ubuntu, etc. Les clones Debian. Au lieu de cela, il y a /usr/bin/update-alternatives.

Je suggère un lien symbolique temporaire pour contourner le package RPM mal converti:

mkdir -p /usr/sbin
ln -sT -- /usr/bin/update-alternatives /usr/sbin/alternatives

( source )

2
David Foerster