Linux "who" command does not (always) work

I have two machines with opensuse 42.3.

On one machine (say hostname1), the “who” command does what it is expected to do: list users

hostname1:/home/jan9> who
jan9      pts/0        2017-08-05 15:42 (:0)
jan9      pts/1        2017-08-05 15:42 (:0)
jan9      pts/2        2017-08-05 15:42 (:0)

On my other machine, “who” does not generate a list of users. It also doesn’t make an entry in wtmp or with “last”.
It only does this if I logon on the console, then I get

hostname2:/home/jan9> who
jan9      tty1        2017-08-05 16:00

Also, if I do an ssh from hostname1 to hostname2, on hostname2 this can be seen using “who”.


hostname2:/home/jan9> who
jan9      pts/4        2017-08-05 16:14 (192.168.XXX.YYY)

Again, on hostname1 (also opensuse 42.3) this works as expected.

Any hints?
Thanks a lot.

There’s an open bug report on this – Bug 102127

It’s hard to say whether this is a bug or a feature.

This does not happen if you use “gdm” or “lightdm” or “kdm” to login. It only happens with “sddm”, as far as I know.

O a, using “gdm” for my login. Currently, I am seeing:


rickert  console      2017-08-03 21:58 (:0)
rickert  :0           2017-08-03 21:58 (:0)
rickert  pts/0        2017-08-03 21:58 (:0)
rickert  pts/1        2017-08-03 21:58 (:0)

I believe that the first two of those were added by “gdm”. The third entry was added because I am using “yakuake” which I have starting automatically when I login. And the last entry is because I am running an “xterm” at present (I ran the “who” command from that “xterm”).

I do not know if this has been reported upstream (to “kde.org”).

If it bothers you, then the easy workarounds are:

  • run “yakuake” in your KDE session (you may need to install it first);
  • switch to using “lightdm” (you may have to install that first);
  • switch to using “kdm” for login (you make need to install that first).

I should have clarified a little.

This is not a problem with the “who” command. That command is supposed to list the entries in the “utmp” database ("/run/utmp"). And it does that. The problem is that “sddm” is not writing an entry to “utmp”.

As far as I know, “utmp” is mainly used by the “wall” command, to send a message to all users. When the “utmp” entry is written by “xterm” or “console” or “yakuake”, I see that message show up (in my case it is usually a message from my UPS). There’s really no point in “sddm” adding an entry unless it can somehow trap that “wall” broadcast message and turn it into a desktop notification.

Thanks for your answers.

I noticed that the difference between my machines (hostname1 and hostname2 above) is that hostname1 uses Konsole as a terminal and hostname2 uses gnome-terminal.
When I switched to Konsole on hostname2 the problems I mentioned are solved.

Maybe this helps in clarifying the bug you mentioned.

I just did some experimenting.

It seems that “gnome-terminal” does not write an entry to the “utmp” database. Nor do “mate-terminal” nor “xfce4-terminal”. But “konsole” always writes an entry.

With “xterm” the default is to write an entry. But you can use “xterm -ut” to suppress that entry.

“yakuake” always writes an entry, probably because it is based on “konsole”.