diff mbox series

efi_loader: change the error message when storing EFI variables

Message ID 20240419074201.9053-1-ilias.apalodimas@linaro.org
State New
Headers show
Series efi_loader: change the error message when storing EFI variables | expand

Commit Message

Ilias Apalodimas April 19, 2024, 7:42 a.m. UTC
When we try to store EFI variables on a file, we need to use an ESP.
if an ESP is not found, variables will change in memory, but U-Boot
won't be able to restore them across reboots.

Adjust the error message so users can understand what's going on

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/efi_var_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt April 19, 2024, 7:51 a.m. UTC | #1
On 19.04.24 09:42, Ilias Apalodimas wrote:
> When we try to store EFI variables on a file, we need to use an ESP.
> if an ESP is not found, variables will change in memory, but U-Boot
> won't be able to restore them across reboots.
> 
> Adjust the error message so users can understand what's going on
> 
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>   lib/efi_loader/efi_var_file.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
> index 413e1794e88c..5276740ffe7a 100644
> --- a/lib/efi_loader/efi_var_file.c
> +++ b/lib/efi_loader/efi_var_file.c
> @@ -82,7 +82,7 @@ efi_status_t efi_var_to_file(void)
>   
>   error:
>   	if (ret != EFI_SUCCESS)
> -		log_err("Failed to persist EFI variables\n");
> +		log_err("ESP not found. UEFI variables won't persist reboots\n");

%s/reboots/reboot/  We can't look further into the future.

A missing ESP is not the only possible failure cause. How about

* no space on disk
* already 512 entries in FAT12 root directory

Best regards

Heinrich

>   	free(buf);
>   	return ret;
>   #else
Ilias Apalodimas April 19, 2024, 7:52 a.m. UTC | #2
Hi Heinrich

On Fri, 19 Apr 2024 at 10:51, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> On 19.04.24 09:42, Ilias Apalodimas wrote:
> > When we try to store EFI variables on a file, we need to use an ESP.
> > if an ESP is not found, variables will change in memory, but U-Boot
> > won't be able to restore them across reboots.
> >
> > Adjust the error message so users can understand what's going on
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >   lib/efi_loader/efi_var_file.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
> > index 413e1794e88c..5276740ffe7a 100644
> > --- a/lib/efi_loader/efi_var_file.c
> > +++ b/lib/efi_loader/efi_var_file.c
> > @@ -82,7 +82,7 @@ efi_status_t efi_var_to_file(void)
> >
> >   error:
> >       if (ret != EFI_SUCCESS)
> > -             log_err("Failed to persist EFI variables\n");
> > +             log_err("ESP not found. UEFI variables won't persist reboots\n");
>
> %s/reboots/reboot/  We can't look further into the future.
>
> A missing ESP is not the only possible failure cause. How about
>
> * no space on disk
> * already 512 entries in FAT12 root directory
>

How about creating 2 error messages?
One stating the ESP is missing and another for write errors?

Thanks
/Ilias

> Best regards
>
> Heinrich
>
> >       free(buf);
> >       return ret;
> >   #else
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 413e1794e88c..5276740ffe7a 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -82,7 +82,7 @@  efi_status_t efi_var_to_file(void)
 
 error:
 	if (ret != EFI_SUCCESS)
-		log_err("Failed to persist EFI variables\n");
+		log_err("ESP not found. UEFI variables won't persist reboots\n");
 	free(buf);
 	return ret;
 #else