923a60
From d46ca2a3ed881bc9324ebd9da0a66af1133d43a7 Mon Sep 17 00:00:00 2001
923a60
From: Michal Sekletar <msekletar@users.noreply.github.com>
923a60
Date: Wed, 1 Nov 2017 02:25:48 -0700
923a60
Subject: [PATCH] manager: fix connecting to bus when dbus is actually around
923a60
 (#7205)
923a60
923a60
manager_connect_bus() is called *before* manager_coldplug(). As a last
923a60
thing in service_coldplug() we set service state to
923a60
s->deserialized_state, and thus before we do that all services are
923a60
inactive and try_connect always evaluates to false. To fix that we must
923a60
look at deserialized state instead of current unit state.
923a60
923a60
Fixes #7146
923a60
923a60
(cherry picked from commit 41dfa61d35c51a584437481d20541d5c3ccfa93d)
923a60
923a60
Related: #1465737
923a60
---
923a60
 src/core/manager.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/core/manager.c b/src/core/manager.c
923a60
index 041fac46be..47b09e1e93 100644
923a60
--- a/src/core/manager.c
923a60
+++ b/src/core/manager.c
923a60
@@ -809,7 +809,7 @@ static int manager_connect_bus(Manager *m, bool reexecuting) {
923a60
         u = manager_get_unit(m, SPECIAL_DBUS_SERVICE);
923a60
 
923a60
         try_bus_connect =
923a60
-                (u && UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) &&
923a60
+                (u && SERVICE(u)->deserialized_state == SERVICE_RUNNING) &&
923a60
                 (reexecuting ||
923a60
                 (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")));
923a60