From eb09b4b5466ced71186342ec0a8a5ac0a1ea7c3f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 6 Jun 2025 19:50:34 +0900 Subject: [PATCH] run: ignore bus connection error in acquiring invocation ID Similar to 2b983b43c6e4a0dc9d58671eaf2f508a8ce8e3b9, but for acquiring invocation ID. Fixes #37675. --- src/run/run.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/run/run.c b/src/run/run.c index 02c3d8a8e82..ab620bb5cd1 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -2063,8 +2063,18 @@ static int acquire_invocation_id(sd_bus *bus, const char *unit, sd_id128_t *ret) &error, &reply, "ay"); - if (r < 0) + if (r < 0) { + /* Let's ignore connection errors. This might be caused by that the service manager is being + * restarted. Handle this gracefully. */ + if (bus_error_is_connection(&error) || bus_error_is_unknown_service(&error)) { + log_debug_errno(r, "Invocation ID request failed due to bus connection problems, ignoring: %s", + bus_error_message(&error, r)); + *ret = SD_ID128_NULL; + return 0; + } + return log_error_errno(r, "Failed to request invocation ID for unit: %s", bus_error_message(&error, r)); + } r = bus_message_read_id128(reply, ret); if (r < 0) -- 2.47.3