2

My Dockerfile is:

FROM python:3.9-slim-bullseye


RUN apt-get update && apt-get install \
    --no-install-recommends -qq -y \
    apt-utils \
    poppler-utils \
    libjpeg-dev \
    libcairo2-dev \
    pdftk \
    ghostscript \
    autoconf-archive \
    pkg-config \
    libpng-dev \
    libtiff5-dev \
    zlib1g-dev \
    imagemagick \
    wget \
    procps \
    curl \
    locales \
    libicu-dev \
    libpango1.0-dev \
    g++ \
    make \
    tesseract-ocr \
    tesseract-ocr-por \
    tesseract-ocr-osd

I can build it through sudo docker build -t foo . on my machine (Ubuntu 20.04 and Docker version 19.03.10), but I can't do the same on Travis CI:

Errors were encountered while processing:
 libpaper1:amd64
 libgs9:amd64
 ghostscript
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get update && apt-get install     --no-install-recommends -qq -y     apt-utils     poppler-utils     libjpeg-dev     libcairo2-dev     pdftk     ghostscript     autoconf-archive     pkg-config     libpng-dev     libtiff5-dev     zlib1g-dev     imagemagick     wget     procps     curl     locales     libicu-dev     libpango1.0-dev     g++     make     tesseract-ocr     tesseract-ocr-por     tesseract-ocr-osd     libc6     libgs9     ucf     libpaper1' returned a non-zero code: 100

Part of log regarding libpaper1:

Setting up libpaper1:amd64 (1.1.28+b1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Creating config file /etc/papersize with new version
stat: cannot statx '/etc/papersize.dpkg-inst': Operation not permitted
dpkg: error processing package libpaper1:amd64 (--configure):
 installed libpaper1:amd64 package post-installation script subprocess returned error exit status 1

Part of log regarding libgs9:

dpkg: error processing package libgs9:amd64 (--configure):
 dependency problems - leaving unconfigured

Part of log regarding ghostscript:

dpkg: dependency problems prevent configuration of ghostscript:
 ghostscript depends on libgs9 (= 9.53.3~dfsg-7+deb11u1); however:
  Package libgs9:amd64 is not configured yet.

I tried the following without success:

RUN dpkg --configure -a && apt-get -f install

and also:

RUN apt-get clean && apt-get update && apt-get install --fix-broken

RUN apt-get install --assume-yes --no-install-recommends -qq \

Part of my .travis.yaml:

jobs:
  include:
    - stage: Build temporary docker image
      services:
        - docker
      language: minimal
      if: type = pull_request AND branch = master
      script:
        - source ci_scripts/gcloud_setup.sh
        - gcloud docker -- pull gcr.io/foo/bar
        - docker build --cache-from gcr.io/foo/bar:latest -t bar_temp .
        - docker tag bar_temp gcr.io/foo/bar
        - gcloud docker -- push gcr.io/foo/bar

Am I missing something here? How can I install those packages without error?

1

Root cause

In short the package libpaper1, as of today, is broken on some configuration steps with the default version of docker used on travis.

The issue with configuration step that fails on libpaper1 install comes from a statx and libseccomp. On docker statx was whitelisted for libseccomp in docker 18.04.

https://github.com/moby/moby/pull/36417

However this alone doesn't explain fully the issue, as of today docker --version on travis states 18.06.0-ce which should have statx whitelisted but still has issues which I didn't find the reason.

Nevertheless, upgrading the docker image version solves the issue.

Solution

Changing the docker version on travis solves the issue with statx which fix the installation of libpaper1 and ghostscript.

In your .travis.yml file add the following:

# Need docker-ce 20 instead of docker-ce 18 for installing ghostscript/libpaper1 on debian:bullseye
# https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
before_install:
   - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
   - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
   - sudo apt-get update
   - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce

https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version

Kudo to https://github.com/florentx for finding that out

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.