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

Re: Boot Loader Detection: GRUB or LILO?

On Tue, Oct 28, 2003 at 09:23:52PM +0200, Doncho N. Gunchev wrote:
> > On Tuesday 28 October 2003 20:06, Charles Curley wrote:

> detecting presence of grub in MBR:
> http://mail.gnu.org/archive/html/bug-grub/2003-01/msg00062.html

Looks very useful, thanks. It is useful to have several MBRs from
various systems.

> http://www.singlix.com/trdos/MBR.txt could also help I think...
> | --- cut ---
> | Where stuff is:
> | 
> |    The MBR program code starts at offset 0000.
> |    The MBR messages start at offset 008b.
> |    The partition table starts at offset 00be.
> |    The signature is at offset 00fe.
> | --- cut ---
> I think the first, third and last offsets can be trusted and
> "The MBR messages" are unsafe to use. 

I think you are right here. All BIOSes expact the first and last, and
most FDISK programs expect the third.

> Probably a "collection" of code parts can help a program guess which
> boot loader is installed...

Agreed. I was thinking of comparing sections of the first stage
loaders from the local LILO and GRUB installations & see what I
found. (Assuming I found both installed on the working Linux system.)

> I don't think grub/lilo/other do change their MBR
> code too frequently. <joke>You can even include virus detection
> code in that collection ;)))</joke>
> http://www.bsdg.org/swag/DRIVES/0099.PAS.html
> http://linux.tuwien.ac.at/fwiso/CD-Inhalt/usr/sbin/detectloader
> this one looks like boot loader detection code to me :)

It sure does. I'll haul it in and play with it when I get a
chance. It's GPLled, so I should be able to use it with no
problems. Also, my script that creates the restore-time scripts is
perl, so integration will be easy. :-)

> It will not be an easy task to find the actual boot loader for the
> active distro easy if you have for example some bootloader in MBR,
> LILO in /dev/hda1, GRUB in /dev/hda2 and OTHER in /dev/hda3. Probably
> looking which partition is mounted as /boot in such scenario can help
> but I'm not 101% sure.

Right. I'm mainly worried about the MBR, and will assume that the boot
records for the working partition can be restored with the same boot
loader installer. I.e. if the user has LILO on the MBR, they have LILO
in the partion boot record for the partition from which they booted to
run the bare metal restore scripts. All I have to do is get their
Linux partition(s) barely running so they can fire up their tape
drive, CD-ROM, etc. for the next stage. 

My scripts rebuild the partition table for one or more hard drives,
and install ext[2-3] and some FAT and VFAT file systems, and finally
restore a minimal Linux. Anything else, they're on their own. So this
means I should have a write-up on the assumptions I've made in the

> Hmm... interesting problem to solve :) I'm interested and would like
> to help if I can ;)

Thanks. It's not the highest priority on my list of things to do, but
I'm going to work on it as I can over the next few weeks. I'll keep
you posted off-list.


Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB

Attachment: pgp00063.pgp
Description: PGP signature

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