From 098be2d64afff882e49bc398b90c2184e01e32e3 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 8 Jan 2025 19:49:31 +0700 Subject: [PATCH] v9.10 (#7356) - CI | Apply better workaround for failing services and hence missing login prompts in QEMU-emulated Trixie containers --- .build/images/dietpi-build | 26 +++++-------------- .build/software/Amiberry/container_build.bash | 23 +++++----------- .build/software/dietpi-software-build.bash | 26 +++++-------------- .build/software/vaultwarden/build.bash | 1 - .github/workflows/dietpi-software.bash | 25 +++++------------- 5 files changed, 28 insertions(+), 73 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 6376917b29..b221ab1c3c 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -609,24 +609,15 @@ then # Install Allo GUI via automated first run setup right here G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt - # - Workaround for skipped autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 + # - Workaround for failing systemd services and hence missing autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219 if (( $DISTRO == 8 && $G_HW_ARCH != $HW_ARCH && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $HW_ARCH ) )) then - cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service -[Unit] -Description=DietPi-Automation -After=dietpi-postboot.service - -[Service] -Type=idle -StandardOutput=tty -ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb; exec /boot/dietpi/dietpi-login' -ExecStop=/usr/bin/systemctl start poweroff.target - -[Install] -WantedBy=multi-user.target -_EOF_ - G_EXEC ln -s /etc/systemd/system/dietpi-automation.service rootfs/etc/systemd/system/multi-user.target.wants/ + for i in rootfs/usr/lib/systemd/system/*.service + do + grep -q '^ImportCredential=' "$i" || continue + G_EXEC mkdir "${i/usr\/lib/etc}.d" + G_EXEC eval "echo -e '[Service]\nImportCredential=' > ${i/usr\/lib/etc}.d/dietpi-no-ImportCredential.conf" + done fi G_CONFIG_INJECT 'AUTO_SETUP_INSTALL_SOFTWARE_ID=' 'AUTO_SETUP_INSTALL_SOFTWARE_ID=159' rootfs/boot/dietpi.txt # Revert autostart option, in case Amiberry image was generated before @@ -711,9 +702,6 @@ _EOF_ # Revert ARMv6 Workaround (( $HW_ARCH == 1 )) && G_EXEC rm rootfs/usr/local/bin/uname - # Revert workaround for skipped autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 - (( $DISTRO == 8 )) && G_EXEC rm rootfs/etc/systemd/system/{multi-user.target.wants/,}dietpi-automation.service - [[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; exit 1; } G_EXEC rm rootfs/success G_EXEC sync diff --git a/.build/software/Amiberry/container_build.bash b/.build/software/Amiberry/container_build.bash index 34816e2640..151102be26 100755 --- a/.build/software/Amiberry/container_build.bash +++ b/.build/software/Amiberry/container_build.bash @@ -119,24 +119,15 @@ G_EXEC mount "${FP_LOOP}p1" rootfs # Enable automated setup G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt -# - Workaround for skipped autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 +# - Workaround for failing systemd services and hence missing autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219 if [[ $DISTRO == 'trixie' ]] && (( $G_HW_ARCH != $arch && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $arch ) )) then - cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service -[Unit] -Description=DietPi-Automation -After=dietpi-postboot.service - -[Service] -Type=idle -StandardOutput=tty -ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || { echo "[ WARN ] Unsupported TERM=\"$TERM\", switching to TERM=\"dumb\""; export TERM=dumb; }; exec /boot/dietpi/dietpi-login' -ExecStop=/usr/bin/systemctl start poweroff.target - -[Install] -WantedBy=multi-user.target -_EOF_ - G_EXEC ln -s /etc/systemd/system/dietpi-automation.service rootfs/etc/systemd/system/multi-user.target.wants/ + for i in rootfs/usr/lib/systemd/system/*.service + do + grep -q '^ImportCredential=' "$i" || continue + G_EXEC mkdir "${i/usr\/lib/etc}.d" + G_EXEC eval "echo -e '[Service]\nImportCredential=' > ${i/usr\/lib/etc}.d/dietpi-no-ImportCredential.conf" + done fi # Workaround invalid TERM on login diff --git a/.build/software/dietpi-software-build.bash b/.build/software/dietpi-software-build.bash index 201d6f033c..3ad4b9e642 100644 --- a/.build/software/dietpi-software-build.bash +++ b/.build/software/dietpi-software-build.bash @@ -123,24 +123,15 @@ G_EXEC mount "${FP_LOOP}p1" rootfs # Enable automated setup G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt -# - Workaround for skipped autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 +# - Workaround for failing systemd services and hence missing autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219 if [[ $DISTRO == 'trixie' ]] && (( $G_HW_ARCH != $arch && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $arch ) )) then - cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service -[Unit] -Description=DietPi-Automation -After=dietpi-postboot.service - -[Service] -Type=idle -StandardOutput=tty -ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || { echo "[ WARN ] Unsupported TERM=\"$TERM\", switching to TERM=\"dumb\""; export TERM=dumb; }; exec /boot/dietpi/dietpi-login' -ExecStop=/usr/bin/systemctl start poweroff.target - -[Install] -WantedBy=multi-user.target -_EOF_ - G_EXEC ln -s /etc/systemd/system/dietpi-automation.service rootfs/etc/systemd/system/multi-user.target.wants/ + for i in rootfs/usr/lib/systemd/system/*.service + do + grep -q '^ImportCredential=' "$i" || continue + G_EXEC mkdir "${i/usr\/lib/etc}.d" + G_EXEC eval "echo -e '[Service]\nImportCredential=' > ${i/usr\/lib/etc}.d/dietpi-no-ImportCredential.conf" + done fi # Install Go for Gogs @@ -159,9 +150,6 @@ G_EXEC sed --follow-symlinks -i 's|Prompt_on_Failure$|{ journalctl -n 50; ss -tu # Avoid DietPi-Survey uploads to not mess with the statistics G_EXEC rm rootfs/root/.ssh/known_hosts -# ARMv6/7 Trixie: Temporarily prevent dist-upgrade on Trixie, as it fails due to 64-bit time_t transition causing dependency conflicts across the repo. -(( $arch < 3 )) && [[ $DISTRO == 'trixie' ]] && G_EXEC touch rootfs/boot/dietpi/.skip_distro_upgrade - # Automated build cat << _EOF_ > rootfs/boot/Automation_Custom_Script.sh || Error_Exit 'Failed to generate Automation_Custom_Script.sh' #!/bin/dash diff --git a/.build/software/vaultwarden/build.bash b/.build/software/vaultwarden/build.bash index 5948118d08..d9ead499c7 100755 --- a/.build/software/vaultwarden/build.bash +++ b/.build/software/vaultwarden/build.bash @@ -22,7 +22,6 @@ G_DIETPI-NOTIFY 2 'Installing Rust via rustup' grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l' host=('--default-host' 'arm-unknown-linux-gnueabihf') || host=() # - ARMv7: Apply workaround for failing crates index update in in emulated 32-bit ARM environments: https://github.com/rust-lang/cargo/issues/8719. CARGO_REGISTRIES_CRATES_IO_PROTOCOL='sparse' does not solve everything: https://github.com/rust-lang/cargo/issues/8719#issuecomment-1928540617 # - ARMv8: Apply workaround for increased cargo fetch RAM usage: https://github.com/rust-lang/cargo/issues/10583 -# - Trixie: Set missing HOME, since the script runs from a systemd unit without login shell and hence no HOME set. export HOME=$(mktemp -d) CARGO_NET_GIT_FETCH_WITH_CLI='true' G_EXEC cd "$HOME" G_EXEC curl -sSfo rustup-init.sh 'https://sh.rustup.rs' diff --git a/.github/workflows/dietpi-software.bash b/.github/workflows/dietpi-software.bash index 6d330a068e..22f6725a92 100644 --- a/.github/workflows/dietpi-software.bash +++ b/.github/workflows/dietpi-software.bash @@ -355,26 +355,15 @@ G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || { echo "[ INFO ] Unsup # Enable automated setup G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt -# - Workaround for skipped autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 -# - Set HOME path, required e.g. go builds, which is otherwise missing when started from a systemd unit. +# - Workaround for failing systemd services and hence missing autologin in emulated Trixie containers: https://gitlab.com/qemu-project/qemu/-/issues/1962, https://github.com/systemd/systemd/issues/31219 if [[ $DISTRO == 'trixie' ]] && (( $G_HW_ARCH != $arch && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $arch ) )) then - cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service -[Unit] -Description=DietPi-Automation -After=dietpi-postboot.service - -[Service] -Type=idle -StandardOutput=tty -Environment=HOME=/root -ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb; exec /boot/dietpi/dietpi-login' -ExecStop=/usr/bin/systemctl start poweroff.target - -[Install] -WantedBy=multi-user.target -_EOF_ - G_EXEC ln -s /etc/systemd/system/dietpi-automation.service rootfs/etc/systemd/system/multi-user.target.wants/ + for i in rootfs/usr/lib/systemd/system/*.service + do + grep -q '^ImportCredential=' "$i" || continue + G_EXEC mkdir "${i/usr\/lib/etc}.d" + G_EXEC eval "echo -e '[Service]\nImportCredential=' > ${i/usr\/lib/etc}.d/dietpi-no-ImportCredential.conf" + done fi # Workaround for failing IPv4 network connectivity check as GitHub Actions runners do not receive external ICMP echo replies.