[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2669238.7s5MMGUR32@nerdopolis2>
Date: Sat, 17 Aug 2024 20:09:20 -0400
From: nerdopolis <bluescreen_avenger@...izon.net>
To: pmladek@...e.com, rostedt@...dmis.org, john.ogness@...utronix.de,
senozhatsky@...omium.org, gregkh@...uxfoundation.org, tglx@...utronix.de,
tony@...mide.com, linux-kernel@...r.kernel.org
Subject: VT-less kernels, and /dev/console on x86
Hi
I originally brought this up on linux-serial, but I think it makes more sense
that it's part of how printk console device selection works. Without VTs, while
most software is able to handle the situation, some userspace programs expect
/dev/console to still be responsive. Namely systemd. It calls isatty() against
/dev/console, and since /dev/console on VT-less systems currently defaults to
/dev/ttyS0, and when /dev/ttyS0 is disconnected, the ioctl's fail, and it
refuses to write log messages to it.
There doesn't seem to be a mailing list for printk, so I had to use
get_maintainer.pl. Hopefully this is correct
After some grepping and guessing and testing, and playing around Something like
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index a45d423ad10f..f94a4632aab0 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -384,9 +384,12 @@ config NULL_TTY
In order to use this driver, you should redirect the console to this
TTY, or boot the kernel with console=ttynull.
-
If unsure, say N.
+config NULL_TTY_CONSOLE
+ bool "Supports /dev/ttynull as a console automatically"
+ depends on NULL_TTY && !VT_CONSOLE
+
config VCC
tristate "Sun Virtual Console Concentrator"
depends on SUN_LDOMS
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index dddb15f48d59..c1554a789de8 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3712,6 +3712,11 @@ void __init console_init(void)
initcall_t call;
initcall_entry_t *ce;
+#ifdef CONFIG_NULL_TTY_CONSOLE
+ if (!strstr(boot_command_line, "console="))
+ add_preferred_console("ttynull", 0, NULL);
+#endif
+
/* Setup the default TTY line discipline. */
n_tty_init();
seems to work, it conflicts with CONFIG_VT_CONSOLE since it is effectively
redundant, it is optional, so that it doesn't cause any changes to
configurations, that historically had CONFIG_VT_CONSOLE turned off in the past,
and for bootloader configs, it won't change any behavior if the kernel command
line has a console device specified
With ttynull as the console device, isatty() no longer fails on /dev/console,
systemd writes the log messages fine to /dev/console, and when Plymouth calls
TIOCCONS on its PTY, it is able to get the log messages.
Thanks
Powered by blists - more mailing lists