Paul Eggert wrote:
> programs like Coreutils 'who' have two problems:
> ...
> 2. Accessing /var/log/wtmp.db via libwtmpdb, a library I never heard
> about until looking into this just now, and something that Gnulib
> readutmp I suppose should link to, if its callers want historical data.
wtmpdb (or libwtmpdb) [1] seems to be mostly used by Debian and
descendent distros.[2]
Here's what I can find:
Ubuntu 26.04: uses /var/log/wtmp and systemd
'last' not installed
'uptime' (from procps-ng) uses /proc/uptime and
/run/systemd/sessions/
Debian 13: uses /var/log/wtmp.tb and systemd
'last' (symlink to wtmpdb) uses /var/log/wtmp.db
'uptime' (from procps-ng) uses /proc/uptime and
/run/systemd/sessions/
Devuan 6: uses /var/log/wtmp and /var/log/wtmp.db
'last' (symlink to wtmpdb) uses /var/log/wtmp.db
'uptime' (from procps-ng) uses /proc/uptime and /var/run/utmp
'who', 'users', 'pinky' (from coreutils) use /var/run/utmp
Devuan 5: uses only /var/log/wtmp
wtmpdb not installed
'last' (from util-linux) uses /var/log/wtmp
'uptime' (from procps-ng) uses /proc/uptime and /var/run/utmp
AFAICS from Thorsten Kukuk's articles [3][4], both /var/run/utmp and
/var/log/wtmp should not be accessed any more in Y2038-safe software.
For coreutils / readutmp this means:
* No problem on systems with systemd.
* But for Devuan, we should make an effort to use /var/log/wtmp.db,
via libwtmpdb, when available. Not only for "historical data", but
for the main use-case of the programs 'who', 'users', 'pinky' and
possibly 'uptime'.
(Do I understand this correctly: Can these programs work without
/var/run/utmp, only with /var/log/wtmp.db?)
Bruno
[1] https://github.com/thkukuk/wtmpdb
[2] https://chatgpt.com/share/6a6d22fa-78b4-83ed-9320-d643a5f69d23
[3] https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/
[4] https://www.thkukuk.de/blog/Y2038_glibc_wtmp_64bit/