如何使用 apt 强制删除损坏的软件包?

如何使用 apt 强制删除损坏的软件包?

我收到以下错误消息:

$ sudo apt -f remove libgranite-common 
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:
 libgranite5 : Depends: libgranite-common (>= 5.3.0-1) but it is not going to be installed
 libgranite6 : Depends: libgranite-common (>= 6.0.0+r2017+pkg118~daily~ubuntu6.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libgranite-common
The following packages will be upgraded:
  libgranite-common
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
27 not fully installed or removed.
Need to get 0 B/53.0 kB of archives.
After this operation, 9,216 B disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 364127 files and directories currently installed.)
Preparing to unpack .../libgranite-common_6.0.0+r2017+pkg118~daily~ubuntu6.1_all.deb ...
Unpacking libgranite-common (6.0.0+r2017+pkg118~daily~ubuntu6.1) over (5.3.0-1) ...
dpkg: error processing archive /var/cache/apt/archives/libgranite-common_6.0.0+r2017+pkg118~daily~ubuntu6.1_all.deb (--unpack):
 trying to overwrite '/usr/share/metainfo/granite.appdata.xml', which is also in package libgranite5:amd64 5.3.0-1
Errors were encountered while processing:
 /var/cache/apt/archives/libgranite-common_6.0.0+r2017+pkg118~daily~ubuntu6.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

libgranite5 和 libgranite6 依赖于 libgranite-common 包,该包使用与另一个包相同的文件。首先,尝试apt -f remove libgranite{5,6}

然后,您将来可能只需要安装一个版本的库。

相关内容