Re: [PATCH] Console: fall back to /dev/null when no console is availlable

Willy Tarreau
2004-10-06T04:35:10Z

On Wed, Oct 06, 2004 at 12:58:57AM +0300, Denis Vlasenko wrote:
> > + if (open("/dev/null", O_RDWR, 0) == 0)
> > + printk(" Falling back to /dev/null.\n");
> > + }
>
> What will happen if /dev is totally empty?

... Which is the most probable reason causing this trouble.
I've long wondered why the kernel could not open the /dev/console fds itself
since they are character devices, so handled by the kernel internally. It
should be possible to bypass the file-system access and get the fds anyway.
Or we might need some tricks such as populate rootfs with 'console' before
mounting root, open it, remove the entry while keeping the fd for use after
the real root is mounted. This way, it would not be the real /dev/console
which would be passed to init, so it would never even have to exist.

Comments ?

Willy