summaryrefslogtreecommitdiff
path: root/src/migration-scripts/system
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-09-09 20:30:01 +0200
committerGitHub <noreply@github.com>2026-09-09 20:30:01 +0200
commitebf07da2891a949237a54c6ce153a8772b342413 (patch)
tree2a09a2a8ec423337743b875c0a0188c98fa07e9d /src/migration-scripts/system
parent07ef62cb55c6b69c639f70fb423d2c6fb9fdbd09 (diff)
parenta4ca1e5979fe9c795e1ca210dd881f611d7fef21 (diff)
downloadvyos-1x-ebf07da2891a949237a54c6ce153a8772b342413.tar.gz
vyos-1x-ebf07da2891a949237a54c6ce153a8772b342413.zip
Merge pull request #5449 from c-po/arm64-configtests
smoketest: T9014: make configtest serial console image flavor agnostic
Diffstat (limited to 'src/migration-scripts/system')
-rw-r--r--src/migration-scripts/system/31-to-3219
1 files changed, 15 insertions, 4 deletions
diff --git a/src/migration-scripts/system/31-to-32 b/src/migration-scripts/system/31-to-32
index b68dab34f..e92473835 100644
--- a/src/migration-scripts/system/31-to-32
+++ b/src/migration-scripts/system/31-to-32
@@ -16,23 +16,34 @@
# Serial
from vyos.configtree import ConfigTree
+from vyos.flavor import get_image_serial_console
from vyos.system import disk
from vyos.system.grub import CFG_VYOS_VARS
from vyos.system.grub import vars_read
-serial_console = 'ttyS0'
base = ['system', 'console']
def migrate(config: ConfigTree) -> None:
if not config.exists(base):
return
+ # The serial console device is defined by the image flavor - amd64 uses the
+ # 8250 UART at ttyS0 while arm64 systems expose the PL011 UART as ttyAMA0
+ console_type, console_num, _ = get_image_serial_console()
+ if not console_type:
+ # image flavor carries no serial console data, assume 8250 UART
+ console_type, console_num = 'ttyS', '0'
+ serial_console = f'{console_type}{console_num}'
+
root_dir = disk.find_persistence()
vars_file: str = f'{root_dir}/{CFG_VYOS_VARS}'
vars_current: dict[str, str] = vars_read(vars_file)
+ # A system without persistent GRUB storage - like VyOS running inside a
+ # container - has no boot console we could detect
+ if not vars_current:
+ return
+
# Check if VyOS installation uses serial boot console
- if vars_current['console_type'] == 'ttyS':
- # In the past we only supported ttyS0 as boot console, that's why we
- # can hardcode it ...
+ if vars_current['console_type'] == console_type:
if config.exists(base + ['device', serial_console]):
config.set(base + ['device', serial_console, 'kernel'])