我刚刚升级到 18.04。不幸的是,在更新过程中我的笔记本电脑卡住了并重新启动了。重新启动后,一切似乎都正常了。在进行了大量更新之后,我又被这个问题困住了。Apt dist-upgrade 由于未满足依赖关系而抛出错误,现在当我尝试使用 apt --fix-broken install 修复它时,我得到了以下输出
sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libkf5calendarcore5 libkf5libkdepim5abi1 libkf5pimcommon5abi2
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libkf5akonadicalendar5abi2 libkf5alarmcalendar-data
libkf5alarmcalendar5abi1 libkf5mailtransport-data
libkf5mailtransport5abi2
The following packages will be REMOVED:
kio-smtp libkf5alarmcalendar5
The following NEW packages will be installed:
libkf5akonadicalendar5abi2 libkf5alarmcalendar5abi1
libkf5mailtransport5abi2
The following packages will be upgraded:
libkf5alarmcalendar-data libkf5mailtransport-data
2 upgraded, 3 newly installed, 2 to remove and 10 not upgraded.
41 not fully installed or removed.
Need to get 0 B/584 kB of archives.
After this operation, 743 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 278631 files and directories currently installed.)
Preparing to unpack .../libkf5mailtransport-data_17.12.3-0ubuntu4_all.deb ...
Unpacking libkf5mailtransport-data (17.12.3-0ubuntu4) over (17.04.3-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libkf5mailtransport-data_17.12.3-0ubuntu4_all.deb (--unpack):
trying to overwrite '/etc/xdg/kmailtransport.categories', which is also in package kio-smtp 17.04.3-0ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libkf5mailtransport-data_17.12.3-0ubuntu4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
为了完整性起见,这里还有 apt upgrade 的输出:
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:
kde-config-mailtransport : Depends: libkf5mailtransport-data (= 17.12.3-0ubuntu4) but 17.04.3-0ubuntu1 is installed
Depends: libkf5mailtransport5abi2 (>= 17.07.70+git20170701) but it is not installed
kdepim-runtime : Depends: libkf5akonadicalendar5abi2 (>= 4:17.07.70+git20170920.1507) but it is not installed
Depends: libkf5alarmcalendar5abi1 (>= 4:17.11.70+git20170926.0843) but it is not installed
Depends: libkf5mailtransport5abi2 (>= 17.07.70+git20170701) but it is not installed
libkf5alarmcalendar5 : Depends: libkf5akonadicore5 (>= 4:15.12.0) but it is not installable
libkf5mailtransportakonadi5 : Depends: libkf5mailtransport-data (= 17.12.3-0ubuntu4) but 17.04.3-0ubuntu1 is installed
Depends: libkf5mailtransport5abi2 (>= 17.07.70+git20170701) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
正如我所说,这个输出是我尝试 apt --fix-broken install 的主要原因
事实证明,我只需要删除 kio-smtp 包即可使其再次工作。由于未满足依赖关系,正常的 apt 操作无法工作,因此我使用以下方法执行了此操作:
sudo dpkg -r --force-depends kio-smtp
绕过依赖性检查。
答案1
您正在尝试安装一个新软件包libkf5mailtransport-data
,该软件包包含另一个软件包中已安装的文件kio-smtp
- 请参阅 --fix-broken 输出中的最后一行:
Unpacking libkf5mailtransport-data (17.12.3-0ubuntu4) over (17.04.3-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libkf5mailtransport-data_17.12.3-0ubuntu4_all.deb (--unpack):
trying to overwrite '/etc/xdg/kmailtransport.categories', which is also in package kio-smtp 17.04.3-0ubuntu1
不能同时安装两个包含相同文件的软件包。一个快速而粗暴的方法是重命名有问题的文件,并在安装后检查新旧文件是否存在差异。您可能必须这样做才能摆脱当前的锁定情况。但这肯定会在以后带来问题。
作为永久解决方案,您可能必须卸载 kio-smtp。