无法删除JDK – / usr / sbin / alternatives:没有这样的文件或目录
当我尝试使用sudo apt-get remove jdk1.8.0-40
删除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
:
(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)
尝试在该文件夹中创建文件并执行uninstall命令:
sudo mkdir -p /usr/java sudo touch /usr/java/aa sudo touch /usr/sbin/alternatives sudo apt-get remove jdk1.8.0-40
编辑:
试试这个:echo“”| sudo tee /var/lib/dpkg/info/jdk1.8.0-40.postrm
/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
( 来源 )
- `Gtk-WARNING **:C库不支持区域设置。 `从命令行启动应用程序时
- 如何在删除某些配置文件后重新安装Apache HTTPD?
- 在Ubuntu 12.04中安装更新或从软件中心时,出现错误消息
- 节点包管理器以某种方式损坏,现在无法安装
- 生成手动安装的包列表并查询各个包
- Ubuntu 14.04,Clang 3.8:由于缺少libllvm3.8v4而无法更新
- 无法在软件中心取消安装(Matlab)
- dpkg –get-selections显示标记为“deinstall”的包
- update-alternatives:错误:/ var / lib / dpkg / alternatives / vim corrupt:无效状态