2

A custom Debian package has this dependency in the Debian control file:

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

That must be downloaded from download.docker.com as it isn't part of the official Debian repositories. The apt sources list looks like this:

# 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

Installing that custom Debian package fails:

# 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]

I thought apt --fix-broken would install the missing docker-ce package from the third-party repository, but instead it wants to remove my foo package. The following works:

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

What I have tried so far:

# 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
  • 1
    There are several ways to solve that. One of them is creating your internal repo, and letting APT deal with the dependencies. Feb 22, 2019 at 19:29

2 Answers 2

2

To install a .deb package while downloading dependencies from the configured repositories, use

# apt install ./foo.deb

Do provide a path even if the file is in the current directory.

If the dependency still isn't found, show us the output of apt-cache policy docker-ce.

3
  • Using apt install instead of dpkg --install doesn't help. I've added the output of apt-cache policy.
    – G. Fiedler
    Feb 25, 2019 at 21:35
  • @G.Fiedler Looks like you must dig further. Try installing with dpkg (it will error out due to the missing dependency), then issue aptitude install -f. It will try harder to solve the problem than apt-get does and hopefully give a better report at least. Feb 26, 2019 at 11:03
  • aptitude install -f reports that either the package foo must be removed or the dependencies must remain unresolved.
    – G. Fiedler
    Mar 1, 2019 at 12:30
1

It is well explained in this link.

I know 3 different ways to do it:

a) sudo apt install application.deb

it will install the package it with dependencies in one run automatically:

b)

dpkg -i packagename.deb

and if there is any dependencies for the packagename.deb, the command below should be invoke to resolve the dependencies:

sudo apt install -f

c) sudo gdebi my_package_1.0.deb

if gdebi is not installed already, you may install it first. In order to find out if a package, like gdebi in our case, is installed or not, check the status of a package, you may issue the command below:

dpkg -s packagename

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.