From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: u-boot@lists.denx.de, Etienne Carriere <etienne.carriere@linaro.org>
Subject: Re: [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing
Date: Thu, 19 Jan 2023 14:52:59 +0200 [thread overview]
Message-ID: <Y8k9KyAVldUbSRZD@hera> (raw)
In-Reply-To: <bd0c2445-3612-d8ec-1a14-22a1aac12488@gmx.de>
Hi Heinrich,
On Thu, Jan 19, 2023 at 01:42:20PM +0100, Heinrich Schuchardt wrote:
> On 1/19/23 12:45, Ilias Apalodimas wrote:
> > Hi Etienne,
> >
> > On Thu, 19 Jan 2023 at 13:17, Etienne Carriere
> > <etienne.carriere@linaro.org> wrote:
> > >
> > > On Wed, 18 Jan 2023 at 17:12, Ilias Apalodimas
> > > <ilias.apalodimas@linaro.org> wrote:
> > > >
> > > > When we try to load EFI variables from a file in the ESP partition and the
> > > > file is missing We print a scary error looking like
> > > > => printenv -e
> > > > ** Unable to read file ubootefi.var **
>
> This message is in line fs/fat/fat.c:1297:
> printf("** Unable to read file %s **\n", filename);
>
> The message is misplaced. If any message is written, it should be in
> fat_read_at().
>
> But I think fat_read_at() should also be quiet. It is the task of the
> calling application to shout out if a file cannot be read.
>
> I have not checked if a test in test/py/tests/test_fs/ relies on the
> error message.
>
> > > > Failed to load EFI variables
>
> If there is a writable ESP, file ubootefi.var is created on first boot.
Are you sure? I think it's created the moment you create an EFI variable.
So on a board that uses preseeded files you'll always see the message.
Thanks
/Ilias
> So this message should only once in the lifecycle of the board.
>
> Afterwards this message indicates that something is really wrong.
>
> If board vendors doesn't like it, they can create a dummy file.
>
> Best regards
>
> Heinrich
>
> > > >
> > > > This is not an error though since the file wasn't there to begin with.
> > > > So silence the warning by aborting the load if the file is not there,
> > > > instead of failing the load.
> > > >
> > > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > > > ---
> > > > lib/efi_loader/efi_var_file.c | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
> > > > index 62e071bd8341..7d7141473634 100644
> > > > --- a/lib/efi_loader/efi_var_file.c
> > > > +++ b/lib/efi_loader/efi_var_file.c
> > > > @@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void)
> > > > return EFI_OUT_OF_RESOURCES;
> > > > }
> > > >
> > > > + ret = efi_set_blk_dev_to_system_partition();
> > > > + if (ret != EFI_SUCCESS)
> > > > + goto error;
> > > > + if (!fs_exists(EFI_VAR_FILE_NAME))
> > > > + goto error;
> > > > +
> > > > ret = efi_set_blk_dev_to_system_partition();
> > > > if (ret != EFI_SUCCESS)
> > > > goto error;
> > >
> > > This later call to efi_set_blk_dev_to_system_partition() can be
> > > removed since already done above.
> > >
> >
> > iirc fs_exists() unconditionally calls fs_close() so we need that double call
> >
> > Cheers
> > /Ilias
> > > Etienne
> > >
> > > > --
> > > > 2.38.1
> > > >
>
next prev parent reply other threads:[~2023-01-19 12:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 16:12 [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing Ilias Apalodimas
2023-01-19 11:16 ` Etienne Carriere
2023-01-19 11:45 ` Ilias Apalodimas
2023-01-19 12:42 ` Heinrich Schuchardt
2023-01-19 12:52 ` Ilias Apalodimas [this message]
2023-01-19 13:15 ` Etienne Carriere
2023-01-19 13:26 ` Ilias Apalodimas
2023-01-19 13:46 ` Ilias Apalodimas
2023-01-20 8:08 ` Etienne Carriere
2023-01-19 13:11 ` Etienne Carriere
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y8k9KyAVldUbSRZD@hera \
--to=ilias.apalodimas@linaro.org \
--cc=etienne.carriere@linaro.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.