Re: [PATCH 1/2] init: ensure that /dev/console is (nearly) always available in initramfs

David Disseldorp
2026-02-19T23:59:34Z

On Thu, 19 Feb 2026 21:03:11 +0000, Askar Safin wrote:

> If we generate external initramfs as normal user using "cpio"
> command, then we cannot put /dev/console there.
>
> Fortunately, in this case default builtin initramfs will
> contain /dev/console (before this commit).
>
> But if we generate builtin initramfs instead, then we will
> not have /dev/console at all. Thus the kernel will be unable to
> open /dev/console, and PID 1 will have stdin, stdout and stderr
> closed.
>
> This problem can be solved by using gen_init_cpio.
>
> But I think that proper solution is to ensure that /dev/console
> is always available, no matter what. This is quality-of-implementation
> feature. This will reduce number of possible failure modes. And
> this will make easier for developers to get early boot right.
> (Early boot issues are very hard to debug.)

I'd prefer not to go down this path:
- I think it's reasonable to expect that users who override the default
internal initramfs know what they're doing WRT /dev/console creation.
- initramfs can be made up of concatenated cpio archives, so tools which
insist on using GNU cpio and run into mknod EPERM issues could append
the nodes via gen_init_cpio, while continuing to use GNU cpio for
everything else.

Thanks, David