Got error error message after removing unused removeable device
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 <[email protected]>
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(+)
grub-core/disk/efi/efidisk.c +4 -0
@@ -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'"),
Hi all,
no comments on the attached patch?
Best regards,
Dennis
Quoted 60 lines · Dennis Wassenberg
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
0x0from 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_readwritereturns withGRUB_EFI_NOT_FOUND(case 3) in case of searching the LVM partitions atdiskfilter.c. I saw there was an improvement that ifgrub_efidisk_readwritereturns withGRUB_EFI_NO_MEDIAthis error is filtered out (introduced at grub-2.02-beta3). Would it be possible to addGRUB_EFI_NOT_FOUNDat 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 <[email protected]>
Date: Mon, 9 Jan 2017 13:32:17 +0100
Subject: [PATCH] efidisk: prevent errors from diskfilter scan of removed
removable drivesMap
EFI_NOT_FOUNDtoGRUB_ERR_OUT_OF_RANGEthat 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(+)grub-core/disk/efi/efidisk.c +4
-0@@ -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'"),_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel