vconsole-setup: skip font setup on a KD_GRAPHICS vc instead of failing

Since 7da67c3f8b ("vconsole-setup: skip setfont(8) when the console
driver lacks font support") font_load_and_wait() probes the font with
KDFONTOP before running setfont(8). The kernel returns EINVAL for a vc
that is not in KD_TEXT, which is not treated as "no font support", so
systemd-vconsole-setup now fails with

  Failed to check '/dev/tty1' has font support: Invalid argument

when run on an explicitly specified vc that a graphical splash (e.g.
plymouth) occupies, for instance from a unit ordered after getty@tty1.
Previously setfont(8) silently ignored this case: verify_source_vc()
accepts it with a notice that the font settings likely won't be applied,
and setup_remaining_vcs() skips such vcs. Do the same here, skip the
font setup and still load the keymap.

(cherry picked from commit 4a3ece0b733d41eab9baad25648c8a921c590ed2)
This commit is contained in:
Egor Ignatov
2026-10-16 17:24:51 +01:00
committed by Luca Boccassi
parent 8e48f9c635
commit 91c316859d
+11
View File
@@ -444,6 +444,17 @@ static int font_load_and_wait(int fd, const char *vc, Context *c) {
return 0; /* Report that we skipped this */
}
/* The kernel refuses to operate on the font of a vc in KD_GRAPHICS (e.g. an explicitly specified vc
* running a splash screen), hence skip the font setup like setup_remaining_vcs() does.
* verify_source_vc() already warned about this at notice level. */
r = verify_vc_display_mode(fd);
if (r == -EBUSY) {
log_debug_errno(r, "Virtual console %s is not in KD_TEXT, skipping font setup.", vc);
return 0; /* Report that we skipped this */
}
if (r < 0)
return log_error_errno(r, "Failed to check display mode of '%s': %m", vc);
/* May be called on the dummy console (e.g. during keymap setup with fbcon deferred takeover). Font
* changes are not supported here and will fail. */
r = verify_vc_support_font(fd);