无法安装 apt 软件包...但依赖项存在

无法安装 apt 软件包...但依赖项存在

如果这是一个非常基本的问题,我很抱歉,但我是在裸 Linux 机器上工作的新手。所以我想在树莓派上安装git。当我运行时,sudo apt-get install git-all我收到错误消息,告诉我缺少已安装的依赖项...。

具体来说,我得到:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 glib-networking : Depends: gsettings-desktop-schemas but it is not going to be installed
 libgoa-1.0-0b : Depends: libgoa-1.0-common (>= 3.30.1-2) but it is not going to be installed
 libgtk-3-common : Depends: dconf-gsettings-backend but it is not going to be installed or
                            gsettings-backend
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

“好吧,”我心想,“我只需安装依赖项即可。”

sudo apt-get install gsettings-desktop-schemas

gsettings-desktop-schemas is already the newest version (3.28.1-1).
gsettings-desktop-schemas set to manually installed.

???好吧,如果 glib-networking 依赖的东西已经安装了,那么我应该能够sudo apt-get install glib-networking

glib-networking is already the newest version (2.58.0-2+deb10u2).
glib-networking set to manually installed.

那么,APT,让我弄清楚这一点。您无法安装 git,因为它依赖于 glib-networking,而 glib-networking 又依赖于 gsettings-desktop-schemas,并且您出于某种未说明的原因拒绝安装 gsettings-desktop-schemas。但事实上,我已经有这两个软件包都已安装...嗯???

所有依赖项也是如此。我终于举起了双手:

sudo apt-get install glib-networking gsettings-desktop-schemas libgoa-1.0-0b libgoa-1.0-common libgtk-3-common dconf-gsettings-backend gsettings-backend

Package gsettings-backend is a virtual package provided by:
  gconf-gsettings-backend 3.2.6-5
  dconf-gsettings-backend 0.30.1-2
You should explicitly select one to install.

E: Package 'gsettings-backend' has no installation candidate

sudo apt-get install glib-networking gsettings-desktop-schemas libgoa-1.0-0b libgoa-1.0-common libgtk-3-common dconf-gsettings-backend

Reading package lists... Done
Building dependency tree       
Reading state information... Done
dconf-gsettings-backend is already the newest version (0.30.1-2).
dconf-gsettings-backend set to manually installed.
glib-networking is already the newest version (2.58.0-2+deb10u2).
gsettings-desktop-schemas is already the newest version (3.28.1-1).
libgoa-1.0-0b is already the newest version (3.30.1-2).
libgoa-1.0-0b set to manually installed.
libgoa-1.0-common is already the newest version (3.30.1-2).
libgoa-1.0-common set to manually installed.
libgtk-3-common is already the newest version (3.24.5-1+rpt2).
libgtk-3-common set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

我发现这个先前的SO这表明这种行为可能是由于树莓派操作系统版本之间不匹配引起的。但这似乎并不适用于此:我正在使用巴斯特,并apt-cache policy产生:

pi@raspberrypi:~ $ apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://archive.raspberrypi.org/debian buster/main armhf Packages
     release o=Raspberry Pi Foundation,a=testing,n=buster,l=Raspberry Pi Foundation,c=main,b=armhf
     origin archive.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
     release o=Raspbian,a=stable,n=buster,l=Raspbian,c=rpi,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
     release o=Raspbian,a=stable,n=buster,l=Raspbian,c=non-free,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
     release o=Raspbian,a=stable,n=buster,l=Raspbian,c=contrib,b=armhf
     origin raspbian.raspberrypi.org
 500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
     release o=Raspbian,a=stable,n=buster,l=Raspbian,c=main,b=armhf
     origin raspbian.raspberrypi.org
Pinned packages:

我还尝试了在互联网上找到的所有随机咒语来修复 apt,包括sudo apt-get -f dist-upgradesudo apt updatesudo apt upgradesudo apt-get autoremovesudo apt-get -f install--- 这些似乎都没有什么区别。

答案1

尝试运行sudo apt install git而不是sudo apt install git-all.

答案2

来自的消息apt并不一定意味着软件包尚未安装。这意味着,由于您请求的安装,无法安装这些软件包。如果某些其他依赖项git-all由于冲突而想要删除已安装的软件包,则可能会发生这种情况。尝试将 apt 抱怨的软件包以及您想要保留的软件包添加到安装git-all.最好加上-s先添加模拟安装。作为这个帖子显示,安装时解决依赖关系git-all可能过于复杂而无法apt自动处理,因为它可能会选择错误的替代依赖关系。

答案3

尝试跑步sudo apt -f install。这将修复所有缺失的依赖项。然后再跑sudo apt-get install git-all

相关内容