From 6df7ca2f61ce1aa8352e8dbb1fc6e9c5d6d42937 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Fri, 8 May 2026 23:46:36 +0200 Subject: T8831: smoketests: irregular PermissionError caused by systemctl stop Failures appear during PPPoEIf.remove() -> flush_addrs() -> set_dhcpv6(False), where disable uses self._cmd(f'systemctl stop ...'), which raises on any non-zero exit code of cmd(). PermissionError: [Errno 1] is misleading: cmd() raises OSError(exit_code, feedback); exit code 1 maps to PermissionError in Python 3, so logs point at "permissions" while the real signal is systemctl stop returned 1 (job failure, timeout, restart contention with Restart=always on dhcp6c@.service. Add a small systemd teardown helper stop_systemd_unit() validating the return codes from the "systemctl stop" calls. --- src/services/vyos-netlinkd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/services/vyos-netlinkd b/src/services/vyos-netlinkd index c759ebd3d..7bf6b8cce 100755 --- a/src/services/vyos-netlinkd +++ b/src/services/vyos-netlinkd @@ -32,6 +32,7 @@ from vyos.utils.commit import commit_in_progress from vyos.utils.dict import dict_search from vyos.utils.process import cmd from vyos.utils.process import is_systemd_service_active +from vyos.utils.process import stop_systemd_unit running = True @@ -62,10 +63,10 @@ def _handle_dhcp_events(operstate: Optional[str], ifname: str) -> None: # Interface moved state to down if is_systemd_service_active(systemdV4_service): syslog.syslog(syslog.LOG_DEBUG, f'Stopping {systemdV4_service}...') - cmd(f'systemctl stop {systemdV4_service}') + stop_systemd_unit(systemdV4_service, raise_on_failure=False) if is_systemd_service_active(systemdV6_service): syslog.syslog(syslog.LOG_DEBUG, f'Stopping {systemdV6_service}...') - cmd(f'systemctl stop {systemdV6_service}') + stop_systemd_unit(systemdV6_service, raise_on_failure=False) elif operstate == 'UP': v6_restart = False -- cgit v1.2.3