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

Re: Boot Loader Detection: GRUB or LILO?



> On Tuesday 28 October 2003 20:06, Charles Curley wrote:
> I've had an interruption in my email service and don't have individual
> email responses here to which to reply. Fortunately, I can read the
> archive and will try to respond here.
>
> Mike Klinke <lsomike futzin com>
>
> > Would this method be of any use? Use "dd" to read the MBR, assuming
> > that's where your boot loader resides.  I know that the word "GRUB"
> > will appear; for example:
> >
> > #dd ibs=512 count=1 if=/dev/hda | grep -i grub
> > Binary file (standard input) matches
>
> It will tell you if grub has been used, not necessarily if it is the
> current boot loader. I tried that on my test system and found both the
> keywords LILO and GRUB in its MBR (they are in two different places in
> the MBR). I have not yet tried re-running lilo on that system to see
> if lilo will clobber the GRUB keyword. But I know that grub does not
> clobber the LILO keyword.

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

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. Probably a "collection"
of code parts can help a program guess which boot loader is
installed... 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 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.
Hmm... interesting problem to solve :) I'm interested and would like
to help if I can ;)

>
> "Doncho N. Gunchev" <mr700 globalnet bg>
>
> > ... and... maybe, this can be solved for fedora by simply putting an
> > /etc/bootloader.conf with a single line bootloader="whatever"
> > ;)... just an idea ;)
>
> That would solve it for Fedora, but won't help non-fedora users. Also,
> what if the user switches to a different boot loader? The new boot
> loader would have to know to over-write bootloader.conf.
true, true :((( too sad but true :(((, fedora can still have
/etc/bootloader.conf or /etc/sysconfig/bootloader, but this does not
generaly solve the problem...

-- 
Regards,
  Doncho N. Gunchev




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