last command missing in Ubuntu 24.10+ (util-linux), wtmpdb replacement incompatible with cockpit-identities
Bug Info
Describe the bug
On Ubuntu 24.10 and later, the util-linux package no longer includes the last command. Its replacement, wtmpdb, is not fully compatible with the cockpit-identities add-on. Attempting to view login history results in an error: last: Invalid time value ‘2025-05-21 00:00’ (1)
To Reproduce
Steps to reproduce the behavior:
- Install Cockpit and the
cockpit-identitiesadd-on on Ubuntu 24.10+ - Navigate to the Identities page
- Attempt to view login history using the "last" command functionality
- See error
Expected behavior
Login history should be displayed using the appropriate backend command without throwing errors. If last is unavailable, a compatible fallback or error handling should be implemented.
Screenshots
N/A
Console Output
N/A
Client Side
Desktop (please complete the following information):
- OS: macOS
- Browser: Chrome
- Version: 136.0.7103.114
Smartphone (please complete the following information):
N/A
Server Side
- OS: Ubuntu 25.04
- Cockpit Version: 333-1
Additional context
Ubuntu 24.10 removed the last binary from util-linux. The replacement (wtmpdb) uses a different interface and appears to fail when passed traditional last-style date strings. This causes compatibility issues with tools expecting the old behavior.
Same issue in Debian 13 (https://www.debian.org/releases/trixie/release-notes/issues.html#the-last-lastb-and-lastlog-commands-have-been-replaced)
I really am not a dev, nor a big github user, but if I had to guess;
function formatDateForLast(date) {
const year = date.getFullYear().toString().padStart(4, '0');
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const hour = date.getHours().toString().padStart(2, '0');
const minute = date.getMinutes().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minute}`;
}
The return line's backticks are the source of the problem. Running with single quotes results in proper output.
root@c3:~# wtmpdb last --fullnames --time-format=iso --ip --since '2025-05-21 00:00'
cheese pts/0 192.168.0.6 2025-12-08T23:37:32+0100 - still logged in
I'm not a big javascript/vue developer, but I think useSpawn later on does some string concatenation that results in apostrophes being attached to the front and tail of the date.
But, this is not a total solution since lastb is now missing and its features are not replaced by wtmpdb and wtmpdb is still an optional package.