apt 无法删除不满足依赖关系的软件包

分享于 

9分钟阅读

ubuntu

  繁體

sudo apt-get purge libpciaccess*


laur@laur-System-Product-Name:~$ sudo apt-get purge


Reading package lists... Done


Building dependency tree 


Reading state information... Done


You might want to run 'apt --fix-broken install' to correct these.


The following packages have unmet dependencies:


libpciaccess0 : Breaks: libpciaccess0:i386 (!= 0.14-1) but 0.16- 


0ubuntu1 is installed


libpciaccess0:i386 : Breaks: libpciaccess0 (!= 0.16-0ubuntu1) but 


0.14-1 is installed


E: Unmet dependencies. Try 'apt --fix-broken install' with no packages 


(or specify a solution).



laur@laur-System-Product-Name:~$ sudo apt-get purge libpciaccess*


Reading package lists... Done


Building dependency tree 


Reading state information... Done


Note, selecting 'libpciaccess0' for glob 'libpciaccess*'


Note, selecting 'libpciaccess-dev' for glob 'libpciaccess*'


Package 'libpciaccess-dev' is not installed, so not removed


You might want to run 'apt --fix-broken install' to correct these.


The following packages have unmet dependencies:


intel-media-va-driver : Depends: libpciaccess0 but it is not going to 


be installed


libdrm-intel1 : Depends: libpciaccess0 but it is not going to be 


installed


spice-vdagent : Depends: libpciaccess0 but it is not going to be 


installed


ubuntu-drivers-common : Depends: libpciaccess0 (>= 0.10.7) but it is 


not going to be installed


xserver-xorg-core : Depends: libpciaccess0 (>= 0.12.902) but it is not 


going to be installed


xserver-xorg-video-ati : Depends: libpciaccess0 but it is not going to 


be installed


xserver-xorg-video-intel : Depends: libpciaccess0 (>= 


0.8.0+git20071002) but it is not going to be installed


E: Unmet dependencies. Try 'apt --fix-broken install' with no packages 


(or specify a solution).



编辑2:


laur@laur-System-Product-Name:~$ sudo apt-get -f install


Reading package lists... Done


Building dependency tree 


Reading state information... Done


Correcting dependencies... Done


The following additional packages will be installed:


libpciaccess0


The following packages will be upgraded:


libpciaccess0


1 upgraded, 0 newly installed, 0 to remove and 94 not upgraded.


13 not fully installed or removed.


Need to get 0 B/17,9 kB of archives.


After this operation, 33,8 kB disk space will be freed.


Do you want to continue? [Y/n] Y


(Reading database ... 232583 files and directories currently 


installed.)


Preparing to unpack .../libpciaccess0_0.16-0ubuntu1_amd64.deb ...


Unpacking libpciaccess0:amd64 (0.16-0ubuntu1) over (0.14-1) ...


dpkg: error processing archive 


/var/cache/apt/archives/libpciaccess0_0.16-0ubuntu1_amd64.deb (-- 


unpack):


trying to overwrite shared 


'/usr/share/doc/libpciaccess0/changelog.Debian.gz', which is different 


 from other instances of package libpciaccess0:amd64


 Errors were encountered while processing:


 /var/cache/apt/archives/libpciaccess0_0.16-0ubuntu1_amd64.deb



 **E: Sub-process /usr/bin/dpkg returned an error code (1)**



我收到上面的错误


laur@laur-System-Product-Name:~$ sudo apt-get upgrade


[sudo] password for laur: 


Reading package lists... Done


Building dependency tree 


Reading state information... Done


You might want to run 'apt --fix-broken install' to correct these.


The following packages have unmet dependencies:


libpciaccess-dev : Depends: libpciaccess0 (= 0.16-0ubuntu1) but 0.14-1 


is installed


libpciaccess0 : Breaks: libpciaccess0:i386 (!= 0.14-1) but 0.16- 


0ubuntu1 is installed


libpciaccess0:i386 : Breaks: libpciaccess0 (!= 0.16-0ubuntu1) but 


0.14-1 is installed


E: Unmet dependencies. Try 'apt --fix-broken install' with no packages 


(or specify a solution).



我试过sudo apt --fix-broken install 但没有成功。


laur@laur-System-Product-Name:~$ sudo apt update


[sudo] password for laur: 


Hit:1 http://ro.archive.ubuntu.com/ubuntu focal InRelease


Hit:2 https://repo.steampowered.com/steam stable InRelease 


Hit:3 http://ro.archive.ubuntu.com/ubuntu focal-updates InRelease 


Hit:4 https://deb.nodesource.com/node_14.x focal InRelease 


Hit:5 https://brave-browser-apt-release.s3.brave.com stable InRelease 


Hit:6 http://ro.archive.ubuntu.com/ubuntu focal-backports InRelease 


Get:7 http://security.ubuntu.com/ubuntu focal-security InRelease [107 


kB] 


Hit:8 https://packages.microsoft.com/repos/ms-teams stable InRelease 


Fetched 107 kB in 1s (112 kB/s) 


Reading package lists... Done


Building dependency tree 


Reading state information... Done


7 packages can be upgraded. Run 'apt list --upgradable' to see them.


laur@laur-System-Product-Name:~$ sudo apt list --upgradable


Listing... Done


aptdaemon-data/focal-updates,focal-updates,focal-security,focal- 


security 1.1.1+bzr982-0ubuntu32.2 all [upgradable from: 1.1.1+bzr982- 


0ubuntu32]


aptdaemon/focal-updates,focal-updates,focal-security,focal-security 


1.1.1+bzr982-0ubuntu32.2 all [upgradable from: 1.1.1+bzr982-0ubuntu32]


gdebi-core/focal,focal 0.9.5.7+nmu3 all [upgradable from: 


0.9.5.7+nmu3]


libpciaccess0/focal 0.16-0ubuntu1 amd64 [upgradable from: 0.14-1]


python3-aptdaemon.gtk3widgets/focal-updates,focal-updates,focal- 


security,focal-security 1.1.1+bzr982-0ubuntu32.2 all [upgradable from: 


1.1.1+bzr982-0ubuntu32]


python3-aptdaemon/focal-updates,focal-updates,focal-security,focal- 


security 1.1.1+bzr982-0ubuntu32.2 all [upgradable from: 1.1.1+bzr982- 


0ubuntu32]


secureboot-db/focal-updates 1.6~20.04.1 amd64 [upgradable from: 1.5]



laur@laur-System-Product-Name:~$ sudo apt upgrade


Reading package lists... Done


Building dependency tree 


Reading state information... Done


You might want to run 'apt --fix-broken install' to correct these.



The following packages have unmet dependencies:


libpciaccess-dev : Depends: libpciaccess0 (= 0.16-0ubuntu1) but 0.14-1 


is installed


libpciaccess0 : Breaks: libpciaccess0:i386 (!= 0.14-1) but 0.16- 


0ubuntu1 is installed


libpciaccess0:i386 : Breaks: libpciaccess0 (!= 0.16-0ubuntu1) but 


0.14-1 is installed


E: Unmet dependencies. Try 'apt --fix-broken install' with no packages 


(or specify a solution).




答案1:

先试试sudo dpkg --configure -a

如果这不能工作,请使用aptitude而不是apt-get


sudo aptitude install package_name_here



它会检查依赖解决方案,如果都失败,你需要手动编辑dpkg状态文件


sudo gedit /var/lib/dpkg/status



然后查找有问题的包名称,删除这些包,并保存文件,然后更新,并升级。


sudo apt-get update && upgrade




PAC  PACK  DEP  CAN  依赖  APT