From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RXyBq-00062S-9J for mharc-grub-devel@gnu.org; Tue, 06 Dec 2011 11:48:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXyBi-000607-Uz for Grub-devel@gnu.org; Tue, 06 Dec 2011 11:48:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXyBh-0002Ah-Qj for Grub-devel@gnu.org; Tue, 06 Dec 2011 11:48:14 -0500 Received: from stl-smtpout-01.boeing.com ([130.76.96.56]:36784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXyBh-0002AP-LV for Grub-devel@gnu.org; Tue, 06 Dec 2011 11:48:13 -0500 Received: from slb-av-01.boeing.com (slb-av-01.boeing.com [129.172.13.4]) by stl-smtpout-01.ns.cs.boeing.com (8.14.4/8.14.4/8.14.4/SMTPOUT) with ESMTP id pB6GmAwv000907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 6 Dec 2011 10:48:20 -0600 (CST) Received: from slb-av-01.boeing.com (localhost [127.0.0.1]) by slb-av-01.boeing.com (8.14.4/8.14.4/DOWNSTREAM_RELAY) with ESMTP id pB6Glv49028735 for ; Tue, 6 Dec 2011 08:47:58 -0800 (PST) Received: from XCH-NWHT-08.nw.nos.boeing.com (xch-nwht-08.nw.nos.boeing.com [130.247.25.112]) by slb-av-01.boeing.com (8.14.4/8.14.4/UPSTREAM_RELAY) with ESMTP id pB6GlvBv028720 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=OK) for ; Tue, 6 Dec 2011 08:47:57 -0800 (PST) Received: from XCH-NW-08V.nw.nos.boeing.com ([130.247.25.89]) by XCH-NWHT-08.nw.nos.boeing.com ([130.247.25.112]) with mapi; Tue, 6 Dec 2011 08:47:57 -0800 From: "Loving, Kent" To: "Grub-devel@gnu.org" Date: Tue, 6 Dec 2011 08:47:55 -0800 Subject: does the chainloader command ever return? Thread-Topic: does the chainloader command ever return? Thread-Index: Acy0Ns2cbsULrVV0TQCoxtTWFe1f/A== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_CDEDD3F85588BD4DA6850F876161950B4C7C5FF267XCHNW08Vnwnos_" MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Solaris 9.1 X-Received-From: 130.76.96.56 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 16:48:20 -0000 --_000_CDEDD3F85588BD4DA6850F876161950B4C7C5FF267XCHNW08Vnwnos_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In all the grub config files I've scanned, chainloader is always the last c= ommand, which makes sense. But if there is an error in starting the chain l= oad, does chainloader return with some error code? I want a dual-boot system (windows XP/linux) that normally boots the window= s XP partition, but if that partition is not yet loaded or horribly corrupt= ed, I want grub to automatically boot the other (linux) partition. Kent Loving 425-315-3043 (cell) 206-544-8038 (desk) --_000_CDEDD3F85588BD4DA6850F876161950B4C7C5FF267XCHNW08Vnwnos_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In all the grub = config files I’ve scanned, chainloader is always the last command, wh= ich makes sense. But if there is an error in starting the chain load, does = chainloader return with some error code?

 

I want a dual-boot system (windo= ws XP/linux) that normally boots the windows XP partition, but if that part= ition is not yet loaded or horribly corrupted, I want grub to automatically= boot the other (linux) partition.

=  

 

Ken= t Loving
425-315-3043 (cell)
206-544-8038 (desk)

