From 225e66fea95889cc02141755e19122885f75fc73 Mon Sep 17 00:00:00 2001 From: Semyon Maryasin Date: Thu, 27 Aug 2026 05:11:31 +0300 Subject: [PATCH] service: don't SIGTERM the QMI/MBIM proxies together with the daemon The qmi-proxy/mbim-proxy processes spawned by the daemon live in the service's cgroup, so with the default KillMode=control-group systemd sends SIGTERM to them at the same time as to the daemon on every unit stop. The proxy exits immediately, tearing the control channel from under the daemon while it is still disabling the modems: caught signal, shutting down... [modem0] state changed (connected -> disabling) [modem0] port 'cdc-wdm0' no longer controllable, reprobing [/dev/cdc-wdm0] MBIM error: Device must be open to send commands shutdown failed: timeout waiting for sleep preparation to complete The consequences of losing the proxy mid-shutdown: - the modem disable/disconnect never reaches the device, so an MBIM session with an active bearer is left open in the firmware (observed to occasionally wedge the MBIM function of a Sierra EM7565 until a firmware reset); - the port teardown stalls waiting on the dead proxy until the shutdown timeout, so stopping the unit always takes the full MAX_SHUTDOWN_TIME_SECS instead of a second or two; - the port invalidation triggers the device reprobe path in the middle of the shutdown. With KillMode=mixed only the daemon receives SIGTERM; the proxies survive long enough for a clean disconnect and MBIM/QMI close, and whatever remains in the cgroup afterwards (an idle, stateless proxy) is killed when the unit finally stops. Signed-off-by: Semyon Maryasin --- data/ModemManager.service.in | 1 + 1 file changed, 1 insertion(+) diff --git a/data/ModemManager.service.in b/data/ModemManager.service.in index 4e4472d9..0bd23053 100644 --- a/data/ModemManager.service.in +++ b/data/ModemManager.service.in @@ -10,6 +10,7 @@ BusName=org.freedesktop.ModemManager1 ExecStart=@sbindir@/ModemManager StandardError=null Restart=on-abort +KillMode=mixed CapabilityBoundingSet=CAP_SYS_ADMIN CAP_NET_ADMIN ProtectSystem=true ProtectHome=true