Package: wtmpdb
Version: 0.73.0-3+deb13u1
Severity: minor

Dear Maintainer,

When shutting down after wtmp.db log rotation has been conducted by logrotate,
the following error is output during shutdown:

  search_id: Open entry for tty '~' not found

This is because an empty log file is created as a result of rotation. This can
be reproduced as follows, where one can also so there is no record
corresponding to the shutdown event.

  $ touch foo
  $ wtmpdb shutdown -f foo
  search_id: Open entry for tty '~' not found
  $ last -f foo
  foo has no entries

Looking into an alternative approach to effect the rotation, the built-in
command does not fix this:

  $ cp /var/log/wtmp.db foo
  $ wtmpdb rotate -d 0 -f foo
  13 entries moved to ./foo_20260404.db
  $ last -f foo
  foo has no entries
  $ wtmpdb shutdown -f foo
  search_id: Open entry for tty '~' not found
  $ last -f foo
  foo has no entries

It would be nice if wtmpdb could create an log file containing only the current
system startup entry, or only all currently open entries. However, even if it
did, the rotation command is unreasonably slow.

I am not sure what the best answer is. One could synthesise a (false) entry as
a post-rotation action with 'wtmpdb boot' - the user feedback [1] on that idea
so far was that it were better to have an error than a synthetic entry. The
ideal way to solve would require upstream enhancement to replicate the correct
boot time. The rigidity of the libwtmpdb API does not help us here,
unfortunately - it makes a downstream patch difficult.

  $ rm foo
  $ touch foo
  $ wtmpdb boot -f foo
  Boot time too far in the past, using current time:
  Boot time: Sat Apr  4 08:51:11 2026
  Current time: Sat Apr  4 10:01:30 2026
  $ wtmpdb shutdown -f foo
  $ last -f foo
  s-reboot system boot  6.10.12-686      Sat Apr  4 10:01 - 10:02  (00:00)

  foo begins Sat Apr  4 10:01:30 2026

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094965#64


-- System Information:
Debian Release: 13.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'proposed-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 6.10.12-686 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages wtmpdb depends on:
ii  libaudit1    1:4.0.5-1
ii  libc6        2.42-1
ii  libsystemd0  257.9-1~deb13u1
ii  libwtmpdb0   0.73.0-3+deb13u1

Versions of packages wtmpdb recommends:
ii  libpam-wtmpdb  0.73.0-3+deb13u1
ii  logrotate      3.22.0-1

wtmpdb suggests no packages.

-- no debconf information

Reply via email to