December 3, 2026 | Linux, Ubuntu Server, System Administration
If you have recently installed or upgraded to Ubuntu 26.04 LTS, you may have noticed that the familiar last command is missing.
For decades, Linux system administrators have used this command to inspect user login history, identify remote connections, investigate suspicious activity, and determine when a server was rebooted.
Fortunately, the functionality has not disappeared. It has been replaced by a more modern implementation called wtmpdb.
Why Was the last Command Replaced?
Traditionally, the last command was provided by the util-linux package and retrieved login and logout information from the binary file:
/var/log/wtmpOne of the limitations of this traditional file format is its vulnerability to the Year 2038 problem, caused by the use of signed 32-bit Unix timestamps.
The new implementation, wtmpdb, addresses this limitation by using an SQLite database and 64-bit timestamps.
The transition offers several benefits:
Compatibility with dates beyond January 2038.
SQLite-based storage.
Modern login and logout tracking.
Continued support for familiar command-line options.
Integration with Pluggable Authentication Modules (PAM).
Installing wtmpdb on Ubuntu 26.04
The replacement may not be installed by default on your server.
To install it, execute:
sudo apt update
sudo apt install wtmpdb libpam-wtmpdbThe two packages serve different purposes:
| Package | Purpose |
|---|---|
wtmpdb | Displays login, logout and reboot history. |
libpam-wtmpdb | Records user login and logout events through PAM. |
Both packages are available in the Ubuntu Universe repository.
If Universe is not enabled, execute:
sudo add-apt-repository universe
sudo apt updateUsing the New last Command
The direct replacement for the traditional command is:
wtmpdb lastIf the compatibility command is installed, you can continue using:
lastYou can verify its availability with:
command -v lastDisplay the Last 10 Login Records
wtmpdb last -n 10Display Server Reboot History
wtmpdb last rebootDisplay Login History for a Specific User
wtmpdb last usernameDisplay Full Login and Logout Timestamps
wtmpdb last -FDisplay IP Addresses Instead of Hostnames
wtmpdb last -iDisplay All Available Options
wtmpdb last --helpWhere Is Login History Stored?
Instead of using the traditional binary file, wtmpdb uses an SQLite database.
The database location used by the Ubuntu packaging is:
/var/lib/wtmpdb/wtmp.dbThe following compatibility path may also be available:
/var/log/wtmp.dbYou can inspect these locations using:
ls -l /var/lib/wtmpdb/ /var/log/wtmp*It is important to understand that installing wtmpdb does not automatically reconstruct all previous login records. Existing historical records may need to be imported separately.
Alternatives Using systemd
If you prefer not to install additional packages, Ubuntu provides several useful alternatives through systemd.
Display System Reboot History
journalctl --list-bootsThis command displays the system boots retained in the systemd journal.
Display SSH Login Activity
sudo journalctl -u ssh.serviceDisplay Successful SSH Logins
sudo journalctl -u ssh.service | grep 'Accepted'Display Failed SSH Password Attempts
sudo journalctl -u ssh.service | grep 'Failed password'Display SSH Activity for the Current Day
sudo journalctl -u ssh.service --since todayDisplay Currently Logged-In Users
loginctl list-sessionsAlthough these commands provide valuable information, they are not exact replacements for the traditional login history database. Their historical coverage depends on journal retention and configuration.
Comparison with Previous Ubuntu LTS Releases
| Feature | Ubuntu 22.04 / 24.04 | Ubuntu 26.04 |
|---|---|---|
| Login history utility | last | wtmpdb last |
| Package | util-linux | wtmpdb |
| Storage format | Binary records | SQLite |
| Traditional database | /var/log/wtmp | /var/lib/wtmpdb/wtmp.db |
| Year 2038 safe | No | Yes |
| Additional installation | Generally unnecessary | May be required |
Recommendations for Production Servers
When deploying a new Ubuntu 26.04 LTS server, consider including the following packages in your standard server provisioning procedure:
sudo apt install wtmpdb libpam-wtmpdbAfter installation, establish a new SSH session, disconnect, and verify that the login and logout events have been recorded.
wtmpdb last -n 10If you maintain shell scripts or automated monitoring tools that depend on the traditional last command, review their compatibility with the new implementation, particularly if they parse its output.
For portability across different Ubuntu releases, scripts can detect which implementation is available:
if command -v wtmpdb >/dev/null 2>&1; then
wtmpdb last -n 10
elif command -v last >/dev/null 2>&1; then
last -n 10
else
echo "No login history utility available." >&2
exit 1
fiThis approach allows the same script to operate across older and newer Ubuntu servers.
Conclusion
The disappearance of the traditional last command in Ubuntu 26.04 LTS is part of the modernization of Linux login accounting rather than the removal of an important system administration feature.
The wtmpdb package provides a replacement based on SQLite that addresses the Year 2038 problem while preserving much of the familiar command-line functionality.
For system administrators managing Ubuntu 26.04 production servers, installing wtmpdb and its associated PAM module is a straightforward way to maintain access to user login history.
References
Tags: Ubuntu, Ubuntu 26.04 LTS, Linux, System Administration, wtmpdb, last, SSH, Security, Year 2038