Subject: Re: bug#878: loginctl[2676]: Failed to connect to bus: No such file or directory

From: Lorenzo <[email-masked]>
Date: Mon, 17 Mar 2025 01:10:57 +0100

On Sun, 16 Mar 2025 21:17:20 +0000
Andrew Bower <[email-masked]> wrote:

> On Sun, Mar 16, 2025 at 07:19:10PM +0000, Mark Hindley wrote:
> > On Sun, Mar 16, 2025 at 09:22:13AM +0000, Andrew Bower wrote:
> > > > > I see this reported through syslog at the error level:
> > > > > 
> > > > >   loginctl[2676]: Failed to connect to bus: No such file or
> > > > > directory
> > > > 
> > > > Is this every time or only the first time?
> > > 
> > > Once on startup. I've not noticed any functional degradation.
> > 
> > So where is that loginctl call coming from? It looks like it
> > happens *before* the system dbus is started.
> 
> I suspect it's the elogind check script (/etc/sv/elogind/check). Let's
> bring in Lorenzo.

very likely; since dbus, elogind and login managers are started at the
same time, I'd expect elogind check at least to fail once at boot.

> I cannot reproduce this on Debian/runit.
Humm, I'd expect this on Debian too, but it's a race so it could be
intermittent

cat /etc/service/elogind/check 
#!/bin/sh

# race: greyed buttons on lightdm/sddm
# make sure that elogind can see the login and that will open a session for the user
loginctl show-seat seat0 >/dev/null && exit 0
exit 1

I guess I should silence stderr instead of stdout (or both)?
Anyway, unless I'm missing something, it's a minor bug in
runit-services.

Best,
Lorenzo