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 -- Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany Managing Director: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman (HRB 36809, AG Nürnberg)