Skip to contentSkip to conversation

vfs: init/main.c: change comment and pr_err: opening /dev/console may fail

PATCH New Askar Safin 1 participant 1 message Apr 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vfs: init/main.c: change comment and pr_err: opening /dev/console may fail

This patch is for VFS.

Today comment on console_on_rootfs says that opening /dev/console never fails. This is false. The opening may fail if /dev/console is not present in internal initramfs. So let's update the comment and pr_err.

I tried to fix the problem itself in [1], but the patchset was rejected, so I will fix the comment and pr_err instead. :)

v1: https://lore.kernel.org/all/[email protected]/

v1 -> v2 changes: changed text and also moved it to pr_err (inspired by Al Viro)

---
 init/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
init/main.c +4 -2
index 1cb395dd9..daf115d08 100644
@@ -1645,13 +1645,15 @@ static int __ref kernel_init(void *unused)
 	      "See Linux Documentation/admin-guide/init.rst for guidance.");
 }
 
-/* Open /dev/console, for stdin/stdout/stderr, this should never fail */
+/* Open /dev/console, for stdin/stdout/stderr */
 void __init console_on_rootfs(void)
 {
 	struct file *file = filp_open("/dev/console", O_RDWR, 0);
 
 	if (IS_ERR(file)) {
-		pr_err("Warning: unable to open an initial console.\n");
+		pr_err("Warning: unable to open an initial console. "
+		       "You likely supplied your own internal initramfs, "
+		       "make sure /dev/console is there.\n");
 		return;
 	}
 	init_dup(file);

base-commit: bfe62a454542cfad3379f6ef5680b125f41e20f4 (mainline)

Signature · 1 line
2.47.3