From 7396eeadc74c026b84d615f1e92952af98d4b241 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 11 May 2026 17:45:51 +0200 Subject: serial: T8844: fix default config injection leading to invalid boot console With all the latest serial interface changes - and the resulting patching of the default configuration based on the build flavor - the serial console was always injected by a helper named write-config-file-value.py, even if the console_type was set to tty instead of ttyS or ttyAMA. This was a pending issue in the rolling tests for the PROXMOX flavor. It is applicable to every other flavor using tty as default console. --- data/live-build-config/hooks/live/95-serial.chroot | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'data') diff --git a/data/live-build-config/hooks/live/95-serial.chroot b/data/live-build-config/hooks/live/95-serial.chroot index 1bcaa963..9980bae7 100644 --- a/data/live-build-config/hooks/live/95-serial.chroot +++ b/data/live-build-config/hooks/live/95-serial.chroot @@ -2,22 +2,28 @@ # We do have different default console configurations per flavor used. We will # set the serial console to the default configuration for the flavor. -WRITE_CONFIG="/usr/libexec/vyos/write-config-file-value.py" +WRITE_CONFIG=$(python3 -c 'from vyos.defaults import base_dir; print(f"{base_dir}/write-config-file-value.py")') if ! test -x $WRITE_CONFIG; then echo "E: missing script to implant serial config settings" exit 1 fi default_config_file=$(python3 -c 'from vyos.defaults import config_default; print(config_default)') -device=$(jq -r '"\(.console_type)\(.console_num)"' /usr/share/vyos/flavor.json) -speed=$(jq -r '.console_speed' /usr/share/vyos/flavor.json) +flavor_file=$(python3 -c 'from vyos.defaults import directories; print(directories["data"] + "flavor.json" )') +console_type=$(jq -r '.console_type' $flavor_file) +device=$(jq -r '"\(.console_type)\(.console_num)"' $flavor_file) +speed=$(jq -r '.console_speed' $flavor_file) -if [ -n "$device" ] && [ -n "$speed" ] && [ -f $default_config_file ]; then +# Serial console settings apply only to hardware serial (x86) or UART (ARM). +if [ "$console_type" != ttyS ] && [ "$console_type" != ttyAMA ]; then + echo "I: Skipping serial console implant (console_type=$console_type is not ttyS or ttyAMA)" +elif [ -n "$device" ] && [ -n "$speed" ] && [ -f $default_config_file ]; then $WRITE_CONFIG --path "system console device $device speed" \ --value "$speed" \ --config-file $default_config_file $WRITE_CONFIG --path "system console device $device kernel" \ --config-file $default_config_file + echo "I: Changed serial console settings in: $default_config_file to $device,$speed" else echo "E: Could not implant serial console settings in: $default_config_file" exit 1 -- cgit v1.2.3