From: Jorn Engel Some userspace applications rely on the assumption that fd's 0, 1 and 2 are always open and function as raw stdin, stdout and stderr, respectively. With no console registered, init get's called without those fd's already open. Arguably, init should know better, handle that case and fix things before forking other processed. But what about init=/bin/bash? Ok, bash could be fixed as well, as could... Instead, this patch opens /dev/null when /dev/console doesn't work. It swallows all output and doesn't give much input, but programs can handle that just fine. Signed-off-by: Jörn Engel Signed-off-by: Andrew Morton --- 25-akpm/init/main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) diff -puN init/main.c~console-fall-back-to-dev-null-when-no-console-is-availlable init/main.c --- 25/init/main.c~console-fall-back-to-dev-null-when-no-console-is-availlable 2004-10-06 11:57:03.472174712 -0700 +++ 25-akpm/init/main.c 2004-10-06 11:57:46.865577912 -0700 @@ -739,8 +739,11 @@ static int init(void * unused) system_state = SYSTEM_RUNNING; numa_default_policy(); - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) { printk("Warning: unable to open an initial console.\n"); + if (sys_open("/dev/null", O_RDWR, 0) == 0) + printk(KERN_WARNING "Falling back to /dev/null\n"); + } (void) sys_dup(0); (void) sys_dup(0); _