Skip to content

w doesn't show correct idle time for X/Wayland sessions

From Debian bug #1088934:

The "idle time" information output by "w" (in the IDLE column) is incorrect. It is a common, arbitrary value for all entries, which
does not seem to be related to any idle time. It can be something like "2days" or "7days", and can be reset for an unknown reason.

This can be tested with "ssh localhost" (or a ssh from another machine), then "w".

w finds the idle time by first getting the tty the user is connected to and then working out the difference between the access time of the tty to the current time. That method has worked for many, many years but something somewhere has changed.

e.g. for a session that is currently active on the 3rd December (11 days after 22 November)

$ w
 20:31:51 up 11 days, 13:18,  1 user,  load average: 0.18, 0.16, 0.10
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
csmall   tty2      22Nov24 11days  0.04s  0.02s /usr/libexec/gnome-session-binary
$ stat -c %x /dev/tty2
2024-11-22 07:13:30.523999965 +1100