From b245e480b93ca262828d69e3daf6487c17d974ac Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:41:57 -0400 Subject: [PATCH] Add autoselected consoles to Grub config Prevents having to pick a bunch, which can break if more than one serial is present for example. Also automates this based on what the installer has/detects as active. --- templates/host-preseed.j2 | 6 ++++++ templates/install.sh | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/templates/host-preseed.j2 b/templates/host-preseed.j2 index 74da833..9dca9a4 100644 --- a/templates/host-preseed.j2 +++ b/templates/host-preseed.j2 @@ -58,6 +58,12 @@ target_keys_path="keys.txt" # Deploy username (usually deploy) target_deploy_user="deploy" +# Consoles to use by the inital boot process; these are normally set automatically +# based on the TTYs found by the installer, and are later overridden by the Ansible +# playbooks based on the hardware configuration. It is best to leave this commented +# unless you know that you need it. +#target_consoles="console=tty1 console=ttyS1,115200" + # Installer checkin URI (provided by pvcbootstrapd) #pvcbootstrapd_checkin_uri="http://10.199.199.254:9999/checkin/installer" pvcbootstrapd_checkin_uri="{pvcbootstrapd_checkin_uri}" diff --git a/templates/install.sh b/templates/install.sh index 2dbd1af..1020671 100755 --- a/templates/install.sh +++ b/templates/install.sh @@ -49,6 +49,17 @@ fi printf "PID $$ on TTY ${this_tty}" > ${lockfile} echo +# Set the target consoles in the installed image +target_consoles="" +for tty in $( echo -e "$( sed 's/ /\n/g' <<<"${active_ttys[@]}" )" | sort ); do + tty_type=${tty%%[0-9]*} + # Only use the first of each console type + if grep -q "${tty_type}" <<<"${target_consoles}"; then + continue + fi + target_consoles="${target_consoles} console=${tty}" +done + iso_name="XXDATEXX" target_deploy_user="XXDEPLOYUSERXX" @@ -851,7 +862,7 @@ cat <&2 GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Parallel Virtual Cluster (PVC) - Debian" -GRUB_CMDLINE_LINUX="console=hvc0 console=tty0 console=tty1 console=ttyS0,115200 console=ttyS1,115200" +GRUB_CMDLINE_LINUX="${target_consoles}" GRUB_TERMINAL_INPUT="console serial" GRUB_TERMINAL_OUTPUT="gfxterm serial" GRUB_SERIAL_COMMAND="serial --unit=0 --unit=1 --speed=115200"