安装或升级任何软件包时无法解决未满足的依赖关系

安装或升级任何软件包时无法解决未满足的依赖关系

当我从终端运行时 sudo apt upgrade

但是在遇到此问题之前我已经运行过这些命令:

sudo apt update -y
sudo apt-get install php7.0-xml php7.0-bcmath php7.0-mbstring -y
sudo wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix- 
release/zabbix-release_3.2-1+xenial_all.deb
sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb
sudo apt-get install zabbix-server-mysql zabbix-frontend-php
sudo apt update -y

我有以下未满足的依赖关系:

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:
libsnmp30 : Depends: libsnmp-base but it is not installed
E: Unmet dependencies. Try using -f.

我从终端运行以下命令来修复此问题,但没有成功:

 sudo apt-get -f install
 sudo apt-cache search libsnmp*
 sudo apt-get install snmpd libsnmp30 libsnmp-base
 sudo rm -f  /var/cache/apt/archives/libsnmp-base_5.7.3+dfsg-1ubuntu4.1_all.deb
 sudo dpkg --configure -a

输出 sudo apt-get -f install

 Unpacking libsnmp-base (5.7.3+dfsg-1ubuntu4.1) ...
 dpkg: error processing archive /var/cache/apt/archives/libsnmp-base_5.7.3+dfsg-1ubuntu4.1_all.deb (--unpack):
 trying to overwrite '/usr/share/man/man5/snmpd.internal.5.gz', which is 
 also in package net-snmp 5.4.2.1-9.12
 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
 Processing triggers for man-db (2.7.5-1) ...
 Errors were encountered while processing:
 /var/cache/apt/archives/libsnmp-base_5.7.3+dfsg-1ubuntu4.1_all.deb
 E: Sub-process /usr/bin/dpkg returned an error code (1)

有人能给我一些提示/提示来解决这个问题吗?我在 Ubuntu Server 16.04 LTS 上运行,我在 Google 上搜索了一段时间,但还没有找到解决方案。输出sudo apt-cache policy net-snmp

net-snmp:
  Installed: 5.4.2.1-9.12
  Candidate: 5.4.2.1-9.12
  Version table:
 *** 5.4.2.1-9.12 100
        100 /var/lib/dpkg/status

答案1

我无法在干净的 Ubuntu 16.04 LTS 上重现您的问题。

您应该使用以下命令手动安装有问题的软件包

sudo dpkg -i --force-all \
/var/cache/apt/archives/libsnmp-base_5.7.3+dfsg-1ubuntu4.1_all.deb

然后net-snmp使用以下命令删除本地安装的包:

sudo apt-get purge net-snmp

然后继续安装

sudo apt-get install snmpd libsnmp30 libsnmp-base
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get upgrade

相关内容