Serielle Konsole fuer Proxmox-Testumgebung: GRUB dauerhaft, Installer-Phase nur im Lokal-Test-Build

Golden Image bekommt permanent GRUB_TERMINAL=serial (harmlos ohne
seriellen Port, Voraussetzung fuer qm-terminal-Verifikation ohne
Passwort-Reset-Umweg). Die tty1-gebundene Installer-Phase wird nur bei
--local-test-anode-url auf ttyS0 umgebogen, ueber einen Trap immer wieder
auf den Produktivstand zurueckgesetzt, damit ein Produktiv-Build nie
versehentlich die Testvariante ausliefert.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWKevK2QUK5tsGmqfSD6Yy
This commit is contained in:
adminandClaude Sonnet 5 committed 2026-09-21 11:55:44 +02:00
1 parent 7e21f45fb7
commit 23edd3a6db
2 files changed
+33 -1

No files matched your search

+21 -1
View File
@@ -91,8 +91,18 @@ BOOT_MEDIUM_DIR="${REPO_DIR}/boot-medium"
DEV_MARKER="${BOOT_MEDIUM_DIR}/config/includes.chroot/etc/tuxflotte-dev-build"
LOCAL_TEST_OVERRIDE_CONF="${BOOT_MEDIUM_DIR}/config/includes.chroot/opt/tuxflotte/config/local_test_override.conf"
GOLDEN_IMAGE_EMBED_DIR="${BOOT_MEDIUM_DIR}/config/includes.binary/opt/tuxflotte/golden-images"
INSTALLER_SERVICE_FILE="${BOOT_MEDIUM_DIR}/config/includes.chroot/etc/systemd/system/tuxflotte-installer.service"
OUTPUT_ISO_NAME="live-image-amd64.hybrid.iso"
# tuxflotte-installer.service ist eine versionierte Datei (nicht wie
# LOCAL_TEST_OVERRIDE_CONF ein Build-Artefakt) - ein Lokal-Test-Build sed't
# sie unten fuer die serielle Konsole um. Trap stellt sicher, dass der
# Produktiv-Stand (TTYPath=/dev/tty1) danach IMMER wiederhergestellt ist,
# auch bei Abbruch/Fehler - sonst wuerde ein spaeterer Produktiv-Build ohne
# --local-test-anode-url versehentlich die Lokal-Test-Variante ausliefern.
trap 'git -C "${REPO_DIR}" checkout -- "${INSTALLER_SERVICE_FILE}" 2>/dev/null || true' EXIT
git -C "${REPO_DIR}" checkout -- "${INSTALLER_SERVICE_FILE}"
[[ -d "${BOOT_MEDIUM_DIR}/config" ]] ||
{ echo "Error: ${BOOT_MEDIUM_DIR}/config fehlt - lb config wurde noch nie ausgefuehrt." >&2; exit 1; }
@@ -139,6 +149,16 @@ if [[ -n "${LOCAL_TEST_ANODE_URL}" ]]; then
printf 'export TUXFLOTTE_ANODE_URL=%q\n' "${LOCAL_TEST_ANODE_URL}"
} > "${LOCAL_TEST_OVERRIDE_CONF}"
OUTPUT_ISO_NAME="live-image-amd64-local-test.hybrid.iso"
# Installer-Phase (tty1-gebunden im Produktivpfad, siehe Kopfkommentar
# der Unit-Datei) NUR fuer Lokal-Test-Builds auf die serielle Konsole
# umbiegen - Voraussetzung fuer die neue Proxmox-Testumgebung (VM 107,
# serial0-Geraet), Produktivpfad bleibt exakt auf tty1.
sed -i \
-e 's/^Conflicts=getty@tty1\.service$/Conflicts=serial-getty@ttyS0.service/' \
-e 's/^After=getty@tty1\.service NetworkManager\.service$/After=serial-getty@ttyS0.service NetworkManager.service/' \
-e 's#^TTYPath=/dev/tty1$#TTYPath=/dev/ttyS0#' \
"${INSTALLER_SERVICE_FILE}"
else
rm -f "${LOCAL_TEST_OVERRIDE_CONF}"
fi
@@ -167,7 +187,7 @@ lb config \
--binary-images iso-hybrid \
--bootloaders "grub-efi,syslinux" \
--debian-installer none \
--bootappend-live "boot=live components toram quiet splash vconsole.keymap=de"
--bootappend-live "boot=live components toram quiet splash vconsole.keymap=de console=ttyS0,115200n8 console=tty0"
echo "==> lb build"
lb build
+12
View File
@@ -709,6 +709,18 @@ image_deploy_install_bootloader() {
{ image_deploy_fatal "grub-install (BIOS) fehlgeschlagen"; return 1; }
fi
# Serielle GRUB-Konsole dauerhaft aktivieren - auf Hardware ohne
# seriellen Port folgenlos, aber Voraussetzung fuer Post-Install-
# Verifikation ueber `qm terminal`/serielle Konsole ohne Passwort-
# Reset-Umweg (siehe platform-docs/roadmap/proxmox-testumgebung-e2e.md).
sed -i '/^GRUB_TERMINAL=/d;/^GRUB_SERIAL_COMMAND=/d' "${target}/etc/default/grub"
{
echo 'GRUB_TERMINAL="console serial"'
echo 'GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"'
} >> "${target}/etc/default/grub"
sed -i -E 's/^GRUB_CMDLINE_LINUX="([^"]*)"/GRUB_CMDLINE_LINUX="\1 console=ttyS0,115200n8 console=tty0"/' \
"${target}/etc/default/grub"
chroot "${target}" update-grub ||
{ image_deploy_fatal "update-grub fehlgeschlagen"; return 1; }
}