Ubuntu 无法清除软件包

Ubuntu 无法清除软件包

我尝试安装oracle-java7-安装程序将软件包从自定义存储库下载到 Ubuntu 12 上。在执行某些安装后脚本期间失败。所以。我只想回滚它并继续使用另一个解决方案(安装 java 7 jdk)。我尝试过

更新为设置-x

 >  sudo aptitude remove oracle-java7-installer
The following packages will be REMOVED:
  oracle-java7-installer
0 packages upgraded, 0 newly installed, 1 to remove and 47 not upgraded.
Need to get 0 B of archives. After unpacking 82.9 kB will be freed.
(Reading database ... 61748 files and directories currently installed.)
Removing oracle-java7-installer ...
+ uname -m
+ arch=amd64
+ dld=x64
+ J_INSTALL_DIR=/usr/lib/jvm/java-7-oracle
+ [ remove = remove ]
+ [ -d /usr/lib/jvm/java-7-oracle/man/man1 ]
+ basename /usr/lib/jvm/java-7-oracle/bin/*
+ name=*
+ [ ! -f /usr/bin/* -o -L /usr/bin/* ]
+ update-alternatives --remove bin boot dev etc home initrd.img lib lib64 lost+found media mnt opt proc raid root run sbin selinux srv sys tmp usr var vmlinuz /usr/lib/jvm/java-7-oracle/bin/*
update-alternatives: error: unknown argument `dev'
dpkg: error processing oracle-java7-installer (--remove):
 subprocess installed pre-removal script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Downloading...
--2012-10-24 17:53:33--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 80.239.148.219, 80.239.148.216
Connecting to download.oracle.com (download.oracle.com)|80.239.148.219|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz [following]
--2012-10-24 17:53:33--  https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 2.22.42.174
Connecting to edelivery.oracle.com (edelivery.oracle.com)|2.22.42.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2012-10-24 17:53:33--  http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com (download.oracle.com)|80.239.148.219|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: `./jdk-7u3-linux-x64.tar.gz'

     0K .....                                                 100%  466M=0s

2012-10-24 17:53:33 (466 MB/s) - `./jdk-7u3-linux-x64.tar.gz' saved [5307/5307]

Download done.
sha256sum mismatch jdk-7u3-linux-x64.tar.gz
Oracle JDK 7 is NOT installed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
> sudo aptitude search oracle-java7-installer
   Cd  oracle-java7-installer                                                 - Sun Java(TM) Development Kit (JDK) 7

我能用它做什么?是否可以在不尝试卸载损坏的软件包的情况下回滚到以前的状态?

所以。我从输出中了解到包内的脚本是错误的。他们无法从 Oracle 站点下载 tar.gz,因此无法安装。它也不能正确处理消除当我想删除软件包时,command 并尝试再次安装它。基本问题 - 是否可以在不运行脚本的情况下回滚该包?像Windows中的“系统还原”一样?或者我应该手动执行此操作?

聚苯乙烯

lsb_release -a
没有可用的 LSB 模块。
发行商 ID:Ubuntu
描述:Ubuntu 12.04.1 LTS
版本:12.04
代号:precise

聚苯硫醚

sh -x /var/lib/dpkg/info/oracle-java7-installer.prerm
+ set -e
+ uname -m
+ arch=amd64
+ dld=x64
+ J_INSTALL_DIR=/usr/lib/jvm/java-7-oracle
+ [ = 删除 ]
+ [ = 取消配置 ]
+ 退出 0

答案1

该包裹似乎有问题且质量很差。解决维护者脚本中的错误代码的方法是简单地将它们替换为返回 true 的 noop 脚本。

/var/lib/dpkg/info/oracle-java7-installer.prerm和替换/var/lib/dpkg/info/oracle-java7-installer.postrm为以下内容:

#!/bin/sh
exit 0

一旦有问题的维护者脚本被替换,您应该能够删除这些包。

相关内容