[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#969070: $console handling might result in unbootable system



On 27/08/2020 22:43, Vagrant Cascadian wrote:
Control: severity 969070 important

On 2020-08-27, Andre Heider wrote:
Since [0] flash-kernel does:

    if test -n "${console}"; then
      setenv bootargs "${bootargs} console=${console}"
    fi

The common $console format as set by u-boot includes the leading "console=":
include/configs/arndale.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/espresso7420.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/mvebu_armada-37xx.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000"
include/configs/mvebu_armada-37xx.h:    "console="
CONFIG_DEFAULT_CONSOLE "\0" \
include/configs/odroid.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/odroid.h:   "console=" CONFIG_DEFAULT_CONSOLE \
include/configs/odroid_xu3.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/odroid_xu3.h:   "console=" CONFIG_DEFAULT_CONSOLE \
include/configs/origen.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/peach-pi.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/peach-pit.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/s5p_goni.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/s5p_goni.h: "console=" CONFIG_DEFAULT_CONSOLE \
include/configs/s5pc210_universal.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/s5pc210_universal.h:    "console=" CONFIG_DEFAULT_CONSOLE \
include/configs/smdk5250.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/smdk5420.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/smdk5420.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/smdkv310.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/snow.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/spring.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC1,115200n8\0"
include/configs/trats.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/trats.h:    "console=" CONFIG_DEFAULT_CONSOLE \
include/configs/trats2.h:#define CONFIG_DEFAULT_CONSOLE
"console=ttySAC2,115200n8\0"
include/configs/trats2.h:   "console=" CONFIG_DEFAULT_CONSOLE \

So on some boards we end up with bootargs containing
"console=console=...", which, combined with a systemd bug [1] (present
in buster), makes the system unbootable:
[    4.632197] systemd-udevd[90]: Starting version 241
[    4.639324] systemd-udevd[91]: Failed to create udev control event
source: Operation not permitted
<full hang here>

In debian's u-boot package, this has been patched out for some targets
(and upstream originally included the patches, but eventually reverted).

The problem stems from an inconsistancy in u-boot, as some platforms use
this argument differently(especially when you get into vendor forks of
u-boot), and I don't believe u-boot has pattern matching to be able to
handle this properly (e.g. behave differently when console=* is set).



Doing a "env delete console" and the system boots up properly. That
includes the kernel output over serial, since the kernel dts files have
contain "chosen { stdout-path = &uart0; };".

Not all systems have stdout-path defined in the device-tree.
Maybe now those are the exceptions...

So I'd say appending $console to $bootargs is some historical leftover,
and it can just be removed from the generic scripts.

The problem is that *not* doing this with console can also result in an
unbootable system.

Huh, how does that break?

Reverting this would be breaking one thing to fix another. There's no
"correct" here, only different. :/

flash-kernel supports assigning different boot scripts per boards. I mean, we could get rid of $console from the generic scripts, and then use a different one with it for boards requiring it.

Stats:
Going by u-boot upstream, only 17 of +700 boards set $console (grep for CONFIG_DEFAULT_CONSOLE, which too is deprecated).

Going by linux upstream, 112 of 125 arm64 boards used "stdout-path":
$ find /usr/lib/linux-image-4.19.0-10-arm64 -name \*.dtb|xargs strings -f|grep stdout-path|wc -l
112

$ find /usr/lib/linux-image-4.19.0-10-arm64 -name \*.dtb|wc -l 125

I didn't check 32bit arm, but going by those numbers we could at least drop it for bootscript/arm64/bootscr.uboot-generic (I ran into this issue on arm64).

Regards,
Andre


Reply to: