summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-05-11 17:45:51 +0200
committerChristian Breunig <christian@breunig.cc>2026-05-12 16:28:58 +0200
commit7396eeadc74c026b84d615f1e92952af98d4b241 (patch)
treea115f69d9d107ff669d8047c7b23aa77713f5add /data
parentfbd704281e46668387d2201ba696091b97343a3a (diff)
downloadvyos-build-7396eeadc74c026b84d615f1e92952af98d4b241.tar.gz
vyos-build-7396eeadc74c026b84d615f1e92952af98d4b241.zip
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.
Diffstat (limited to 'data')
-rw-r--r--data/live-build-config/hooks/live/95-serial.chroot14
1 files changed, 10 insertions, 4 deletions
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