From fa7c249d3954255544b2702f60180fe0decdde23 Mon Sep 17 00:00:00 2001 From: Marketen Date: Mon, 31 Aug 2026 13:36:24 +0200 Subject: [PATCH] fix: prevent console-setup from blocking first boot --- scripts/dappnode_install.sh | 4 +++- scripts/dappnode_install_pre.sh | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/dappnode_install.sh b/scripts/dappnode_install.sh index 49ecf3f2..b9519bc1 100755 --- a/scripts/dappnode_install.sh +++ b/scripts/dappnode_install.sh @@ -1198,7 +1198,9 @@ main() { # Run test in interactive terminal (first boot only) if [ -f "${DAPPNODE_DIR}/.firstboot" ]; then apt-get update - apt-get install -y kbd + # A package upgrade may leave console-setup pending configuration. + # Never let debconf open a hidden prompt while rc.local owns tty1. + DEBIAN_FRONTEND=noninteractive apt-get install -y kbd openvt -s -w -- sudo -u root "${DAPPNODE_DIR}/scripts/dappnode_test_install.sh" exit 0 fi diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh index d6cf4739..84ee41b5 100755 --- a/scripts/dappnode_install_pre.sh +++ b/scripts/dappnode_install_pre.sh @@ -2,6 +2,10 @@ # Execute script with flag UPDATE to update the host: ./dappnode_install_pre.sh UPDATE +# This script also runs from unattended ISO late-commands, where debconf has no +# terminal on which it can safely ask package-configuration questions. +export DEBIAN_FRONTEND=noninteractive + DAPPNODE_DIR="/usr/src/dappnode" LOGS_DIR="$DAPPNODE_DIR/logs" lsb_dist="$(. /etc/os-release && echo "$ID")" @@ -105,8 +109,10 @@ install_iptables() { # HOST UPDATE host_update() { - apt-get update 2>&1 | tee -a $LOG_FILE - apt-get -y upgrade 2>&1 | tee -a $LOG_FILE + # Process substitution keeps apt-get's exit status while still logging its + # output. A regular pipeline would return tee's status and hide dpkg errors. + apt-get update > >(tee -a "$LOG_FILE") 2>&1 || return $? + apt-get -y upgrade > >(tee -a "$LOG_FILE") 2>&1 } check_ubuntu_connectivity() { @@ -152,7 +158,10 @@ touch $LOG_FILE # Only update && upgrade host if needed if [ "$1" == "UPDATE" ]; then echo -e "\e[32m \n\n Updating && upgrading host \n\n \e[0m" 2>&1 | tee -a $LOG_FILE - host_update 2>&1 | tee -a $LOG_FILE + if ! host_update; then + echo -e "\e[31m \n\n ERROR: host update failed \n\n \e[0m" 2>&1 | tee -a "$LOG_FILE" + exit 1 + fi fi if find /etc/apt/ -name "*.list" -print0 | xargs --null cat | grep -q "https://download.docker.com/linux/$lsb_dist"; then