coreutils
[Top][All Lists]
Advanced

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

Re: switching from wtmp to wtmpdb


From: Pádraig Brady
Subject: Re: switching from wtmp to wtmpdb
Date: Thu, 29 Jun 2023 21:59:29 +0100
User-agent: Mozilla Thunderbird

On 29/06/2023 18:26, Bernhard Voelker wrote:
[moving this from the openSUSE list to upstream coreutils]

Hi Padraig,

On 6/29/23 08:21, Thorsten Kukuk wrote:
On Thu, Jun 29, Bernhard Voelker wrote:

Hi Thorsten,

On 6/28/23 10:40, Thorsten Kukuk wrote:
On openSUSE Tumbleweed/MicroOS/... we introduced meanwhile wtmpdb, which
solves the Y2038 problem and some others, too.
"wtmpdb last" should work already today and show you similar output
compared with "last" itself. The next and final step will be, making
"last" a link to "wtmpdb last" and rename the old last to "last.legacy".
There are currently no plans to disable writing of wtmp entries
completly, I expect that this will come most likely together with utmp.
So the applications reading wtmp directly (currently I'm only aware of
accounts-daemon, maybe samba, haven't analyzed that code yet) should
continue to work. The other 99% of applications accessing wtmp do only
create new entries, this should cause no issues.

The commands `users` and `who` from the coreutils package may use wtmp:

    $ users --help
    Usage: users [OPTION]... [FILE]
    Output who is currently logged in according to FILE.
    If FILE is not specified, use /var/run/utmp.  /var/log/wtmp as FILE is 
common.
    [...]

Yes, you can print on the screen, how often your account name is listed
in /var/log/wtmp. It may have been usefull decades ago, when there were
no tools like lastlog and last, but today it's pretty useless:
# users /var/log/wtmp
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk kukuk 
kukuk root

And is only possible since wtmp uses the same struct as utmp.

    $ who --help
    Usage: who [OPTION]... [ FILE | ARG1 ARG2 ]
    Print information about users who are currently logged in.

    [...]
    If FILE is not specified, use /var/run/utmp.  /var/log/wtmp as FILE is 
common.

I'm not sure if those commands are used much with a FILE argument nowadays.

Same as users, in this case it gives you the same output as last.

There are more tools which can read /var/log/wtmp because you can
specify an alternate utmp file, so you could instead specify wtmp.
This was discussed in several upstream projects (but not yet with
coreutils, no time) and nobody could find a usefull use case.
Reason is, that while the used struct is the same, the use case and
content is completly different.

But utmp will go away, too, there is no way around.
First patches for coreutils to use logind instead of /run/utmp exist
already: https://github.com/thkukuk/utmpx/tree/main/patches/coreutils

So yes, admins, who wrote scripts 3-4 decades ago using this, needs to
invest to "modernize" them and use current tools.
As somebody wrote in a comment on lwn.net: it makes no sense to restrict
Linux today just because 40 years ago there was an operating system with
this restriction that nobody knows anymore.

    Thorsten

Did you already have similar discussions on Fedora/Redhat side about replacing 
wtmp?
It seems the utilities pinky, uptime, last, and users are affected.

I have not heard about or looked into the wtmp Y2038 issue.

Thanks for the info.

cheers,
Pádraig

reply via email to

[Prev in Thread] Current Thread [Next in Thread]