From 153d5dfd871da3980b956ba65da20d7d022f2b03 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 8 May 2023 11:27:31 +0200 Subject: [PATCH] core: Try to initialize TERM from systemd.tty.term.console as well We already have the systemd.tty.xxx kernel cmdline arguments for configuring tty's for services, let's make sure the term cmdline argument applies to pid1 as well. --- man/kernel-command-line.xml | 6 ++++-- src/core/main.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index 09f8ace4de6..211ae5ac571 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -590,8 +590,10 @@ These arguments allow configuring default values for $TERM, TTYRows=, and TTYColumns= for tty - tty. The tty name should be specified without the - /dev/ prefix (e.g. systemd.tty.rows.ttyS0=80). + tty. Additionally, systemd.tty.term.console will + configure the $TERM value used by systemd if not set explicitly + using TERM on the kernel command line. The tty name should be specified without + the /dev/ prefix (e.g. systemd.tty.rows.ttyS0=80). diff --git a/src/core/main.c b/src/core/main.c index 5347372c817..86385d64656 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1425,6 +1425,12 @@ static int fixup_environment(void) { if (r < 0) return r; + if (r == 0) { + r = proc_cmdline_get_key("systemd.tty.term.console", 0, &term); + if (r < 0) + return r; + } + t = term ?: default_term_for_tty("/dev/console"); if (setenv("TERM", t, 1) < 0) -- 2.47.3