修复损坏的软件包-“dpkg:错误:操作 -f(--field)和 -r(--remove)相冲突”

修复损坏的软件包-“dpkg:错误:操作 -f(--field)和 -r(--remove)相冲突”

Ubuntu 12.04 LTS。如果需要更多信息,请告诉我,我会提供。

主要问题是:

tzach@tzach-pc:~$ sudo apt-get install docky
[sudo] password for tzach: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
docky is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 ca-certificates-java : Depends: openjdk-6-jre-headless (>= 6b16-1.6.1-2) but it is not going to be installed or
                                 java6-runtime-headless
 openjdk-7-jre-lib : Depends: openjdk-7-jre-headless (>= 7~b130~pre0) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
tzach@tzach-pc:~$

并且:

tzach@tzach-pc:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree 
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
**The following packages have unmet dependencies:
ca-certificates-java : Depends: openjdk-6-jre-headless (>= 6b16-1.6.1-2) but it is not installed or
java6-runtime-headless
openjdk-7-jre-lib : Depends: openjdk-7-jre-headless (>= 7~b130~pre0) but it is not installed
E: Unmet dependencies. Try using *******

因此我们尝试了消息#9中的指南:http://ubuntuforums.org/showthread.php?t=947124

我们运行所有前 4 个命令,最后一条命令“sudo apt-get autoremove”给了我们:

tzach@tzach-pc:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 **ca-certificates-java** : Depends: openjdk-6-jre-headless (>= 6b16-1.6.1-2) but it is not installed or
                                 java6-runtime-headless
 **openjdk-7-jre-lib** : Depends: openjdk-7-jre-headless (>= 7~b130~pre0) but it is not installed
E: Unmet dependencies. Try using -f.

因此我们运行最后一个命令两次:sudo dpkg --remove -force --force-remove-reinstreqca-证书-java 和 sudo dpkg --remove -force --force-remove-reinstreqopenjdk-7-jre-lib

但两者都给出了:

tzach@tzach-pc:~$ sudo dpkg --remove -force --force-remove-reinstreq ca-certificates-java
[sudo] password for tzach: 
dpkg: error: conflicting actions -f (--field) and -r (--remove)

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through `less' or `more' !

编辑 green7-“sudo apt-get -f install”的输出:

tzach@tzach-pc:~$ sudo apt-get -f install
[sudo] password for tzach: 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
icedtea-7-jre-cacao icedtea-7-jre-jamvm java-common openjdk-7-jre-headless
tzdata-java
Suggested packages:
default-jre equivs sun-java6-fonts ttf-dejavu-extra fonts-ipafont-gothic
fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts
ttf-bengali-fonts
The following packages will be REMOVED:
ttf-mscorefonts-installer
The following NEW packages will be installed:
icedtea-7-jre-cacao icedtea-7-jre-jamvm java-common openjdk-7-jre-headless
tzdata-java
0 upgraded, 5 newly installed, 1 to remove and 355 not upgraded.
5 not fully installed or removed.
Need to get 0 B/29.6 MB of archives.
After this operation, 88.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: warning: there's no installed package matching ttf-mscorefonts-installer:amd64
Setting up tzdata (2012e-0ubuntu0.12.04) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing tzdata (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
tzdata
E: Sub-process /usr/bin/dpkg returned an error code (1)

针对 green7 的 EDIT2:

tzach@tzach-pc:~$ sudo apt-get remove --purge tzdata
[sudo] password for tzach:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
ca-certificates-java : Depends: openjdk-6-jre-headless (>= 6b16-1.6.1-2) but it is not going to be installed or
java6-runtime-headless
libc6 : Depends: tzdata but it is not going to be installed
libc6:i386 : Depends: tzdata:i386
libical0 : Depends: tzdata but it is not going to be installed
openjdk-7-jre-lib : Depends: openjdk-7-jre-headless (>= 7~b130~pre0) but it is not going to be installed
python-dateutil : Depends: tzdata but it is not going to be installed
ubuntu-minimal : Depends: tzdata but it is not going to be installed
util-linux : Depends: tzdata (>= 2006c-2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). 

针对 green7 的 EDIT3:

tzach@tzach-pc:~$ sudo apt-get install openjdk-7-jre-headless
[sudo] password for tzach:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
openjdk-7-jre-headless : Depends: tzdata-java but it is not going to be installed
Depends: java-common (>= 0.28) but it is not going to be installed
Recommends: icedtea-7-jre-cacao (= 7~u3-2.1.1~pre1-1ubuntu3) but it is not going to be installed
Recommends: icedtea-7-jre-jamvm (= 7~u3-2.1.1~pre1-1ubuntu3) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

文中有些内容也应该加粗。但不是批评家(:感谢编辑!

感谢你的帮助。

答案1

尝试这个

sudo mv /var/lib/dpkg/info/tzdata.prerm ~/tzdata.prerm

sudo dpkg-reconfigure tzdata --force

sudo dpkg --purge --force-all tzdata

答案2

tzdata尝试删除可能导致问题的包:

sudo apt-get remove --purge tzdata

答案3

尝试

rm /var/lib/apt/lists/* -vf  
apt-get update 

答案4

我在软件包方面遇到了一些不同的问题,但通过以下方法解决了:

sudo dpkg --remove <conflicted-package-name>
sudo apt-get install -f

并且已经修复。

相关内容