无法使用 apt --fix-broken install 修复未满足的依赖关系

无法使用 apt --fix-broken install 修复未满足的依赖关系

我最近在 ubuntu 18.04 上安装了 mongodb。之后,当我尝试使用 apt 安装任何软件包时,都会出现此错误。

$sudo apt-get install shutter
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:
mongodb-org : Depends: mongodb-org-tools but it is not going to be installed
shutter : Depends: libgtk2-perl but it is not going to be installed
       Depends: libgnome2-perl but it is not going to be installed
       Depends: libgnome2-vfs-perl but it is not going to be installed
       Depends: libgnome2-wnck-perl but it is not going to be installed
       Depends: libgnome2-gconf-perl but it is not going to be installed
       Depends: libwww-mechanize-perl but it is not going to be installed
       Depends: libimage-magick-perl but it is not going to be installed
       Depends: libproc-simple-perl but it is not going to be installed
       Depends: libfile-which-perl but it is not going to be installed
       Depends: libsort-naturally-perl but it is not going to be installed
       Depends: libgtk2-imageview-perl but it is not going to be installed
       Depends: libgnome2-canvas-perl but it is not going to be installed
       Depends: libgtk2-unique-perl but it is not going to be installed
       Depends: libproc-processtable-perl but it is not going to be installed
       Depends: libpath-class-perl but it is not going to be installed
       Depends: libjson-perl but it is not going to be installed
       Depends: libjson-xs-perl but it is not going to be installed
       Depends: libnet-dropbox-api-perl but it is not going to be installed
       Depends: libx11-protocol-other-perl but it is not going to be installed
       Recommends: libgoo-canvas-perl but it is not installable
       Recommends: libgtk2-appindicator-perl but it is not installable
       Recommends: libnet-oauth-perl but it is not going to be installed
 E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我尝试使用apt --fix-broken install。它尝试安装,mongodb-org-tools但在解压后,dpkg 返回此信息:

Preparing to unpack .../mongodb-org-tools_4.2.0_amd64.deb ...
Unpacking mongodb-org-tools (4.2.0) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_4.2.0_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/mongodb-org-tools_4.2.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我怎样才能解决这个问题?

编辑:@N0rbert 建议的命令对我来说不起作用。以下是他列出的命令的输出

$ sudo add-apt-repository universe
'universe' distribution component is already enabled for all sources.
$ sudo apt-get remove mongo-tools
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:
 mongodb-org : Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

这里有两个问题 -

  1. 你错过了宇宙pocket。使用以下命令启用它:

    sudo add-apt-repository universe
    

    按照说明修复您的存储库在这个答案中如果不确定。

  2. 你有两个 MongoDB 包源,删除较旧的一个

    sudo apt-get remove mongo-tools
    

最后安装 Shutter

sudo apt-get install shutter

相关内容