Debian - persistent TTY font

A simple workaround allowing you to maintain a consistent font in the TTY on Debian-based OSs.

release date: 2025-09-08

modification date: 2025-09-10

about problem

Do you use TTY? If you sometimes go outside a DE and like to feel the old-school character of the terminal, this article might help you!

If you already use TTY, you probably know that it is possible to change the font. On older low-resolution hardware, the default font is fine, but on HD+ resolutions, you basically need a magnifying glass to work comfortably. There is the setfont command, which allows you to provide the exact path to the chosen font file, and there is also dpkg-reconfigure console-setup (on Debian-based systems, which this post covers), which lets you select the font, size, and layout in convenient dialog windows. Perfect.

To make this font “stick” for the next session, you need to rebuild the Linux image and initrd - simply update-initramfs -u or update-initramfs -u -k all if you don’t want to do it separately for each available kernel. In theory, it works - you restart the computer, systemd logs load (if working with loglevel=3), and you see the font adjusting, but…

Unfortunately, at some point during system boot, [email protected] kicks in, which reloads the graphics drivers and resets the font to the default Linux one. And why bother with default settings if something immediately comes and breaks them…?

simple solution

The solution is ridiculously simple. There are probably many ways to do this, but I went for possible simplicity and a primitive approach that works. As a first step, I used systemd-analyze blame to see which services start at what time and in what order - we need to set the font after any graphics modules are reloaded. Still, after booting the computer a few times, it turns out the graphics system is very flexible - we are aiming at a moving target.

We approach it differently - there is [email protected] - this is what we need. The getty@tty1 service is responsible for preparing the login window and starting the session after login. We can use it to have the proper terminal start with the correct and improved font. But what if we create a separate service that runs After= ... getty ...? Possible, it’s clean and non-intrusive, but there is a half-second to one-second delay between the login screen loading and the font being applied. Ugly. We want the login screen to already have a nice font.

Here’s my suggestion - without unnecessary prolonging - we add ExecStartPre= in the [email protected] file. This command will execute before the login prompt is loaded. And which command? Simple - setupcon.

time to solve

Alright, time to get to it!
Step one - edit the getty@tty1 service file:
systemctl edit --full [email protected]
Next step - find the [Service] section and add ExecStartPre= to it:
[Unit]
# blah blah blah

[Service]
# Some original comments...
ExecStartPre="/bin/setupcon" # <-- this is our command
ExecStart=/something/agetty ... # original exec command
# blah blah blah

[Install]
# blah blah blah
Now save the changes in your editor (CTRL + S; CTRL + X in nano, for example) and reload the systemd daemons:
systemctl daemon-reload
Done. Now reboot and observe :) Easy peasy.
Remember to use sudo before each of the commands mentioned above if you are not logged as root.
In the ExecStartPre field, you must to provide the absolute path to the command being executed, because systemd does not recognize $PATH.
If you believe that my work has meaning and value, consider making a donation so I can continue to grow, full of inspiration - >link<