grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Got error error message after removing unused removeable device


From: Dennis Wassenberg
Subject: Got error error message after removing unused removeable device
Date: Mon, 9 Jan 2017 14:21:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Hi all,

I run into a grub2 issue.

I have a system with EFI boot enabled and grub2 (grub-2.02-beta2) is stored at 
my ssd. At the ssd there is a LVM installed. The EFI firmware is configured to 
boot at first from internal ssd and after that try a usb hdd. In the following 
cases I got this error message: "error: failure reading sector 0x0 from hd0".

Case 1: SD card reader is plugged into a usb port
Case 2: An USB Multifunction printers is plugged into a usb port
Case 3: I had an usb flash drive installed at boot. If I enter grub2 is unplug 
this usb flash drive (not necessary for booting) and select the menu-entry to 
boot.

This error is shown 10 seconds and after that the system continues booting 
without any issues.

I made some debugging by myself and found that this error comes from 
efidisk.c:grub_efidisk_read because grub_efidisk_readwrite returns with 
GRUB_EFI_NOT_FOUND (case 3) in case of searching the LVM partitions at 
diskfilter.c. I saw there was an improvement that if grub_efidisk_readwrite 
returns with GRUB_EFI_NO_MEDIA this error is filtered out (introduced at 
grub-2.02-beta3). Would it be possible to add GRUB_EFI_NOT_FOUND at the 
filtered out error codes such that this error will not occur any more? This 
will prevent the error message if a removeable device was removed.

A patch for this would look like this:


From: Dennis Wassenberg <address@hidden>
Date: Mon, 9 Jan 2017 13:32:17 +0100
Subject: [PATCH] efidisk: prevent errors from diskfilter scan of removed
 removable drives

Map EFI_NOT_FOUND to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter.

This affects only internally initiated scans. If read/write from removable is
explicitly requested, we still return an error and text explanation is more
clear for user than generic error.
---
 grub-core/disk/efi/efidisk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index 3b79f7b..db93d3a 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -583,6 +583,8 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t 
sector,
 
   if (status == GRUB_EFI_NO_MEDIA)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'"), 
disk->name);
+  else if (status == GRUB_EFI_NOT_FOUND)
+    return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("`%s' not available"), 
disk->name);
   else if (status != GRUB_EFI_SUCCESS)
     return grub_error (GRUB_ERR_READ_ERROR,
                       N_("failure reading sector 0x%llx from `%s'"),
@@ -606,6 +608,8 @@ grub_efidisk_write (struct grub_disk *disk, 
grub_disk_addr_t sector,
 
   if (status == GRUB_EFI_NO_MEDIA)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'"), 
disk->name);
+  else if (status == GRUB_EFI_NOT_FOUND)
+    return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("`%s' not available"), 
disk->name);
   else if (status != GRUB_EFI_SUCCESS)
     return grub_error (GRUB_ERR_WRITE_ERROR,
                       N_("failure writing sector 0x%llx to `%s'"),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]