Make D-Bus and udisks2 available early (#1291)

* Disable systemd-logind support for udisks2

Currently udisks2 uses systemd-logind to prevent the system from
rebooting or similar operations while udisks operations are ongoing.
Unfortunately this stops us from using udisks2 during early boot since
systemd-logind is not ready at this point. Make the dependency
configureable so we can opt-out of using systemd-logind.

* Make dbus.service/socket and udisks2.service/socket available early

Disable default dependencies. This avoids those services to be ordered
after sysinit.target, and makes them available before local-fs.target
is reached. All mounts like mnt-data.mount are ordered before
local-fs.target, so breaking this dependency allows to use D-Bus before
mounting local file systems.

This seems fine when using the system bus directly from /run (instead of
/var/run, which is anyway a symlink to /run normally). It seems that
udisks misses /var/lib/udisks2 but it seems not to be required for the
features used so far.
This commit is contained in:
Stefan Agner 2021-03-31 21:46:02 +02:00 committed by GitHub
parent 905aa21e8c
commit 82db02756c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From a00ce68f8b08abb925bf22c0c46858958dd93866 Mon Sep 17 00:00:00 2001
Message-Id: <a00ce68f8b08abb925bf22c0c46858958dd93866.1616668703.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 25 Mar 2021 11:35:12 +0100
Subject: [PATCH] Allow to explicitly disable libsystemd-login
Currently libsystemd-login is used to inhibit poweroff, sleep and
reboot. The library makes calls to systemd-logind which in turn needs
quite some services to be present. This can be problematic when using
udisks in early boot stages.
---
configure.ac | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 53917998..0b3f0c9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,16 +197,21 @@ if test "x$enable_daemon" = "xyes"; then
[AC_DEFINE([UUID_STR_LEN], 37, [compat UUID_STR_LEN define])],
[[#include <uuid/uuid.h>]])
- PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd >= 209], [have_libsystemd_login=yes],
- [PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd-login >= 44 libsystemd-daemon],
- [have_libsystemd_login=yes],
- [have_libsystemd_login=no])])
- if test "x$have_libsystemd_login" = "xyes"; then
- AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available])
+ have_libsystemd_login=no
+ AC_ARG_ENABLE(libsystemd-login, AS_HELP_STRING([--disable-libsystemd-login], [disable libsystemd-login support]))
+ if test "x$enable_libsystemd_login" != "xno"; then
+ PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd >= 209], [have_libsystemd_login=yes],
+ [PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd-login >= 44 libsystemd-daemon],
+ [have_libsystemd_login=yes],
+ [have_libsystemd_login=no])])
+ if test "x$have_libsystemd_login" = "xyes"; then
+ AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available])
+ fi
+ AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
+ AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
fi
+ AM_CONDITIONAL([HAVE_LIBSYSTEMD_LOGIN], [test "x$have_libsystemd_login" = "xyes"])
AC_SUBST(HAVE_LIBSYSTEMD_LOGIN)
- AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
- AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
PKG_CHECK_MODULES(LIBELOGIND, [libelogind >= 219],
[have_libelogind=yes],
--
2.30.2

View File

@ -25,7 +25,7 @@ UDISKS2_DEPENDENCIES = \
parted \ parted \
udev udev
UDISKS2_CONF_OPTS = --disable-polkit --disable-man UDISKS2_CONF_OPTS = --disable-polkit --disable-man --disable-libsystemd-login
ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y) ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
UDISKS2_CONF_OPTS += --enable-introspection UDISKS2_CONF_OPTS += --enable-introspection

View File

@ -0,0 +1,2 @@
[Unit]
DefaultDependencies=no

View File

@ -0,0 +1,2 @@
[Unit]
DefaultDependencies=no

View File

@ -0,0 +1,5 @@
[Unit]
DefaultDependencies=no
[Service]
Environment="DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket"

View File

@ -0,0 +1,2 @@
[Unit]
DefaultDependencies=no