如何消除有关安装失败的消息

如何消除有关安装失败的消息

我在 Ubuntu 11 的生命周期结束后安装了它。然后我尝试从存储库安装 Java。但是,安装失败了。从那时起,每次我安装其他软件包时,apt-get 都会尝试再次安装 Java,但会失败并输出以下日志。我手动安装了 Java 8,因此我不需要从存储库安装 Java。我只需要这个错误消息消失。

Processing triggers for ufw ...
Processing triggers for man-db ...
Setting up oracle-java7-installer (7u3-0~eugenesan~natty4) ...
Downloading...
--2015-03-01 21:42:44--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving download.oracle.com... 129.19.157.14, 129.19.157.15
Connecting to download.oracle.com|129.19.157.14|: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]
--2015-03-01 21:42:44--  https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving edelivery.oracle.com... 23.9.86.140
Connecting to edelivery.oracle.com|23.9.86.140|:443... connected.
ERROR: certificate common name `www.oracle.com' doesn't match requested host name `edelivery.oracle.com'.
To connect to edelivery.oracle.com insecurely, use `--no-check-certificate'.
download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up openssh-server (1:5.8p1-1ubuntu3) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
ssh start/running, process 2415
Setting up ssh-import-id (2.4-0ubuntu1) ...
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新:清除没有帮助......

$ sudo apt-get purge oracle-java7-installer 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  oracle-java7-installer*
0 upgraded, 0 newly installed, 1 to remove and 317 not upgraded.
1 not fully installed or removed.
After this operation, 139 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 145152 files and directories currently installed.)
Removing oracle-java7-installer ...
update-alternatives: error: unknown argument `cdrom'
dpkg: error processing oracle-java7-installer (--purge):
 subprocess installed pre-removal script returned error exit status 2
Downloading...
--2015-03-01 22:23:38--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving download.oracle.com... 129.19.157.14, 129.19.157.15
Connecting to download.oracle.com|129.19.157.14|: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]
--2015-03-01 22:23:38--  https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving edelivery.oracle.com... 23.9.86.140
Connecting to edelivery.oracle.com|23.9.86.140|:443... connected.
ERROR: certificate common name `www.oracle.com' doesn't match requested host name `edelivery.oracle.com'.
To connect to edelivery.oracle.com insecurely, use `--no-check-certificate'.
download failed
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)

答案1

试试这个。只需按下键盘上的Ctrl+ Alt+T即可打开终端。打开后,运行以下命令:

sudo dpkg -r oracle-java7-installer
sudo dpkg --purge oracle-java7-installer

如果上述方法不起作用,您可以尝试以下更激进的方法。但请注意,它使用 rm 命令,该命令将立即永久地从重要目录中完全删除文件。请极其小心。

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get clean
sudo apt-get update

相关内容