Change of behaviour when console=null and ttynull driver is used

From: Guillermo Rodriguez Garcia
Date: Thu Mar 16 2023 - 06:29:45 EST


Hi all,

We have several embedded systems where pass console= or console=null
in production to disable the console.

Later we check for this in user space: in our inittab we check if fd0
is "associated with a terminal" (test -t 0); if so, we are in
development mode and we open a debug shell; otherwise (console
disabled) we just start the application.

Recently [1] this behaviour has changed and now if we pass console= or
console=null, the new ttynull driver is used. This breaks the check we
were doing (test -t 0 always true now).

Is there a way to get the previous behaviour? If not, is there an easy
way for userspace to detect whether the console device is a "real" tty
or ttynull (other than trying to parse the kernel boot args, which
would be a bit fragile).

Thank you,

(If possible, please CC me in any replies)

[1]: https://lore.kernel.org/lkml/X%2FcDG%2FxCCzSWW2cd@alley/t/

--
Guillermo Rodriguez Garcia
guille.rodriguez@xxxxxxxxx