Skip to content

Commit 82ff02c

Browse files
committed
Fix for microdnf segfault
Signed-off-by: Riccardo Pittau <elfosardo@gmail.com>
1 parent 06bb350 commit 82ff02c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ ENV UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE} \
3737
SETUPTOOLS_VERSION=${SETUPTOOLS_VERSION}
3838

3939
RUN --mount=type=cache,sharing=locked,target=/var/cache/dnf \
40-
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf && \
41-
echo "tsflags=nodocs" >> /etc/dnf/dnf.conf && \
42-
echo "keepcache=1" >> /etc/dnf/dnf.conf && \
40+
# Remove the specific key files that cause the parsing crash
41+
rm -f /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-PQC && \
42+
# Use the stable 'rpm' tool to import the official key
43+
# This avoids the microdnf/GLib bug while keeping GPG checks ENABLED
44+
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial && \
45+
# Configure DNF behavior
46+
printf "[main]\ninstall_weak_deps=0\ntsflags=nodocs\nkeepcache=1\n" > /etc/dnf/dnf.conf && \
47+
# Proceed with installation (GPG check remains on by default)
4348
microdnf install -y \
4449
gcc \
4550
python3.12-devel \
4651
python3.12-pip \
47-
python3.12-setuptools
52+
python3.12-setuptools && \
53+
microdnf clean all
4854

4955
COPY ${UPPER_CONSTRAINTS_FILE} ironic-deps-list /tmp/
5056
COPY build-wheels.sh /bin/

prepare-image.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -euxo pipefail
44

5+
# --- GPG Bug Workaround ---
6+
# 1. Clear out the problematic key files to prevent microdnf memory corruption
7+
rm -f /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-PQC
8+
9+
# 2. Re-import the primary official key using the stable RPM tool
10+
# This populates the RPM database so microdnf doesn't have to parse them
11+
if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial ]; then
12+
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
13+
fi
14+
515
cat >> /etc/dnf/dnf.conf<< EOF
616
install_weak_deps=False
717
tsflags=nodocs

0 commit comments

Comments
 (0)