Re: [PATCH v3] init/main.c: add warning when file specified in rdinit is inaccessible
From: Ahmad Fatoum
Date: Tue Oct 07 2025 - 10:57:51 EST
Hello Lillian,
On 7/7/25 11:14 AM, Lillian Berry 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).
I have a system that works just fine without an initramfs, but now the
kernel warns me about it:
[ 2.805602] check access for rdinit=/init failed: -2, ignoring
I suppose that's unintended and the code here should actually check that
there is an initrd at all before checking for the rdinit?
Thanks,
Ahmad
>
> Signed-off-by: Lillian Berry <lillian@xxxxxxxxxxxx>
> ---
> init/main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/init/main.c b/init/main.c
> index 225a58279acd..e47984871775 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1592,7 +1592,11 @@ static noinline void __init kernel_init_freeable(void)
> * check if there is an early userspace init. If yes, let it do all
> * the work
> */
> - if (init_eaccess(ramdisk_execute_command) != 0) {
> + int ramdisk_command_access;
> + ramdisk_command_access = init_eaccess(ramdisk_execute_command);
> + if (ramdisk_command_access != 0) {
> + pr_warn("check access for rdinit=%s failed: %i, ignoring\n",
> + ramdisk_execute_command, ramdisk_command_access);
> ramdisk_execute_command = NULL;
> prepare_namespace();
> }
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |