From ae5df0f6d6055fa6477f1150aaca662cb8aef9d3 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 9 Sep 2026 19:28:56 +0000 Subject: system-option: T9269: do not call localectl(1) and udevadm(8) in a container localectl(1) needs systemd-localed on D-Bus, which a container has none of - it fails with "Access denied". As cmdl() defaults to expect=[0] the exception aborted the script, and vyos-router reported "could not reset system option files ... failed!". The udevadm(8) rule reload right after it fails for the same reason, a container has no systemd-udevd of its own. Guard both. --- src/conf_mode/system_option.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/conf_mode/system_option.py b/src/conf_mode/system_option.py index 6e7ced37a..47ea9fa96 100755 --- a/src/conf_mode/system_option.py +++ b/src/conf_mode/system_option.py @@ -599,11 +599,12 @@ def generate_cmdline_for_kexec(options): def apply(options): + running_as_container = image.is_running_as_container() kexec_required, cmdline_new = generate_cmdline_for_kexec(options) # T9269: a container does not own the Kernel cmdline - it belongs to the # host system, thus neither kexec nor a reboot would apply anything and the # options always compare as changed - if image.is_running_as_container(): + if running_as_container: kexec_required = False if kexec_required: if not boot_configuration_complete() and os.getenv('VYOS_CONFIGD'): @@ -681,12 +682,16 @@ def apply(options): cmdl(['systemctl', 'disable', 'root-partition-auto-resize.service']) # Time format 12|24-hour - if 'time_format' in options: + # A container has no systemd-localed to talk to - localectl(1) fails with + # "Access denied" and would abort this script, so skip it entirely + if 'time_format' in options and not running_as_container: time_format = time_format_to_locale.get(options['time_format']) cmdl(['localectl', 'set-locale', f'LC_TIME={time_format}']) - # Reload UDEV, required for USB auto suspend - cmdl(['udevadm', 'control', '--reload-rules']) + # Reload UDEV, required for USB auto suspend - a container shares the + # host's udev(7) instance and has no systemd-udevd of its own + if not running_as_container: + cmdl(['udevadm', 'control', '--reload-rules']) # Enable/disable dynamic debugging for kernel modules modules = ['wireguard'] -- cgit v1.2.3