From c5e3e7494350fad09d687d81e7da332c5b46bac5 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 26 Aug 2026 19:09:10 -0500 Subject: T9244: fix regression in setting console type on install The introduction of util get_kernel_boot_arg() has many uses, however, it is not appropriate for use in get_kernel_serial_console: since it searches right to left, it picks up an incorrect and incomplete entry; consequently get_kernel_serial_console returns a None tuple, which voids selection of console type on install. Restore original implementation of get_kernel_serial_console. --- python/vyos/utils/kernel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/vyos/utils/kernel.py b/python/vyos/utils/kernel.py index 72c7413cf..69574cefc 100644 --- a/python/vyos/utils/kernel.py +++ b/python/vyos/utils/kernel.py @@ -165,13 +165,14 @@ def get_kernel_serial_console() -> Tuple[Optional[str], Optional[str], Optional[ command line which was used during system boot. """ import re + from vyos.utils.file import read_file cmdline_console_re = re.compile( - r'(?Ptty(?:S|AMA))(?P\d+),(?P\d+)' + r'(?:^|\s)console=(?Ptty(?:S|AMA))(?P\d+),(?P\d+)(?=\s|$)' ) - console_value = get_kernel_boot_arg('console') or '' - if m := cmdline_console_re.search(console_value): + kernel_cmdline = read_file('/proc/cmdline') + if m := cmdline_console_re.search(kernel_cmdline): return ( m.group('console_type'), m.group('console_num'), -- cgit v1.2.3