Subject: Re: Bug#1080330: coreutils: who no longer works

From: Vincent Lefevre <[email-masked]>
Date: Mon, 17 Feb 2025 00:28:03 +0100

On 2025-02-16 23:56:43 +0100, Chris Hofstaedtler wrote:
> * Michael Stone <[email-masked]> [250216 22:45]:
> > On Sun, Feb 16, 2025 at 07:05:13PM +0100, Vincent Lefevre wrote:
> > > No, w(1) is broken (at least in sid). See the difference between
> > > "who" and "w" with systemd 256.7-1, i.e. before the upgrade of
> > > systemd that removed utmp support:
> > 
> > That's because someone decided to suddenly remove an interface which has
> > been used for decades without any kind of transition plan or replacement.
> 
> Clearly there is a replacement, because the data is there:
> 
>   % w
>   23:53:23 up 1 min,  2 users,  load average: 0.06, 0.03, 0.00
>   USER     TTY      FROM             LOGIN@   IDLE   JCPU PCPU WHAT
>   ch                192.168.64.1     23:53    1:24 0.00s  0.02s sshd-session: ch [priv]
>   ch                -                23:53    1:24 0.00s  0.04s /usr/lib/systemd/systemd --user

No data for xterm. Other terminals are affected too, such as
GNOME Terminal.

>   % loginctl
>   SESSION  UID USER SEAT LEADER CLASS   TTY IDLE SINCE
>   1 1000 ch   -    601    user    -   no   -
>   2 1000 ch   -    606    manager -   no   -
>   
>   2 sessions listed.

On my Debian/unstable machine, I do not even get the same number
of lines as with "w" when mosh is used. No such issue with "who"
and old systemd with utmp enabled.

> But who:
> 
>   % who
>   %
> 
> Chris
> 
> PS: Lack of tty in the list is IIRC some problem with openssh not
> passing the TTY to PAM, but this is a separate thing.

But with old system versions (and/or old "w" versions), such as in
Debian/stable (bookworm), the tty is shown by "w":

joooj:~> w
 00:17:55 up 8 days,  1:40,  4 users,  load average: 0.02, 0.07, 0.04
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
vinc17   pts/0    2a02:8428:1b1d:4 Wed20    1.00s  4.22s  0.03s w
vinc17   pts/4    mosh-            17:29    6:48m  0.97s  0.97s -zsh
vinc17   pts/5    mosh-            Tue19    5days  0.33s  0.33s -zsh
vinc17   pts/6    mosh-            Fri23    2days  0.37s 16.97s mosh-server new

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)