背景/xy-问题:我有一些需要的工具libcurl-devel
,但如果存在 32 位版本,则无法编译libcurl
。修复该工具是另一天的事情。今天我想阻止安装 32 位版本的libcurl
.或者更准确地说:我想学习如何预测和防止将来出现类似问题。
64 位版本libcurl
已预安装在新的 fedora 38 docker 容器上:
# cat /etc/redhat-release
Fedora release 38 (Thirty Eight)
# dnf list --installed | grep libcurl
libcurl.x86_64 8.0.1-3.fc38 @koji-override-0
但是,为了完整起见,我的安装脚本同时安装libcurl
和libcurl-devel
。但这将安装 32 位版本libcurl
:
# dnf install libcurl libcurl-devel | grep curl
Package libcurl-8.0.1-3.fc38.x86_64 is already installed.
libcurl-devel i686 8.0.1-4.fc38 updates 987 k
libcurl i686 8.0.1-4.fc38 updates 335 k
除非我颠倒包的顺序:
# dnf install libcurl-devel libcurl | grep curl
libcurl-devel x86_64 8.0.1-4.fc38 updates 987 k
libcurl x86_64 8.0.1-4.fc38 updates 313 k
我觉得这种行为很奇怪;我预计包裹的顺序并不重要。
包顺序如何影响 dnf/yum 中依赖项的解析,是否可以预测特定顺序的效果是什么?
一些澄清。
我认为问题的原因之一是libcurl
当前最新的 Fedora 映像的版本相7.85.0-10.fc37
对于7.85.0-11.fc37
.因此可能有必要使用这个版本的 fedora 37,即https://hub.docker.com/layers/library/fedora/37/images/sha256-210908a224d08874dc70ca2013439c4e2849047c5bb8711802f86ee48b1cf3f5
一个更完整的例子:
> docker run -ti fedora:37@sha256:210908a224d08874dc70ca2013439c4e2849047c5bb8711802f86ee48b1cf3f5
# dnf list --installed | grep curl
curl.x86_64 7.85.0-10.fc37 @koji-override-0
libcurl.x86_64 7.85.0-10.fc37 @koji-override-0
# dnf list --installed | grep i686
所以最初根本没有 i686 软件包。
按顺序安装libcurl-devel libcurl
可以正常工作(使用--assumeno
):
# dnf install --assumeno libcurl-devel libcurl
Last metadata expiration check: 0:01:46 ago on Fri Oct 6 12:43:11 2023.
Package libcurl-7.85.0-10.fc37.x86_64 is already installed.
Dependencies resolved.
===============================================================================================
Package Architecture Version Repository Size
===============================================================================================
Installing:
libcurl-devel x86_64 7.85.0-11.fc37 updates 977 k
Upgrading:
libcurl x86_64 7.85.0-11.fc37 updates 303 k
Installing dependencies:
libpkgconf x86_64 1.8.0-3.fc37 fedora 36 k
pkgconf x86_64 1.8.0-3.fc37 fedora 41 k
pkgconf-m4 noarch 1.8.0-3.fc37 fedora 14 k
pkgconf-pkg-config x86_64 1.8.0-3.fc37 fedora 10 k
Transaction Summary
===============================================================================================
Install 5 Packages
Upgrade 1 Package
Total download size: 1.3 M
Operation aborted.
以其他顺序安装,libcurl libcurl-devel
将安装 i686 软件包:
# dnf install --assumeno libcurl libcurl-devel
Last metadata expiration check: 0:01:23 ago on Fri Oct 6 12:43:11 2023.
Package libcurl-7.85.0-10.fc37.x86_64 is already installed.
Dependencies resolved.
===============================================================================================
Package Architecture Version Repository Size
===============================================================================================
Installing:
libcurl-devel i686 7.85.0-11.fc37 updates 976 k
Upgrading:
glibc x86_64 2.36-14.fc37 updates 2.2 M
glibc-common x86_64 2.36-14.fc37 updates 359 k
glibc-minimal-langpack x86_64 2.36-14.fc37 updates 79 k
Installing dependencies:
cyrus-sasl-lib i686 2.1.28-8.fc37 fedora 861 k
gdbm-libs i686 1:1.23-2.fc37 fedora 60 k
glibc i686 2.36-14.fc37 updates 2.0 M
glibc-gconv-extra x86_64 2.36-14.fc37 updates 1.7 M
keyutils-libs i686 1.6.1-5.fc37 fedora 32 k
krb5-libs i686 1.19.2-13.fc37 updates 770 k
libbrotli i686 1.0.9-9.fc37 fedora 317 k
libcom_err i686 1.46.5-3.fc37 fedora 26 k
libcurl i686 7.85.0-11.fc37 updates 329 k
libevent i686 2.1.12-7.fc37 fedora 279 k
libgcc i686 12.3.1-1.fc37 updates 123 k
libidn2 i686 2.3.4-1.fc37 updates 161 k
libnghttp2 i686 1.51.0-1.fc37 updates 80 k
libpkgconf x86_64 1.8.0-3.fc37 fedora 36 k
libpsl i686 0.21.1-6.fc37 fedora 64 k
libselinux i686 3.5-1.fc37 updates 91 k
libsepol i686 3.5-1.fc37 updates 336 k
libssh i686 0.10.5-1.fc37 updates 224 k
libunistring i686 1.0-2.fc37 fedora 551 k
libverto i686 0.3.2-4.fc37 fedora 21 k
libxcrypt i686 4.4.36-1.fc37 updates 123 k
openldap i686 2.6.4-1.fc37 updates 273 k
openssl-libs i686 1:3.0.9-1.fc37 updates 2.1 M
openssl-pkcs11 x86_64 0.4.12-2.fc37 fedora 74 k
pcre2 i686 10.40-1.fc37.1 fedora 234 k
pkgconf x86_64 1.8.0-3.fc37 fedora 41 k
pkgconf-m4 noarch 1.8.0-3.fc37 fedora 14 k
pkgconf-pkg-config x86_64 1.8.0-3.fc37 fedora 10 k
zlib i686 1.2.12-5.fc37 fedora 92 k
Installing weak dependencies:
glibc-gconv-extra i686 2.36-14.fc37 updates 1.7 M
openssl-pkcs11 i686 0.4.12-2.fc37 fedora 76 k
Transaction Summary
===============================================================================================
Install 32 Packages
Upgrade 3 Packages
Total download size: 16 M
Operation aborted.
新发现:问题可能与libcurl-minimal
.
运行Fedora Live 光盘镜像,例如在 QEMU 上,并且运行dnf install libcurl libcurl-devel
还可以让 dnf 安装libcurl.i686
(截图1)。但是,那里dnf
解释说这是由于与已安装的冲突造成的libcurl-minimal.i686
,并给出了添加的建议--best --allowerasing
(截图2),这确实让它安装libcurl.i686
。
瞧,添加--best --allowerasing
也可以在 docker 容器中工作,即使libcurl-minimal
实际上并未安装在该映像上。所以我的猜测是,在某些地方仍然存在一些残余物,libcurl-minimal.i686
使 dnf 认为存在问题,而实际上根本没有问题。