Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cTVGm-0006eM-6e for mharc-grub-devel@gnu.org; Tue, 17 Jan 2017 10:01:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTVGe-0006eA-P8 for grub-devel@gnu.org; Tue, 17 Jan 2017 10:01:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTVGa-0002cp-Tk for grub-devel@gnu.org; Tue, 17 Jan 2017 10:01:48 -0500 Received: from a.mx.secunet.com ([62.96.220.36]:41824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cTVGa-0002bS-N2 for grub-devel@gnu.org; Tue, 17 Jan 2017 10:01:44 -0500 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id D0C1220192; Tue, 17 Jan 2017 16:01:38 +0100 (CET) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yitb6IOXl_kT; Tue, 17 Jan 2017 16:01:36 +0100 (CET) Received: from mail-essen-01.secunet.de (204.40.53.10.in-addr.arpa [10.53.40.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id 43824200BD; Tue, 17 Jan 2017 16:01:36 +0100 (CET) Received: from [10.182.7.39] (10.182.7.39) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 17 Jan 2017 16:01:35 +0100 Subject: Re: Got error error message after removing unused removeable device Reply-To: The development of GNU GRUB References: To: , From: Dennis Wassenberg Organization: secunet Security Networks Message-ID: <37ccdddd-7c1e-6618-98ce-39944c85864d@secunet.com> Date: Tue, 17 Jan 2017 15:58:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.182.7.39] X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 23 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: B760FD84-323C-4C91-8C42-C78C642B1F8F X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 62.96.220.36 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 15:01:55 -0000 Hi all, no comments on the attached patch? Best regards, Dennis On 09.01.2017 14:21, Dennis Wassenberg wrote: > 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 > 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'"), > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >