On Thu, Jun 22, 2023 at 10:23:57AM +0200, Peter Krempa wrote: > On Wed, Jun 21, 2023 at 14:32:30 +0100, Daniel P. Berrangé wrote: > > Historically we wanted to check if logind was actually running, not > > merely activatable, because on systems where systemd is installed, > > but the OS is booted into non-systemd init, we want to fallback to > > pm-utils. > > > > Requiring logind to be running, however, forces us to serialize libvirtd > > startup on startup of logind which is undesirable. We can relax this > > dependancy if we check whether systemd itself is running, which implies > > that logind will activated when we need it. > > > > https://gitlab.com/libvirt/libvirt/-/issues/489 > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > > --- > > src/util/virsystemd.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c > > index 3112a1ba80..cd4de0eef8 100644 > > --- a/src/util/virsystemd.c > > +++ b/src/util/virsystemd.c > > @@ -184,9 +184,21 @@ virSystemdHasLogind(void) > > return ret; > > } > > > > + /* > > + * Want to use logind if: > > + * - logind is already running > > + * Or > > + * - logind is not running, but this is a systemd host > > + * (rely on dbus activation) > > + */ > > if ((ret = virGDBusIsServiceRegistered("org.freedesktop.login1")) == -1) > > return ret; > > > > + if (ret == -2) { > > + if ((ret = virGDBusIsServiceRegistered("org.freedesktop.systemd1")) == -1) > > + return ret; > > + } > > Why not simply just check that we are on a systemd host? Can logind be > used without systemd? I believe it can. I recall that when Debian supported a choice between systemd and sysvinit, logind could still be used in the sysvinit scenario in order to support GNOME which had a mandatory dep on logind. So I wasn't comfortable entirely removing the check for logind. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|