From 43b2c5bac95399b4c38b199e8d5d90e910f4d568 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 1 Jul 2026 12:37:33 +0200 Subject: [PATCH] ci: mock sysctl in test container to avoid read-only filesystem errors When running container-based package tests (e.g. for transmission-daemon), packages or build scripts that try to write network settings or kernel parameters via sysctl or direct writes to /proc/sys fail because /proc/sys is mounted as read-only. Signed-off-by: Josef Schlehofer --- .github/scripts/test_entrypoint.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/scripts/test_entrypoint.sh b/.github/scripts/test_entrypoint.sh index 1b8f8ad..d6f247a 100755 --- a/.github/scripts/test_entrypoint.sh +++ b/.github/scripts/test_entrypoint.sh @@ -9,6 +9,32 @@ set -o nounset # undefined variables causes script to fail mkdir -p /var/lock/ mkdir -p /var/log/ +# Mock sysctl and /etc/init.d/sysctl to avoid read-only filesystem errors in container +if [ -f /etc/init.d/sysctl ]; then + cat << 'EOF' > /etc/init.d/sysctl +#!/bin/sh /etc/rc.common +START=11 +start() { :; } +stop() { :; } +EOF + chmod +x /etc/init.d/sysctl +fi + +SYSCTL_PATH=$(command -v sysctl || echo "/sbin/sysctl") +if [ -f "$SYSCTL_PATH" ] && [ ! -f "${SYSCTL_PATH}.real" ]; then + mv "$SYSCTL_PATH" "${SYSCTL_PATH}.real" + cat << EOF > "$SYSCTL_PATH" +#!/bin/sh +# If writing or applying, ignore read-only filesystem errors or do nothing +if echo "\$*" | grep -qE '(-w|=|-p)'; then + "${SYSCTL_PATH}.real" "\$@" 2>/dev/null || true +else + "${SYSCTL_PATH}.real" "\$@" +fi +EOF + chmod +x "$SYSCTL_PATH" +fi + CI_HELPERS="${CI_HELPERS:-/scripts/ci_helpers.sh}" TEST_PACKAGES="binutils coreutils-timeout file"