Debian
無法在 Debian Bullseye 上安裝 ghostscript、libgs9 和 libpaper1
我的 Dockerfile 是:
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
我可以在我的機器上建構它
sudo docker build -t foo .
(Ubuntu 20.04 和 Docker 版本 19.03.10),但我不能在 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
關於 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
關於 libgs9 的部分日誌:
dpkg: error processing package libgs9:amd64 (--configure): dependency problems - leaving unconfigured
關於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.
我嘗試了以下但沒有成功:
RUN dpkg --configure -a && apt-get -f install
並且:
RUN apt-get clean && apt-get update && apt-get install --fix-broken RUN apt-get install --assume-yes --no-install-recommends -qq \
我的一部分
.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
我在這裡錯過了什麼嗎?如何安裝這些軟體包而不會出錯?
根本原因
簡而言之
libpaper1
,截至今天,在 travis 上使用的預設 docker 版本的某些配置步驟中,該軟體包已被破壞。安裝失敗的配置步驟問題
libpaper1
來自 astatx
和libseccomp
. 在 docker上,在 docker 18.04 中statx
被列入白名單。libseccomp
https://github.com/moby/moby/pull/36417
然而,僅此一項並不能完全解釋這個問題,截至今天
docker --version
,在 travis 狀態18.06.0-ce
應該有 statx 白名單但仍然存在我沒有找到原因的問題。不過,升級 docker 鏡像版本可以解決問題。
解決方案
在 travis 上更改 docker 版本解決了
statx
修復libpaper1
和ghostscript
.在您的
.travis.yml
文件中添加以下內容:# 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
感謝https://github.com/florentx發現這一點