&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)