首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何安装自定义Debian包缺少的依赖项?

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

Unix & Linux用户
提问于 2019-02-22 19:20:24
回答 2查看 5.5K关注 0票数 2

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

代码语言:javascript
复制
Depends: docker-ce (=17.03.2~ce-0~debian-stretch)

这必须从download.docker.com下载,因为它不是官方Debian存储库的一部分。apt源列表如下所示:

代码语言:javascript
复制
# 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包失败:

代码语言:javascript
复制
# 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-ce包,但是它想要删除我的foo包。以下工作:

代码语言:javascript
复制
# apt-get install docker-ce=17.03.2~ce-0~debian-stretch
# dpkg --install foo.deb

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

代码语言:javascript
复制
# 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
EN

回答 2

Unix & Linux用户

发布于 2019-02-23 17:28:04

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

代码语言:javascript
复制
# apt install ./foo.deb

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

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

票数 2
EN

Unix & Linux用户

发布于 2019-11-14 14:03:44

它在此链接中得到了很好的解释。

我知道三种不同的方法:

( a) sudo apt install application.deb

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

b)

代码语言:javascript
复制
dpkg -i packagename.deb

如果packagename.deb有任何依赖项,则应该调用下面的命令来解决依赖关系:

代码语言:javascript
复制
sudo apt install -f

( c) sudo gdebi my_package_1.0.deb

如果gdebi尚未安装,您可以先安装它。为了找出是否安装了包(如本例中的gdebi ),请检查包的状态,您可以发出以下命令:

代码语言:javascript
复制
dpkg -s packagename
票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/502388

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档