尝试安装任何包时未满足的依赖关系

尝试安装任何包时未满足的依赖关系

当我尝试安装某些东西时,例如鱼,我得到了这个

    fun2code@fun2code-ThinkPad-X220:~$ sudo apt-get install fish
    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:
     fish : Depends: fish-common (= 2.2.0-3) but it is not going to be installed
            Recommends: xsel but it is not going to be installed
     libreoffice-core : Depends: libreoffice-common (> 1:5.1.6~rc2) but it is not going to be installed
     libreoffice-java-common : Depends: libreoffice-common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
     libreoffice-style-elementary : Depends: libreoffice-

common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
 libreoffice-style-galaxy : Depends: libreoffice-common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

所以我尝试运行sudo apt-get install -f但出现此错误

fun2code@fun2code-ThinkPad-X220:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies...Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
 Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following packages were automatically installed and are no longer required:
  fonts-roboto fonts-roboto-hinted libavfilter-ffmpeg5 libavresample-ffmpeg2
  libbs2b0 libcec-platform1v5 libcec3 libflite1 libfstrcmp0 libjs-iscroll
  libllvm4.0 libllvm4.0:i386 libopencv-core2.4v5 libopencv-imgproc2.4v5
  libqt4-designer libqt4-help libqt4-opengl libqt4-scripttools libqt4-test
  libqtassistantclient4 libqtwebkit4 libsdl2-2.0-0 libsndio6.1 libsodium18
  libtbb2 libzmq5 python3-pyqt4 python3-sip
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libreoffice-common
Suggested packages:
  libreoffice-style-breeze libreoffice-style-hicontrast
  libreoffice-style-human libreoffice-style-oxygen libreoffice-style-sifr
  libreoffice-style-tango
The following NEW packages will be installed:
  libreoffice-common
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
21 not fully installed or removed.
Need to get 0 B/22,2 MB of archives.
After this operation, 84,9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 181275 files and directories currently installed.)
Preparing to unpack .../libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb ...
Unpacking libreoffice-common (1:5.1.6~rc2-0ubuntu1~xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb (--unpack):
 trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.4-9788
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for gnome-icon-theme (3.12.0-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

问题在错误信息中说得很清楚。只需逐行阅读,就很清楚了:

Unpacking libreoffice-common (1:5.1.6~rc2-0ubuntu1~xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb (--unpack):
 trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.4-9788
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
  • 看起来您一直在混合使用 Debian 和 Ubuntu 软件包。不要这样做。坚持使用其中一个……否则您会遇到这样的问题。
  • 看起来你一直在rm删除由包管理器放置的文件和目录。不要这样做。始终使用包管理器删除由包管理器放置的文件。

一个解决方案就是简单地消除损害:

  • 用于sudo mkdir重新创建包管理器想要删除的目录。
  • 卸载来自 Debian 源的所有软件包,尤其是openoffice-debian-menus

答案2

我遇到了同样的问题,当我更换镜像服务器时问题就解决了。

步骤 1:转到软件和更新

第 2 步:更改下载位置并单击最佳镜像位置并选择其他位置。

然后尝试再次安装该软件.....希望它能起作用

相关内容