Skip to content

Commit 22e4a0d

Browse files
committed
ci: dietpi-software test: workaround for failing MariaDB on Forky
Mount namespacing fails since systemd 259-rc1 with QEMU-emulation. This will cause a lot more services to fail, as common as sandboxing is, but doing a start with MariaDB. Also merging QEMU-emulation relaeted workarounds together.
1 parent c732e87 commit 22e4a0d

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

.github/workflows/dietpi-software.bash

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -425,23 +425,6 @@ G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || { echo "[ INFO ] Unsup
425425
# Enable automated setup
426426
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
427427

428-
# Workaround for failing systemd services in emulated container: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219
429-
if (( $emulation ))
430-
then
431-
for i in rootfs/lib/systemd/system/*.service
432-
do
433-
[[ -f $i ]] || continue
434-
grep -Eq '^(Load|Import)Credential=' "$i" || continue
435-
G_EXEC mkdir "${i/lib/etc}.d"
436-
if [[ $DISTRO == 'bullseye' || $DISTRO == 'bookworm' ]]
437-
then
438-
G_EXEC eval "echo -e '[Service]\nLoadCredential=' > \"${i/lib/etc}.d/dietpi-no-credentials.conf\""
439-
else
440-
G_EXEC eval "echo -e '[Service]\nImportCredential=' > \"${i/lib/etc}.d/dietpi-no-credentials.conf\""
441-
fi
442-
done
443-
fi
444-
445428
# ARMv6/7 Trixie: Workaround failing chpasswd, which tries to access /proc/sys/vm/mmap_min_addr, but fails as of AppArmor on the host
446429
if (( $arch < 3 && $dist > 7 )) && systemctl -q is-active apparmor
447430
then
@@ -484,17 +467,27 @@ then
484467
G_EXEC touch rootfs/mnt/dietpi_userdata/papermc/plugins/Geyser-Spigot.jar
485468
fi
486469

487-
# Workarounds for QEMU-emulated RISC-V and 32-bit ARM containers
488-
if (( ( $arch < 3 || $arch == 11 ) && $emulation ))
470+
# Workarounds for QEMU-emulated containers
471+
if (( $emulation ))
489472
then
490-
# Failing services as PrivateUsers=true leads to "Failed to set up user namespacing", and AmbientCapabilities to "Failed to apply ambient capabilities (before UID change): Operation not permitted"
491-
G_EXEC mkdir rootfs/etc/systemd/system/{redis-server,raspotify,navidrome,homebridge}.service.d
473+
# Failing systemd services: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219
474+
for i in rootfs/lib/systemd/system/*.service
475+
do
476+
[[ -f $i ]] && grep -Eq '^(Import|Load)Credential=' "$i" || continue
477+
G_EXEC mkdir "${i/lib/etc}.d"
478+
G_EXEC eval "echo -e '[Service]\nImportCredential=\nLoadCredential=' > \"${i/lib/etc}.d/dietpi-no-credentials.conf\""
479+
done
480+
481+
# Failing services as PrivateUsers leads to "Failed to set up user namespacing", and AmbientCapabilities to "Failed to apply ambient capabilities (before UID change): Operation not permitted"
482+
G_EXEC mkdir rootfs/etc/systemd/system/{redis-server,raspotify,navidrome,homebridge,mariadb}.service.d
492483
G_EXEC eval 'echo -e '\''[Service]\nPrivateUsers=0'\'' > rootfs/etc/systemd/system/redis-server.service.d/dietpi-container.conf'
493484
G_EXEC eval 'echo -e '\''[Service]\nPrivateUsers=0'\'' > rootfs/etc/systemd/system/raspotify.service.d/dietpi-container.conf'
494485
G_EXEC eval 'echo -e '\''[Service]\nPrivateUsers=0'\'' > rootfs/etc/systemd/system/navidrome.service.d/dietpi-container.conf'
495486
G_EXEC eval 'echo -e '\''[Service]\nAmbientCapabilities='\'' > rootfs/etc/systemd/system/homebridge.service.d/dietpi-container.conf'
487+
# Forky: ProtectHome/ProtectSystem/PrivateTmp/...: "Failed to set up mount namespacing: Invalid argument": https://github.com/systemd/systemd/issues/39951
488+
(( $dist > 8 )) && G_EXEC eval 'echo -e '\''[Service]\nProtectHome=0\nProtectSystem=0'\'' > rootfs/etc/systemd/system/mariadb.service.d/dietpi-container.conf'
496489

497-
# Failing 32-bit ARM Rust builds on ext4 in QEMU emulated container on 64-bit host: https://github.com/rust-lang/cargo/issues/9545
490+
# Failing 32-bit ARM Rust builds on ext4 with 64-bit host: https://github.com/rust-lang/cargo/issues/9545
498491
if (( $arch < 3 ))
499492
then
500493
G_EXEC eval 'echo -e '\''tmpfs /mnt/dietpi_userdata tmpfs size=3G,noatime,lazytime\ntmpfs /root tmpfs size=3G,noatime,lazytime'\'' >> rootfs/etc/fstab'
@@ -529,7 +522,7 @@ then
529522
G_EXEC sed --follow-symlinks -i "/# Start DietPi-Software/i\sed -i 's/192\.168\.42\./$(G_GET_NET ip | sed 's/[0-9]*$//')/g' /boot/dietpi/dietpi-software" rootfs/boot/dietpi/dietpi-login
530523
fi
531524

532-
# Workaround for Apache2 on emulated RISC-V system
525+
# Workaround for Apache on emulated RISC-V system
533526
if (( ${aINSTALL[83]} )) && (( $emulation && $arch == 11 ))
534527
then
535528
G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/i\sed -i '\''/^DocumentRoot/a\Mutex posixsem'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login

0 commit comments

Comments
 (0)