如何安装自定义 Debian 软件包缺少的依赖项?

如何安装自定义 Debian 软件包缺少的依赖项?

自定义 Debian 软件包在 Debian 控制文件中具有以下依赖性:

Depends: docker-ce (=17.03.2~ce-0~debian-stretch)

必须从其下载,download.docker.com因为它不属于官方 Debian 存储库。 apt 源列表如下所示:

# cat /etc/apt/sources.list /etc/apt/sources.list.d/*
deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian stretch-updates main
deb https://download.docker.com/linux/debian stretch stable

安装自定义 Debian 软件包失败:

# dpkg --install --force-depends foo.deb
Selecting previously unselected package foo.
(Reading database ... 15743 files and directories currently installed.)
Preparing to unpack foo.deb ...
Unpacking foo (0.0.0-1) ...
dpkg: foo: dependency problems, but configuring anyway as you requested:
 foo depends on docker-ce (= 17.03.2~ce-0~debian-stretch); however:
  Package docker-ce is not installed.
Setting up foo (0.0.0-1) ...
# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  foo
0 upgraded, 0 newly installed, 1 to remove and 18 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]

我以为会从第三方存储库apt --fix-broken安装缺少的软件包,但它却想删除我的软件包。以下作品:docker-cefoo

# apt-get install docker-ce=17.03.2~ce-0~debian-stretch
# dpkg --install foo.deb

到目前为止我已经尝试过:

# apt-get -o Debug::pkgProblemResolver=true install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies...Starting pkgProblemResolver with broken count: 1
Starting 2 pkgProblemResolver with broken count: 1
Investigating (0) foo:amd64 < 0.0.0-1 @iU mK Nb Ib >
Broken foo:amd64 Depends on docker-ce:amd64 < none | 5:18.09.2~3-0~debian-stretch @un uH > (= 17.03.2~ce-0~debian-stretch)
  Considering docker-ce:amd64 0 as a solution to foo:amd64 2
  Removing foo:amd64 rather than change docker-ce:amd64

# apt install --assume-yes $PWD/foo.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'foo' instead of '/src/foo.deb'
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:
 foo : Depends: docker-ce (= 17.03.2~ce-0~debian-stretch) but 5:18.09.2~3-0~debian-stretch is to be installed
E: Unable to correct problems, you have held broken packages.

# apt-cache policy docker-ce
docker-ce:
  Installed: (none)
  Candidate: 5:18.09.2~3-0~debian-stretch
  Version table:
     5:18.09.2~3-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     5:18.09.1~3-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     5:18.09.0~3-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.06.3~ce~3-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.06.2~ce~3-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.06.1~ce~3-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.06.0~ce~3-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.03.1~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     18.03.0~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.12.1~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.12.0~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.09.1~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.09.0~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.06.2~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.06.1~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.06.0~ce-0~debian 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.03.3~ce-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.03.2~ce-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.03.1~ce-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
     17.03.0~ce-0~debian-stretch 500
        500 https://download.docker.com/linux/debian stretch/stable amd64 Packages

答案1

.deb要在从配置的存储库下载依赖项时安装包,请使用

# apt install ./foo.deb

即使文件位于当前目录中,也请提供路径。

如果仍未找到依赖项,请向我们显示 的输出apt-cache policy docker-ce

答案2

这在中得到了很好的解释这个链接

我知道 3 种不同的方法:

A)sudo apt install application.deb

它将在一次运行中自动安装具有依赖项的软件包:

b)

dpkg -i packagename.deb

如果 存在任何依赖关系packagename.deb,则应调用以下命令来解决依赖关系:

sudo apt install -f

C)sudo gdebi my_package_1.0.deb

如果gdebi尚未安装,您可以先安装。为了查明某个软件包(如gdebi我们的例子)是否已安装,检查软件包的状态,您可以发出以下命令:

dpkg -s packagename

相关内容