The systemd-update-utmp.service is a core systemd component in Ubuntu Server responsible for writing audit and login records to the /var/run/utmp and /var/log/wtmp files during boot, runlevel changes, and system shutdowns. These files are traditionally used by commands like who, w, and last to track active user sessions and system uptime history. While useful for traditional multi-user mainframes or desktop environments, this service is largely redundant in modern cloud-native infrastructures. For immutable, single-purpose Docker hosts, ephemeral Kubernetes nodes, or headless micro-VMs, tracking local TTY runlevel changes to a legacy binary file format wastes CPU cycles, increases boot latency, and adds unnecessary disk I/O writes during the critical startup phase.
This guide explains how to completely disable the systemd-update-utmp service in Ubuntu Server, optimizing the boot sequence by skipping legacy user accounting logs.
Stop and Mask the systemd-update-utmp Service
To guarantee that the server boots faster and ignores the legacy utmp/wtmp updates, we must disable the service and explicitly mask it to prevent systemd from invoking it during the boot sequence.
- Log into your Ubuntu Server via SSH using an account with
sudoprivileges. - First, check if the service is currently running or queued:
sudo systemctl status systemd-update-utmp.service - Stop the service immediately:
sudo systemctl stop systemd-update-utmp.service - Next, disable the service to remove its symlinks from the systemd boot schedule:
sudo systemctl disable systemd-update-utmp.service - For absolute certainty, explicitly mask the service. This symlinks the unit file to
/dev/null, creating a hard block against it starting under any circumstances:sudo systemctl mask systemd-update-utmp.service
Verify the Service Lockdown
By masking systemd-update-utmp.service, you guarantee that the Ubuntu OS will silently skip writing runlevel changes to the accounting logs, streamlining the initialization process for ephemeral instances.
To verify the lockdown is successful, attempt to start the service manually:
sudo systemctl start systemd-update-utmp.service
Systemd will return a fatal error stating that the unit is masked (e.g., Failed to start systemd-update-utmp.service: Unit systemd-update-utmp.service is masked). You can also reboot the server and subsequently run the last reboot command; it will fail to accurately report the latest runlevel change, confirming that the legacy logging mechanism has been successfully bypassed.