postgresql-client-15 的 Debian Bullseye 安装错误(取决于:libreadline7 (>= 6.0),但无法安装)

postgresql-client-15 的 Debian Bullseye 安装错误(取决于:libreadline7 (>= 6.0),但无法安装)

我位于一个 docker 容器内,该容器使用 Ruby 3.2.2 Debian 11 bullseye 映像作为基础映像(请参阅https://github.com/docker-library/ruby/blob/ed1be47a38a7a24a0aa03c450549afcb592f02a8/3.2/bullseye/Dockerfile

我只想postgres-client-15使用以下命令安装包:

FROM ruby:3.2.2-bullseye

# ...

RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main 15" >> /etc/apt/sources.list.d/postgresql.list

#...

RUN apt-get update && apt-get install -y apt-transport-https ca-certificates \
    && apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 \
    && echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bullseye main > /etc/apt/sources.list.d/passenger.list \
    && apt-get update \
    && apt-get install -y \
      autoconf \
      build-essential \
      cron \
      curl \
      ghostscript \
      git \
      less \
      libjemalloc2 \
      libpq-dev \
      libreadline-dev \
      libsqlite3-dev sqlite3 \
      libssl-dev \
      nginx libnginx-mod-http-passenger \
      nodejs \
      postgresql-client-15 \
      redis-server \
      vim \
      xfonts-base \
      xfonts-75dpi \
      xmlsec1 \
      yarn \
    && rm -rf /var/lib/apt/lists/*

失败并显示此错误消息

The following packages have unmet dependencies:
 postgresql-client-15 : Depends: libreadline7 (>= 6.0) but it is not installable

当我手动运行命令时,我可以看到该软件包libreadline8已安装:

root@42da1438f1d6:/# dpkg -l | grep libread
ii  libreadline-dev:amd64              8.1-1                          amd64        GNU readline and history libraries, development files
ii  libreadline8:amd64                 8.1-1                          amd64        GNU readline and history libraries, run-time libraries

似乎 postgresql-client-15 依赖,libreadline7但这个包在 Debian 11 Bullseye 中不可用。知道如何解决这个问题吗?

我不介意升级 Docker 镜像本身,但 Debian Bookworm 会抛出类似的错误(以及其他错误,因为某些软件包尚不可用于 Bookworm)。

答案1

问题来自于 Buster PostgreSQL 存储库的使用;那里可用的包postgresql-client-15使用 Buster 依赖项,包括libreadline7.

既然你愿意升级到 Bookworm,你不妨使用postgresql-client-15Debian 中提供的软件包,不使用 PosgreSQL 存储库:

FROM ruby:3.2.2-bookworm

RUN apt-get update && apt-get install -y --no-install-recommends postgresql-client-15

相关内容