Não é possível remover o JDK - / usr / sbin / alternatives: Nenhum arquivo ou diretório

1

Quando tento remover o Java com sudo apt-get remove jdk1.8.0-40 Eu entendo isso:

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)

Saída 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

Saída 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

Ao tentar a edição, recebo isto:

(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)
    
por Adrian Christensen 15.03.2015 / 12:06

2 respostas

0

Tente criar um arquivo nessa pasta e execute o comando de desinstalação e, em seguida:

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

EDITAR:

Tente isto:     echo "" | sudo tee /var/lib/dpkg/info/jdk1.8.0-40.postrm

    
por Helio 15.03.2015 / 12:13
1
  
/usr/sbin/alternatives: No such file or directory
  
     

Não há /usr/sbin/alternatives no Debian, Ubuntu, etc. Debian   clones. Em vez disso, há /usr/bin/update-alternatives .

     

Eu sugiro um link simbólico temporário para contornar os mal convertidos   Pacote RPM:

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

( fonte )

    
por David Foerster 24.03.2016 / 00:41