summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-09-09 19:28:56 +0000
committerChristian Breunig <christian@breunig.cc>2026-09-09 19:28:56 +0000
commitae5df0f6d6055fa6477f1150aaca662cb8aef9d3 (patch)
tree1a07974336eee7489b2ba8cfca3db90d698fad66 /src
parentebf07da2891a949237a54c6ce153a8772b342413 (diff)
downloadvyos-1x-ae5df0f6d6055fa6477f1150aaca662cb8aef9d3.tar.gz
vyos-1x-ae5df0f6d6055fa6477f1150aaca662cb8aef9d3.zip
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system_option.py13
1 files changed, 9 insertions, 4 deletions
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']