Reviewing failed system units using systemctl --failed on an Ubuntu server or desktop system frequently reveals console-setup.service: Failed with result 'exit-code' or Failed to start Set console font and keymap. While graphical desktop sessions usually start normally, this failure indicates that systemd was unable to initialise virtual TTY terminal fonts and keyboard layouts during boot.
Why Does console-setup.service Fail in Ubuntu?
The console-setup service configures virtual text consoles (TTY1 through TTY6) according to settings stored in /etc/default/console-setup:
- Race Conditions During Early Boot: The service attempts to apply font parameters to virtual consoles before the kernel framebuffer driver (e.g.
drmori915) has fully initialised. - Missing Font Packages or Broken Paths: Configuration files referencing a font file (such as
Uni2-Terminus16.psf.gz) that was uninstalled or moved. - Headless Cloud Server Environment: Running Ubuntu inside a minimal cloud VPS container (KVM/LXC) that lacks physical video console hardware endpoints.
- Keyboard Layout Misconfigurations: Malformed UTF-8 characters or invalid keyboard codes inside
/etc/default/keyboard.
1. Inspect Detailed systemd Failure Diagnostics
Examine the exact exit status of the console setup unit.
sudo systemctl status console-setup.service
To inspect the relevant journal log entries from the boot sequence:
sudo journalctl -u console-setup.service -b --no-pager
Common messages include loadkeys: /etc/console-setup/cached.kmap.gz: No such file or setfont: KDFONTOP: Function not implemented.
2. Reconfigure Console Setup and Regenerate Keymaps
Re-running the configuration wizard regenerates clean font caches and default keymaps.
- Reconfigure the console font utility:
sudo dpkg-reconfigure console-setup - Choose the default encoding (UTF-8).
- Select Combined – Latin; Slavic and Greek.
- Choose standard font type (such as VGA or Terminus) and select size 16.
- Regenerate keyboard mappings:
sudo dpkg-reconfigure keyboard-configuration
3. Rebuild cached.kmap.gz File
If the error references a missing cached keyboard map, re-executing the setup scripts constructs the missing binary.
sudo setupcon --save
The --save flag writes the active font and keyboard definitions directly to /etc/console-setup/cached.kmap.gz and cached.psf.gz, eliminating startup read errors.
4. Mask the Service on Headless Cloud Instances (Optional)
If running Ubuntu on a remote cloud server (AWS, DigitalOcean, or Hetzner) managed solely via SSH, physical console font services are redundant.
- Confirm that the server is accessed exclusively via SSH.
- Disable and mask the console setup unit:
sudo systemctl mask console-setup.service - Confirm that
systemctl --failedno longer reports any degraded services.