[Top][All Lists]

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

Re: does the chainloader command ever return?

From: Colin Watson
Subject: Re: does the chainloader command ever return?
Date: Sun, 18 Dec 2011 22:24:35 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Dec 06, 2011 at 08:47:55AM -0800, Loving, Kent wrote:
>    In all the grub config files I’ve scanned, chainloader is always 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 horribly
>    corrupted, I want grub to automatically boot the other (linux) partition.

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.

Colin Watson                                       address@hidden

reply via email to

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