[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: utmp in trixie



Hi Michael and Craig,

On Fri, Dec 05, 2025 at 06:28:56PM +1100, Craig Small wrote:
>    On Wed, 3 Dec 2025 at 18:55, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 
>      Now, it looks like I should review the code in sshd and find out why
>      the utmp records it makes are being disliked by w/who.  Or it is
>      w/who who are wrong here, I dunno yet.  Either way, this feels wrong
>      somehow.
> 
>    w will read utmp using getutent() if sd_booted() is false or
>    sd_get_sessions() returns 0.
>    So check to see what you get for those library calls.
>    You might also be hitting #1108549 [1]  (the second issue, not the crash
>    issue) fixed at [2].
>    This is because the information is being held by elogind but it always
>    returns false for sd_booted()

Ah yes, that would explain Michael's symptoms.

The pseudocode for my final patch that you took for #1108549 is as
follows:

  if sd_get_sessions()
    < 0 && != ENOENT: error
    > 0 || sd_booted(): show sessions
    default: fallback to utmp

I don't think there would be any harm to removing "|| sd_booted()",
which should achieve what Michael wants, but I didn't do that when I
proposed the patch to avoid risk of regression for the existing working
paths in the trixie hard freeze, thinking systemd users would be happy
without no change of behaviour for them but a further change is needed
to help the ultra minimal case of systemd without libpam-systemd!

>    However I noted you said you made an empty utmp file so it might be that
>    nothing is updating it.

I think Michael created the empty file because applications know not to
populate it unless it already exists but that it is now populated with
entries from sshd.

>     - Craig
>    1: https://bugs.debian.org/1108549
>    2:
>    https://gitlab.com/procps-ng/procps/-/commit/678b099c9fd12109469be234281c8b4e2a382757


Reply to: