On 2026-05-07 21:20:01 +1000, Craig Small wrote:
> I use Gnome terminal myself, so it works fine for me.

To be clear, the time given by "w -t" for GNOME Terminal is the
expected one, i.e. the start time of GNOME Terminal.

But for the other terminals, I get the start time of the systemd
login session, even though the start time of the terminals is
available, as given by ps (the inode change time of the tty file
also seems to give it, possibly with a difference of one second,
but if the user does a chmod on it, the value changes, so that
it is not reliable).

> This method is used if there is no systemd session, as you've
> noticed there isn't one for the terminal.

Actually there is a systemd login session for GNOME Terminal.
It is just that the process does not appear.

BTW, according to

  
https://github.com/systemd/systemd/commit/bdb07fa5aca84cf6d092607e0e9d42f4bfeaa200

the value of $XDG_SESSION_ID should override the actual session
of the process (which may not be meaningful).

> So... why is the tty switch trick not working for your terminals?

I don't know. I suspect that w tries to get session information from
systemd-logind, and that the output is correct only for GNOME Terminal
just because of the particular settings concerning GNOME Terminal and
that w thinks that the terminal does not have an associated login
session. But w should not do that anyway. In terminal mode, the start
time should always by the value given in the processus table.

-- 
Vincent Lefèvre <[email protected]> - 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)

Reply via email to