baseimage-docker: [16.04] debconf: delaying package configuration, since apt-utils is not installed

On newest image 0.9.19, if I run any apt-get command, I received the following red warning line: debconf: delaying package configuration, since apt-utils is not installed

Minimal example:

FROM phusion/baseimage:0.9.19

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]

# ...put your own build instructions here...
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold"

# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

This is only happening in 0.9.19 / Ubuntu 16.04.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 62
  • Comments: 61

Commits related to this issue

Most upvoted comments

My solution is just to put a

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils

line in the docker file and it fixes the problem.

It did not worked for me =/

Step 2 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in 1b35b989ce4d
 ---> 78f654f9ea69
Removing intermediate container 1b35b989ce4d
Step 3 : RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
 ---> Running in 29d7eb2e1bb5
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main Sources [1103 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [5179 B]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [250 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [129 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [522 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [432 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-security/main Sources [52.7 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources [13.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [196 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [62.2 kB]
Fetched 18.4 MB in 4min 14s (72.2 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libapt-inst2.0
The following NEW packages will be installed:
  apt-utils libapt-inst2.0
0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
Need to get 251 kB of archives.
After this operation, 1203 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapt-inst2.0 amd64 1.2.12~ubuntu16.04.1 [55.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-utils amd64 1.2.12~ubuntu16.04.1 [196 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 251 kB in 1s (176 kB/s)
Selecting previously unselected package libapt-inst2.0:amd64.
(Reading database ... 7256 files and directories currently installed.)
Preparing to unpack .../libapt-inst2.0_1.2.12~ubuntu16.04.1_amd64.deb ...
Unpacking libapt-inst2.0:amd64 (1.2.12~ubuntu16.04.1) ...
Selecting previously unselected package apt-utils.
Preparing to unpack .../apt-utils_1.2.12~ubuntu16.04.1_amd64.deb ...
Unpacking apt-utils (1.2.12~ubuntu16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Setting up libapt-inst2.0:amd64 (1.2.12~ubuntu16.04.1) ...
Setting up apt-utils (1.2.12~ubuntu16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

It is a harmless 1 line warning message.

The command does get installed, and following apt-get commands do not show any error / warning messages.

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apt-utils

didn’t work for me too.

@aairey Did you try adding this to your Dockerfile?

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils

I don’t think apt-get allows packages which only work in interactive mode. So all packages must work in noninteractive mode.

What I do is I set

ENV DEBIAN_FRONTEND noninteractive

in the beginning of the Docker file and I set

ENV DEBIAN_FRONTEND teletype

At the very end. This way both interactive and non-interactive modes get set.

@danielxfr how about:

FROM ...

ARG DEBIAN_FRONTEND=noninteractive

RUN \
  apt-get update -y && \
  apt-get install -y apt-utils 2>&1 | grep -v "debconf: delaying package configuration, since apt-utils is not installed" && \
  apt-get install -y --no-install-recommends package1,package2,...

The command does get installed, and following apt-get commands do not show any error / warning messages.

When I install apt-utils before the rest of apt packages, I only get delaying package configuration for the installation of the apt-utils package, which makes sense. However, I get the following warnings for the other packages:

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 

Apparently this is also a harmless warning that can be avoided by setting DEBIAN_FRONTEND=noninteractive as some others have in this thread.

If anyone is wondering what the best-practice way to set this variable is, this is the best info I could find https://github.com/docker/docker/issues/4032#issuecomment-192327844 .

The key takeaway there is make sure you don’t use ENV to set this because it will persist in the image, but you only want that value set during the docker build stage.

I wonder though, what if you’re installing a package that does depend on interactive configuration? Does apt-get just fail, or will it just silently leave the package unconfigured?

sudo aptitude install apt-utils

in the end the reco from @stephanwehr is enough: just add this at the beginning of your dockerfile

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS="yes"

my solution

apt-get update && apt-get install -y --no-install-recommends apt-utils

I am quite curious if someone manages to result the apt-utils issue without triggering any warnings. Ignoring warnings in builds is very bad practice, once you let them in, they will grow exponentially and everyone will ignore them.

I don’t get why this issue is closed, it is still an issue. This is my Dockerfile:

FROM postgres:latest

ENV TZ=UTC
ENV DEBIAN_FRONTEND=noninteractive
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y postgresql-contrib
COPY sql/* /docker-entrypoint-initdb.d/

And these are my logs, from running docker-compose build

Step 5/8 : RUN apt-get update
 ---> Running in 142bd8adbec2
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [161 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7,908 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [5,792 B]
Get:7 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [46.2 kB]
Get:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [151 kB]
Get:9 http://apt.postgresql.org/pub/repos/apt buster-pgdg/12 amd64 Packages [861 B]
Fetched 8,510 kB in 6s (1,437 kB/s)
Reading package lists...
Removing intermediate container 142bd8adbec2
 ---> 7024764329ca
Step 6/8 : RUN apt-get install -y --no-install-recommends apt-utils
 ---> Running in f9258fb99c3f
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libapt-inst2.0
The following NEW packages will be installed:
  apt-utils libapt-inst2.0
0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
Need to get 625 kB of archives.
After this operation, 1,655 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 libapt-inst2.0 amd64 1.8.2 [204 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 apt-utils amd64 1.8.2 [421 kB]


debconf: delaying package configuration, since apt-utils is not installed


Fetched 625 kB in 0s (4,284 kB/s)
Selecting previously unselected package libapt-inst2.0:amd64.
(Reading database ... 13981 files and directories currently installed.)
Preparing to unpack .../libapt-inst2.0_1.8.2_amd64.deb ...
Unpacking libapt-inst2.0:amd64 (1.8.2) ...
Selecting previously unselected package apt-utils.
Preparing to unpack .../apt-utils_1.8.2_amd64.deb ...
Unpacking apt-utils (1.8.2) ...
Setting up libapt-inst2.0:amd64 (1.8.2) ...
Setting up apt-utils (1.8.2) ...
Processing triggers for libc-bin (2.28-10) ...
Removing intermediate container f9258fb99c3f
 ---> 1fa9de755ff2

I will reopen this issue until we come to a conclusion.

FWIW It is better to use ARG on newer docker installations, as this only sets the ENV during build time (See https://github.com/moby/moby/issues/4032).

ARG DEBIAN_FRONTEND=noninteractive

But I am still getting the warnings about apt-utils.

The behavior is controlled by the configuration setting: DPkg::Pre-Install-Pkgs

The default setting is configured via “/etc/apt/apt.conf.d/70debconf”:

// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};

To disable the setting permanently:

RUN set -x \
&& sed -Ei 's|^(DPkg::Pre-Install-Pkgs .*)|#\1|g' /etc/apt/apt.conf.d/70debconf \
&& apt-get update \
&& apt-get upgrade -y

To disable the setting temporarily:

RUN set -x \
&& mv /etc/apt/apt.conf.d/70debconf . \
&& apt-get update \
&& apt-get install -y apt-utils \
&& mv 70debconf /etc/apt/apt.conf.d \
&& apt-get upgrade -y

Show less debconf warnings: ARG DEBCONF_NOWARNINGS="yes"

Here is an example Docker file including all methods mentioned above, pick the one that fits your use case. To get the full “apt-get” output, remove “-qq” and “>/dev/null”.

ARG IMAGE="ubuntu:16.04"
FROM ${IMAGE}

ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBCONF_TERSE="yes"
ARG APT="apt-get -qq -y"
ARG LANG="C.UTF-8"

# Configure APT
RUN set -x \
&& echo "debconf debconf/frontend select ${DEBIAN_FRONTEND}" | debconf-set-selections \
&& echo 'APT::Install-Recommends "false";' | tee /etc/apt/apt.conf.d/99install-recommends \
&& echo 'APT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/99assume-yes \
&& sed -Ei 's|^(DPkg::Pre-Install-Pkgs .*)|#\1|g' /etc/apt/apt.conf.d/70debconf \
&& debconf-show debconf

# Install Packages
RUN set -x \
&& mv /etc/apt/apt.conf.d/70debconf . \
&& ${APT} update \
&& ${APT} install apt-utils >/dev/null \
&& mv 70debconf /etc/apt/apt.conf.d \
&& ${APT} upgrade >/dev/null \
&& ${APT} install curl >/dev/null

References: debconf - Preconfiguring packages apt.conf - SYNTAX

While the issue has been closed but still unclear solution on this case that already runs for years .

Currently the highest votes goes to:

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apt-utils

but it still gives the warning

debconf: delaying package configuration, since apt-utils is not installed

@hyperknot Why two ENV instead of a single (and more future-proof) ARG?

in the end the reco from @stephanwehr is enough: just add this at the beginning of your dockerfile

ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NOWARNINGS="yes"

This. This is exactly what I was looking for.
These two lines (and these two only) work exactly as intended. Didn’t have to do anything else, no more warnings, life goes on, my wife didn’t leave me, my dog is happy, I can finally rest. Many thanks!

in the end the reco from @stephanwehr is enough: just add this at the beginning of your dockerfile

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS="yes"

Simplest answer, the nasty warning is finally gone

Building off of https://github.com/phusion/baseimage-docker/issues/319#issuecomment-573368959 from @sebthom; if you use bash, you can keep STDERR text separate from STDOUT and apply the grep pattern only in the STDERR text:

FROM ...

ARG DEBIAN_FRONTEND=noninteractive

SHELL ["/bin/bash", "-c"]

RUN \
  apt-get update -y && \
  apt-get install -y apt-utils 2> >( grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2 ) && \
  apt-get install -y --no-install-recommends package1,package2,...

I am assuming you get this message while installing apt-utils, indicating that apt-utils hasn’t finished installing yet, but that subsequent apt-get install invocations no longer print the warning. Is that not the case?

It’s weird since I do apt-get update && apt-get install -y --no-install-recommends apt-utils but I get anyways the message

Step 14/40 : RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
 ---> Running in e01b03ee01db
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [320 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [3451 B]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [143 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [10.7 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [655 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [6955 B]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [916 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3666 B]
Fetched 15.4 MB in 33s (474 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  apt libapt-inst2.0 libapt-pkg5.0
Suggested packages:
  apt-doc aptitude | synaptic | wajig dpkg-dev gnupg | gnupg2 | gnupg1
  powermgmt-base
Recommended packages:
  ca-certificates
The following NEW packages will be installed:
  apt-utils libapt-inst2.0
The following packages will be upgraded:
  apt libapt-pkg5.0
2 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 2233 kB of archives.
After this operation, 1298 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libapt-pkg5.0 amd64 1.6.8 [804 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apt amd64 1.6.8 [1165 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libapt-inst2.0 amd64 1.6.8 [55.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apt-utils amd64 1.6.8 [208 kB]
debconf: delaying package configuration, since apt-utils is not installed

They are totally different. ENV is persistent in the image. It’d still need two cases here.

You need both apt-utils and noninteractive. Installing apt-utils is really not making any difference in build speed, it’s a tiny util which should actually be part of official image.

But why do you need to persist it (which overrides the default)? The default frontend works for me. In addition, --no-install-recommends can be omitted since apt-utils doesn’t have any recommended package.

Update: just adding seems to do the trick for the ubuntu image. gcc is still not found in the path but that I can fix by hand.

ENV DEBIAN_FRONTEND="noninteractive"

RUN ln -s /usr/bin/gcc-4.8 /usr/bin/gcc

I found this solution from: https://stackoverflow.com/questions/51023312/docker-having-issues-installing-apt-utils

it consists of following the apt-get install command on the same line as ENV DEBIAN_FRONTEND noninteractive :

DEBIAN_FRONTEND=noninteractive apt-get install -y pkgs...

@Theaxiom I’d definitely add apt-utils here: https://github.com/hyperknot/baseimage16/blob/master/image/prepare.sh#L34 and teletype at the end: https://github.com/hyperknot/baseimage16/blob/master/image/Dockerfile#L19

noninteractive is already part of buildconfig

@hyperknot Are you proposing this be added to baseimage-docker?

@Theaxiom this just installs apt-utils? I thought there was a way to just make the warning go away without installing apt-utils. When apt-utils is installed, the build is way slower, and since it is not the default I prefer not to install it. But seems there is no way to get rid of the warning without installing apt-utils?

@franklinyu it works for me just using ARG. The apt-utils warning and reason for using noninteractive is unrelated. (unless I am missing something?). The noninteractive setting just makes sure no dialogs are opened and that dpkg-reconfigure dus not prompt you for input. At least that is my understanding after fiddling around with it yesterday. And thus you should always use noninteractive when using apt-get during build.

Yes, I just confirmed that. I thought the default only gives warning when installing packages in Dockerfile. I missed that because the warning was not highlighted as red (of course), and that doesn’t happen on normal Ubuntu. However, teletype is not a known value for DEBIAN_FRONTEND according to documentation online (??); the newt, mentioned as default in documentation, still produces the warning for me (???).