Когда я пытаюсь удалить Java с помощью sudo apt-get remove jdk1.8.0-40, я получаю следующее:
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)
Вывод 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
Вывод sudo dpkg --purge --force-all jdk1.8.0-40: [ ! d2]
(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
При попытке редактирования я получаю следующее:
(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)
/usr/sbin/alternatives: No such file or directory
В Debian, Ubuntu и т. д. Debian нет /usr/sbin/alternatives. Вместо этого есть /usr/bin/update-alternatives. Я предлагаю временную символическую ссылку для работы с плохо преобразованным пакетом RPM: mkdir -p /usr/sbin
ln -sT -- /usr/bin/update-alternatives /usr/sbin/alternatives
(source)