docker-ce-packaging icon indicating copy to clipboard operation
docker-ce-packaging copied to clipboard

[master] deb: add "Pre-Depends: ${misc:Pre-Depends}" for compat with debhelper > 13

Open thaJeztah opened this issue 3 years ago • 10 comments

Commit f9ac2f67a22f865769a4e74070580276b229ae70 (https://github.com/docker/docker-ce-packaging/pull/686) updated the "debhelper compat level" to 13, which seems to have introduced a regression when executing the preRM and postInst scripts;

invoke-rc.d: syntax error: unknown option "--skip-systemd-native"
   dpkg: error processing package docker-ce (--install):
   installed docker-ce package post-installation script subprocess returned error exit status 1

Searching for the cause of this regression, I found this mention in the debhelper(7) man-page: https://man7.org/linux/man-pages/man7/debhelper.7.html

**Retroactively removed in debhelper/13.5:**
(...)
This change makes dh_installinit inject a
misc:Pre-Depends for init-system-helpers (>= 1.54~).
Please ensure that the package lists
${misc:Pre-Depends} in its Pre-Depends field before
upgrading to compat 12.

This patch adds the recommended Pre-depends

thaJeztah avatar May 19 '22 13:05 thaJeztah

Unfortunately, it looks like this doesn't solve the issue;

dpkg: warning: ignoring pre-dependency problem!
Setting up docker-ce (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
invoke-rc.d: syntax error: unknown option "--skip-systemd-native"
dpkg: error processing package docker-ce (--install):
installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
docker-ce
+ REPO_URL=https://download.docker.com/linux/ubuntu
+ echo '[DEBUG] Installing engine dependencies from https://download.docker.com/linux/ubuntu'
  [DEBUG] Installing engine dependencies from https://download.docker.com/linux/ubuntu
+ update-ca-certificates -f
  Clearing symlinks in /etc/ssl/certs...
  done.
  Updating certificates in /etc/ssl/certs...
  128 added, 0 removed; done.
  Running hooks in /etc/ca-certificates/update.d...
  done.
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg
+ apt-key add -
  OK
+ [[ bionic == \s\i\d ]]
  ++ dpkg --print-architecture
+ ARCH=amd64
+ echo 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic test'
+ apt-get update
  Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Get:5 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
  Get:6 https://download.docker.com/linux/ubuntu bionic/test amd64 Packages [48.9 kB]
  Fetched 113 kB in 1s (168 kB/s)
  Reading package lists... Done
  ++ find packaging/deb/debbuild/ubuntu-bionic/ -type f -name '*.deb'
+ packages='packaging/deb/debbuild/ubuntu-bionic/docker-buildx-plugin_0.8.2~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce-cli_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce-rootless-extras_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-compose-plugin_2.5.1~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb'
  ++ echo 'packaging/deb/debbuild/ubuntu-bionic/docker-buildx-plugin_0.8.2~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce-cli_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce-rootless-extras_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-compose-plugin_2.5.1~ubuntu-bionic_amd64.deb
  packaging/deb/debbuild/ubuntu-bionic/docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb'
  ++ awk '$0="./"$0'
  ++ xargs
+ packages='./packaging/deb/debbuild/ubuntu-bionic/docker-buildx-plugin_0.8.2~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce-cli_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce-rootless-extras_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-compose-plugin_2.5.1~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb'
+ set -x
+ dpkg --ignore-depends=containerd.io,iptables,libdevmapper,libdevmapper1.02.1 --force-depends -i ./packaging/deb/debbuild/ubuntu-bionic/docker-buildx-plugin_0.8.2~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce-cli_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce-rootless-extras_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-compose-plugin_2.5.1~ubuntu-bionic_amd64.deb ./packaging/deb/debbuild/ubuntu-bionic/docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb
  Selecting previously unselected package docker-buildx-plugin.
  (Reading database ... 6945 files and directories currently installed.)
  Preparing to unpack .../docker-buildx-plugin_0.8.2~ubuntu-bionic_amd64.deb ...
  Unpacking docker-buildx-plugin (0.8.2~ubuntu-bionic) ...
  Selecting previously unselected package docker-ce-cli.
  Preparing to unpack .../docker-ce-cli_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ...
  Unpacking docker-ce-cli (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
  Selecting previously unselected package docker-ce-rootless-extras.
  Preparing to unpack .../docker-ce-rootless-extras_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ...
  Unpacking docker-ce-rootless-extras (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
  Selecting previously unselected package docker-ce.
  dpkg: regarding .../docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb containing docker-ce, pre-dependency problem:
  docker-ce pre-depends on init-system-helpers (>= 1.54~)
  init-system-helpers is installed, but is version 1.51.

dpkg: warning: ignoring pre-dependency problem!
Preparing to unpack .../docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../docker-compose-plugin_2.5.1~ubuntu-bionic_amd64.deb ...
Unpacking docker-compose-plugin (2.5.1~ubuntu-bionic) ...
Selecting previously unselected package docker-scan-plugin.
Preparing to unpack .../docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb ...
Unpacking docker-scan-plugin (0.17.0~ubuntu-bionic) ...
Setting up docker-buildx-plugin (0.8.2~ubuntu-bionic) ...
Setting up docker-ce-cli (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
Setting up docker-compose-plugin (2.5.1~ubuntu-bionic) ...
Setting up docker-scan-plugin (0.17.0~ubuntu-bionic) ...
dpkg: docker-ce-rootless-extras: dependency problems, but configuring anyway as you requested:
docker-ce-rootless-extras depends on dbus-user-session; however:
Package dbus-user-session is not installed.

Setting up docker-ce-rootless-extras (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
dpkg: docker-ce: dependency problems, but configuring anyway as you requested:
docker-ce depends on init-system-helpers (>= 1.54~); however:
Version of init-system-helpers on system is 1.51.

Setting up docker-ce (5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic) ...
invoke-rc.d: syntax error: unknown option "--skip-systemd-native"
dpkg: error processing package docker-ce (--install):
installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
docker-ce

thaJeztah avatar May 19 '22 13:05 thaJeztah

I'll rebase this one, now that https://github.com/docker/docker-ce-packaging/pull/697 is merged, CI should go "red" :x: and show the problem

thaJeztah avatar May 19 '22 14:05 thaJeztah

So with this change, the package has indeed a new Pre-Dependency included;

dpkg-deb -I ./docker-ce_0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic_amd64.deb
 new Debian package, version 2.0.
 size 21108028 bytes: control archive=2164 bytes.
      39 bytes,     2 lines      conffiles
    1309 bytes,    24 lines      control
     305 bytes,     5 lines      md5sums
    1779 bytes,    63 lines   *  postinst             #!/bin/sh
     872 bytes,    20 lines   *  postrm               #!/bin/sh
     188 bytes,     5 lines   *  preinst              #!/bin/sh
     433 bytes,    10 lines   *  prerm                #!/bin/sh
 Package: docker-ce
 Version: 5:0.0.0-20220519102430-0e4dde2-0~ubuntu-bionic
 Architecture: amd64
 Maintainer: Docker <[email protected]>
 Installed-Size: 92444
 Pre-Depends: init-system-helpers (>= 1.54~)
 Depends: containerd.io (>= 1.6.4), docker-ce-cli, iptables, libseccomp2 (>= 2.3.0), libc6 (>= 2.8), libdevmapper1.02.1 (>= 2:1.02.97), libsystemd0
 Recommends: apparmor, ca-certificates, docker-ce-rootless-extras, git, libltdl7, pigz, procps, xz-utils
 Suggests: aufs-tools, cgroupfs-mount | cgroup-lite
 Conflicts: docker (<< 1.5~), docker-engine, docker-engine-cs, docker.io, lxc-docker, lxc-docker-virtual-package
 Replaces: docker-engine
 Section: admin
 Priority: optional
 Homepage: https://www.docker.com
 Description: Docker: the open-source application container engine
  Docker is a product for you to build, ship and run any application as a
  lightweight container
  .
  Docker containers are both hardware-agnostic and platform-agnostic. This means
  they can run anywhere, from your laptop to the largest cloud compute instance and
  everything in between - and they don't require you to use a particular
  language, framework or packaging system. That makes them great building blocks
  for deploying and scaling web apps, databases, and backend services without
  depending on a particular stack or provider.

I'm still curious how it worked before, or is this just that it requires the new version, so we must manually upgrade the version for it to work? (Or enable the "backports" repository) 🤔

thaJeztah avatar May 19 '22 15:05 thaJeztah

I guess it's also a combination of how the verify script explicitly disables some dependency resolution (to prevent it satisfying the newly built packages with older versions of the packages).

thaJeztah avatar May 19 '22 15:05 thaJeztah

So default version on bionic is 1.51; https://packages.ubuntu.com/bionic/init-system-helpers

bionic-backports version is 1.56; https://packages.ubuntu.com/bionic-backports/init-system-helpers

So we need to have it installed from backports indeed.

At a glance, it looks like bionic-backports is enabled and configured by default;

cat /etc/apt/sources.list | grep backports
## Also, please note that software in backports WILL NOT receive any review
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

But backports are not considered by default, so we need some way to define that it should use them; https://help.ubuntu.com/community/UbuntuBackports

Perhaps some conditional dependency for 18.04 🤔

thaJeztah avatar May 19 '22 16:05 thaJeztah

Looks like it can't be defined in the dependencies (to force install from backports); https://unix.stackexchange.com/a/526621/78656

thaJeztah avatar May 19 '22 16:05 thaJeztah

Yeah sorry -- IMO our best short-term option is #699 (full revert of my PR).

tianon avatar May 19 '22 17:05 tianon

Would adding this be a "good thing to do" in either case? (curious)

thaJeztah avatar May 19 '22 17:05 thaJeztah

(rebased to see if it still works after we reverted the other one)

thaJeztah avatar May 19 '22 18:05 thaJeztah

Ah, I guess from that perspective, yes? It doesn't hurt anything (it'll probably be empty and no-op in many cases).

tianon avatar May 19 '22 18:05 tianon