Re: kernel hang during reboot when cmdline include a non-exist console device

From: Petr Mladek
Date: Wed Sep 01 2021 - 07:48:41 EST


On Wed 2021-09-01 09:52:54, James Wang wrote:
>
> 在 2021/8/31 PM10:52, Petr Mladek 写道:
> > On Tue 2021-08-31 22:38:42, James Wang wrote:
> > > 在 2021/8/31 PM10:33, Petr Mladek 写道:
> > > > On Tue 2021-08-31 21:45:05, James Wang wrote:
> > > > > 在 2021/8/31 PM4:47, Sergey Senozhatsky 写道:
> > > > > > And may I ask, just in case, if James can revert a revert of Petr's commit:
> > > > > >
> > > > > > revert a91bd6223ecd46addc71ee6fcd432206d39365d2
> > > > > >
> > > > > > boot with wrong console argument and see if the kernel reboots without
> > > > > > any problems.
> > > > > After test, revert Petr's commit can work; reboot without any problem;
> > > > Interesting, it looks like the panic() is really caused by missing
> > > > stdout, stdin, and stderr, for the init process.
> > > >
> > > > Unfortunately, the fix is not easy, as described in the commit
> > > > a91bd6223ecd46addc71e ("Revert "init/console: Use ttynull as
> > > > a fallback when there is no console").
> > > OK. But I suppose you could find a quick workaround to mitigate this issue.
> > You could either remove the invalid console=ttyUSB0,115200
> > parameter. As a result, tty0 will become the default console and
> > it will be used by the init process.
>
> No,I just want to use a "invalid" console parameter for "boot up", because
> It could help me "drop" kernel/systemd log, keep the kernel logo on the
> screen;

This looks like a hack. And it works just by chance. It is neither
documented nor supported.

The official way to hide kernel messages is using "quiet" or
"loglevel=1" kernel parameters.

If you really do not want the console then I suggest to use the
ttynull driver mentioned in the previous mail.

Best Regards,
Petr