From a1417e5563acb73a0accdc12b3af91e4ec1c7f46 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 30 Nov 2024 02:52:01 +0900 Subject: [PATCH] systemctl: skip checking inhibitors when dbus.service is not running Fixes a bug introduced by 804874d26ac73e0af07c4c5d7165c95372f03f6d. Fixes #35416. --- src/systemctl/systemctl-logind.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/systemctl/systemctl-logind.c b/src/systemctl/systemctl-logind.c index fc64e60c64..1258852a01 100644 --- a/src/systemctl/systemctl-logind.c +++ b/src/systemctl/systemctl-logind.c @@ -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;