= --_000_CDEDD3F85588BD4DA6850F876161950B4C7C5FF267XCHNW08Vnwnos_-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RcP9y-0000Je-Mr for mharc-grub-devel@gnu.org; Sun, 18 Dec 2011 17:24:46 -0500 Received: from eggs.gnu.org ([140.186.70.92]:47106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcP9w-0000JY-1l for grub-devel@gnu.org; Sun, 18 Dec 2011 17:24:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RcP9u-0004We-Mn for grub-devel@gnu.org; Sun, 18 Dec 2011 17:24:44 -0500 Received: from chiark.greenend.org.uk ([212.13.197.229]:42177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcP9u-0004Wa-IX for grub-devel@gnu.org; Sun, 18 Dec 2011 17:24:42 -0500 Received: from [172.20.153.9] (helo=riva.pelham.vpn.ucam.org) by chiark.greenend.org.uk (Debian Exim 4.72 #1) with esmtp (return-path cjwatson@ubuntu.com) id 1RcP9s-0007DP-Pd for grub-devel@gnu.org; Sun, 18 Dec 2011 22:24:41 +0000 Received: from sarantium.pelham.vpn.ucam.org ([2001:470:95d9:0:21c:23ff:fe97:5cf2]) by riva.pelham.vpn.ucam.org with esmtp (Exim 4.72) (envelope-from ) id 1RcP9r-0003EF-0t for grub-devel@gnu.org; Sun, 18 Dec 2011 22:24:39 +0000 Received: from riva.dynamic.greenend.org.uk (localhost [127.0.0.1]) by sarantium.pelham.vpn.ucam.org (Postfix) with ESMTPS id 8E0A03E40C1 for ; Sun, 18 Dec 2011 22:24:36 +0000 (GMT) Date: Sun, 18 Dec 2011 22:24:35 +0000 From: Colin Watson To: grub-devel@gnu.org Subject: Re: does the chainloader command ever return? Message-ID: <20111218222435.GF24811@riva.dynamic.greenend.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 212.13.197.229 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2011 22:24:45 -0000 On Tue, Dec 06, 2011 at 08:47:55AM -0800, Loving, Kent wrote: > In all the grub config files I=E2=80=99ve scanned, chainloader is al= ways the last > command, which makes sense. But if there is an error in starting the= chain > load, does chainloader return with some error code? The 'chainloader' command itself only loads the image into memory and doesn't actually boot it (it will return an error if that fails). The thing that actually boots the image is the 'boot' command, which is implicit at the end of a menu entry. That will return an error if there is some error that GRUB is capable of catching, which basically boils down to memory handling errors. If something goes wrong after GRUB has handed over control, you're out of luck. > I want a dual-boot system (windows XP/linux) that normally boots the > windows XP partition, but if that partition is not yet loaded or hor= ribly > corrupted, I want grub to automatically boot the other (linux) parti= tion. If 'chainloader' is unable to load the sector(s) you ask for from the disk, then you can catch that in your configuration file and do something else instead. However, I rather suspect that this failure mode is unlikely compared to the possibility that GRUB would be able to load the sector but that it contains garbage, and in that case what will probably happen is that GRUB will transfer control to garbage which will do nothing sensible and hopefully halt the machine. There isn't a whole lot we can do about this; chainloading is a rather primitive boot protocol with very little in the way of available error checking. I suppose it might be possible to come up with some other way to check the integrity of the Windows XP boot sector. It might involve a custom GRUB module. --=20 Colin Watson [cjwatson@ubuntu.com] From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RdJcd-0002iy-QR for mharc-grub-devel@gnu.org; Wed, 21 Dec 2011 05:42:07 -0500 Received: from eggs.gnu.org ([140.186.70.92]:41147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdJcN-0002UW-Vi for grub-devel@gnu.org; Wed, 21 Dec 2011 05:41:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdJcF-0001fD-TS for grub-devel@gnu.org; Wed, 21 Dec 2011 05:41:51 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:38931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdJcF-0001dG-0B for grub-devel@gnu.org; Wed, 21 Dec 2011 05:41:43 -0500 Received: by wibhq12 with SMTP id hq12so2430535wib.0 for ; Wed, 21 Dec 2011 02:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Z+bUm6aFTZBf22Az3uc6k5x097nydWbyxhxcfyh/8M4=; b=FJ0Nsr9VbhVRk+dLI1PZFmHsQ0tnHrFh1F7KAme4mDy7KykP2/ppGaYnIOf/DQZpGe e4eH544ujmsk1fmeBdk2rfmJpy4l2b9KnhZLMSuZ1aFzztuHgX3btYIqezeLld2WXwxx N29UYn7iODSk0s6PbcrFbJe2hnmKHYhFITN8k= Received: by 10.180.107.134 with SMTP id hc6mr10490415wib.21.1324464101502; Wed, 21 Dec 2011 02:41:41 -0800 (PST) Received: from debian.x201.phnet (cx-public-docking-1-027.ethz.ch. [129.132.149.27]) by mx.google.com with ESMTPS id en20sm12394672wid.10.2011.12.21.02.41.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 02:41:39 -0800 (PST) Message-ID: <4EF1B7E1.30803@gmail.com> Date: Wed, 21 Dec 2011 11:41:37 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Icedove/3.1.16 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: does the chainloader command ever return? References: <20111218222435.GF24811@riva.dynamic.greenend.org.uk> In-Reply-To: <20111218222435.GF24811@riva.dynamic.greenend.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2011 10:41:59 -0000 >> I want a dual-boot system (windows XP/linux) that normally boots the >> windows XP partition, but if that partition is not yet loaded or horribly >> corrupted, I want grub to automatically boot the other (linux) partition. > I suppose it might be possible to come up with some other way to check > the integrity of the Windows XP boot sector. It might involve a custom > GRUB module. > For the case of Windows we can do better than that: we can skip boot sector altogether and load ntldr/bootmgr directly thus bootsector problems other the ones which make partition unreadable (in which case you'll get an FS error) are irrelevant. ntldr/bootmgr isn't thoroughly checked and may be corrupted in which case we're back to running garbage. However it's much less likely for the file with given name on apparently intact FS to be corrupted than the sector 0 of a partition with unknown FS status. This problem isn't unique to ntldr/bootmgr but other payloads are affected as well to various degrees. Whether doing more checks is warranted is unclear. Even perfectly correct image can fail because of corruption in other files or hw issues. While it's theoretically possible to simulate the whole boot to see if it fails, it's not practicable due to effort and boot time needed. Some simple checks would be good provided that they are fast and don't result in false negatives but are unlikely to make difference. Checksums and signatures are another story but unless it's maintained together with or inside the image, it's likely to fail on updates. We could check checksum and signatures on following payloads: -Linux (CRC32) -Solaris (ELF signature) Something else? However signature checking increases the dependencies of loader modules but it's probably small price to pay compared to the risk of loading and running damaged kernel. Bottom line is: you can't check for sure that something will boot, at most you can check that it wasn't damaged after compilation. -- Regards Vladimir 'φ-coder/phcoder' Serbinenko