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

Re: Bullseye - who and users return nothing



On Mon, Jan 24, 2022 at 09:51:05AM +0000, Gareth Evans wrote:
> I've just noticed that: 
> 
> $ who
> 
> and
> 
> $ users
> 
> both return nothing, with or without sudo.

> Can anyone replicate this or suggest what may have happened?  I'm fairly sure I've used who since upgrading from Buster.

Definitely can't replicate.  "who" gives me 28 lines of output for all
of my terminals.

As far as suggesting a cause -- we'd need more info.  Which init system
are you using?  How are you logging in?  Are you using any terminal
emulators, and if so, which one(s)?

Is the /var file system full?  (Or any mount underneath /var if you have
such.)

Have you done anything unique or unusual to your system that would cause
it not to log sessions in /var/run/utmp?

> $ sudo strace who
> <snip>
> access("/var/run/utmpx", F_OK)          = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/var/run/utmp", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> access("/var/run/utmpx", F_OK)          = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/var/run/utmp", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> close(1)                                = 0
> close(2)                                = 0
> exit_group(0)                           = ?
> +++ exited with 0 +++

Your /var/run/utmp file is missing.  That's definitely going to cause
a problem here.

Here's what mine looks like:

unicorn:~$ df /var/run
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs            1215580  1456   1214124   1% /run
unicorn:~$ ls -ld /var/run
lrwxrwxrwx 1 root root 4 Jan 11  2018 /var/run -> /run/
unicorn:~$ ls -l /var/run/utmp
-rw-rw-r-- 1 root utmp 12288 Jan 20 15:08 /var/run/utmp

I don't know what happened to yours, but since /run is an in-memory
file system, all of the stuff inside it (including the utmp file) has
to be created at boot time, or at login time at the very latest.

You could try creating the file with the correct user/group/perms and
see if that helps, but that probably won't survive the next reboot.

You could also try rebooting and see if it gets created correctly.  If
it doesn't, then I guess you get to dive into the internals of your
init system to discover what's going wrong.

Or... maybe you're just missing the /var/run symlink?  Definitely check
that.


Reply to: