]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: skip checking inhibitors when dbus.service is not running
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 29 Nov 2024 17:52:01 +0000 (02:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 Dec 2024 05:00:55 +0000 (14:00 +0900)
Fixes a bug introduced by 804874d26ac73e0af07c4c5d7165c95372f03f6d.

Fixes #35416.

src/systemctl/systemctl-logind.c

index fc64e60c64b9b2233ba49de9086d52db2bf2de25..1258852a0167cd467cbd91276dc76d188882d5dd 100644 (file)
@@ -152,6 +152,9 @@ int logind_check_inhibitors(enum action a) {
                 return 0;
 
         r = acquire_bus(BUS_FULL, &bus);
+        if (r == -ECONNREFUSED && geteuid() == 0)
+                return 0; /* When D-Bus is not running, allow root to force a shutdown. E.g. when running at
+                           * the emergency console. */
         if (r < 0)
                 return r;