sudo apt-get -f install 的问题

sudo apt-get -f install 的问题

我已经尝试过了sudo apt-get autoclean。但sudo apt-get clean我仍然收到此错误

我正在运行 Ubuntu 12

siddharth@IWORKHERE:~/Downloads$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree        
Reading state information... Done 
Correcting dependencies... Done 
The following extra packages will be installed:   
      openjdk-7-jdk 
Suggested packages:  
visualvm 
The following packages will be upgraded:   
      openjdk-7-jdk 1 upgraded, 0 newly installed, 0 to remove and 89 not upgraded. 
Need to get 0 B/16.5 MB of archives. 
After this operation, 88.1 kB of additional disk space will be used. 
Do you want to continue [Y/n]? Y 
(Reading database ... 394130 files and directories currently installed.) 
Preparing to replace openjdk-7-jdk 7u55-2.4.7-1ubuntu1~0.12.04.2 (using .../openjdk-7-jdk_7u65-2.5.1-4ubuntu1~0.12.04.2_i386.deb) ... 
Unpacking replacement openjdk-7-jdk ... dpkg: error processing 
/var/cache/apt/archives/openjdk-7-jdk_7u65-2.5.1-4ubuntu1~0.12.04.2_i386.deb (--unpack):  
trying to overwrite '/usr/lib/jvm/java-7-openjdk-i386/src.zip', which is also in package openjdk-7-source 7u55-2.4.7-1ubuntu1~0.12.04.2 
Errors were encountered while processing:  /var/cache/apt/archives/openjdk-7-jdk_7u65-2.5.1-4ubuntu1~0.12.04.2_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

sudo dpkg -r openjdk-7-jdk
sudo apt-get remove --purge openjdk-7-jdk
sudo apt-get autoremove
sudo apt-get clean
sudo apt-get update

最后,您就可以安装该软件包,就像它是一个新软件包一样,没有任何安装历史记录。

答案2

您将需要强制覆盖该文件。

请运行此命令sudo dpkg -i --force-overwrite /var/cache/apt/archives/openjdk-7-jdk_7u65-2.5.1-4ubuntu1~0.12.04.2_i386.deb

然后运行sudo apt-get -f install

參考文獻:[已解决] 错误‘dpkg: 错误处理(--unpack)尝试覆盖…

相关内容