In Ubuntu Server, systemd-localed.service is a D-Bus activated system service responsible for managing system locale settings, virtual console keyboard mappings, and X11 windowing system keymaps. It provides a standardized interface for user-space utilities (like localectl) to interact with and dynamically update configuration files such as /etc/default/locale and /etc/default/keyboard. While necessary for dynamic, multi-user desktop environments or generalized servers where administrators frequently alter localization settings, this automated configuration management is entirely unacceptable in strict, immutable infrastructure. In zero-trust, automated deployment, or containerized environments, locale and keymap parameters are cryptographically defined during the image build process; allowing a D-Bus daemon to modify these files at runtime introduces a vector for unauthorized configuration drift.
This guide explains how to completely disable the systemd-localed service in Ubuntu Server, ensuring absolute suppression of dynamic locale and keymap modifications via systemd’s D-Bus interface.
Stop and Mask the systemd-localed Service
To guarantee that this service cannot execute and modify the system locale configuration files, we must disable and explicitly mask the unit file.
- Log into your Ubuntu Server via SSH using an account with
sudoprivileges. - First, stop the active service (if it is currently running in the background):
sudo systemctl stop systemd-localed.service - Next, disable the service to remove it from the systemd boot schedule:
sudo systemctl disable systemd-localed.service - For absolute certainty, explicitly mask the service. This symlinks the unit file to
/dev/null, creating a hard block against it being activated by D-Bus requests under any circumstances:sudo systemctl mask systemd-localed.service
Verify the Service Lockdown
By masking systemd-localed.service, you guarantee that systemd will completely ignore the unit, severing the D-Bus API connection to the system’s localization configuration files.
To verify the lockdown is successful, attempt to query the locale status using the standard systemd utility:
localectl status
Systemd will return a fatal D-Bus connection error stating that the service cannot be activated (e.g., Failed to query system properties: Unit systemd-localed.service is masked). You have successfully neutralized the automated systemd localization manager, hardening your server’s runtime environment and ensuring compliance with strict, immutable infrastructure requirements where configurations must be managed exclusively out-of-band.