mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] init/main.c: add warning when file specified in rdinit is inaccessible
@ 2025-07-06 18:51 Lillian Berry
  2025-07-06 20:13 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Lillian Berry @ 2025-07-06 18:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Lillian Berry

Avoid silently ignoring the initramfs when the file specified in rdinit
is not usable. This prints an error that clearly explains the issue
(file was not found, vs initramfs was not found).

Signed-off-by: Lillian Berry <lillian@star-ark.net>
---
 init/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/init/main.c b/init/main.c
index 225a58279acd..f391f62864a6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1593,6 +1593,8 @@ static noinline void __init kernel_init_freeable(void)
 	 * the work
 	 */
 	if (init_eaccess(ramdisk_execute_command) != 0) {
+		pr_warn("WARNING: rdinit=%s is inaccessible or not existing, ignoring\n",
+			ramdisk_execute_command);
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
 	}
-- 
2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] init/main.c: add warning when file specified in rdinit is inaccessible
  2025-07-06 18:51 [PATCH] init/main.c: add warning when file specified in rdinit is inaccessible Lillian Berry
@ 2025-07-06 20:13 ` Andrew Morton
  2025-07-06 20:29   ` Lillian Berry
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2025-07-06 20:13 UTC (permalink / raw)
  To: Lillian Berry; +Cc: linux-kernel, Al Viro

On Sun,  6 Jul 2025 18:51:41 +0000 Lillian Berry <lillian@star-ark.net> wrote:

> Avoid silently ignoring the initramfs when the file specified in rdinit
> is not usable. This prints an error that clearly explains the issue
> (file was not found, vs initramfs was not found).
> 
> Signed-off-by: Lillian Berry <lillian@star-ark.net>
> ---
>  init/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/init/main.c b/init/main.c
> index 225a58279acd..f391f62864a6 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1593,6 +1593,8 @@ static noinline void __init kernel_init_freeable(void)
>  	 * the work
>  	 */
>  	if (init_eaccess(ramdisk_execute_command) != 0) {
> +		pr_warn("WARNING: rdinit=%s is inaccessible or not existing, ignoring\n",

"is inaccessible or does not exist", please.

Is the "WARNING: " needed?  It's pr_warn(), which implies that it's a warning.

It would be good to display the errno itself.  This way people can just
look up the numeric value so there's no need for this code to expand it
into text.

Perhaps the kernel should have an strerror() for this sort of thing,
but I don't think we do.  The required table is buried down in
net/9p/error.c, for some reason!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] init/main.c: add warning when file specified in rdinit is inaccessible
  2025-07-06 20:13 ` Andrew Morton
@ 2025-07-06 20:29   ` Lillian Berry
  0 siblings, 0 replies; 3+ messages in thread
From: Lillian Berry @ 2025-07-06 20:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Al Viro

On Sun, Jul 6, 2025, at 10:13 PM, Andrew Morton wrote:
> "is inaccessible or does not exist", please.
Will update.

> Is the "WARNING: " needed?  It's pr_warn(), which implies that it's a warning.
I saw this on L486 (warn_bootconfig), but can remove.

> It would be good to display the errno itself. 
Yep! I'll add that.

Kindly,
Lillian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-06 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-06 18:51 [PATCH] init/main.c: add warning when file specified in rdinit is inaccessible Lillian Berry
2025-07-06 20:13 ` Andrew Morton
2025-07-06 20:29   ` Lillian Berry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®