[libvirt PATCH 7/9] util: relax requirement for logind to be running

Andrea Bolognani abologna at redhat.com
Thu Jun 22 14:13:43 UTC 2023


On Thu, Jun 22, 2023 at 09:49:41AM +0100, Daniel P. Berrangé wrote:
> 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:
> > > +    /*
> > > +     * 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.

Yeah, there's an alternative/hacked implementation called elogind
which can be used without systemd. On a Debian VM configured to use
the classic sysvinit, for example, I get

  $ dbus-send --system --print-reply --dest=org.freedesktop.DBus
/org/freedesktop/DBus org.freedesktop.DBus.ListNames
  method return time=1687442871.393925 sender=org.freedesktop.DBus ->
destination=:1.4 serial=3 reply_serial=2
     array [
        string "org.freedesktop.DBus"
        string "org.freedesktop.login1"
        string ":1.4"
        string ":1.0"
        string ":1.1"
     ]

Now the interesting question is whether we will (and should) run any
of the code in the virsystemd module on such a machine...

-- 
Andrea Bolognani / Red Hat / Virtualization



More information about the libvir-list mailing list