Is there any way to detect which boot loader is the working one? Simply detecting whether a grub or lilo package is installed may not be sufficient, especially in the case where both are installed. I suppose I could look to see which is more recent, grub.conf or lilo.conf, but I can think of several scenarios unde which this would fail.
It's time to update my bare metal recovery scripts (http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html) to handle grub, and I'd like to detect the current boot loader if possible.
On Monday 27 October 2003 23:07, Charles Curley wrote:
Is there any way to detect which boot loader is the working one? Simply detecting whether a grub or lilo package is installed may not be sufficient, especially in the case where both are installed. I suppose I could look to see which is more recent, grub.conf or lilo.conf, but I can think of several scenarios unde which this would fail.
It's time to update my bare metal recovery scripts (http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWT O.html) to handle grub, and I'd like to detect the current boot loader if possible.
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
Someone else will have to pipe up about LILO though...
Regards, Mike Klinke
* Mike Klinke lsomike@futzin.com [27-Oct-2003 23:28]:
On Monday 27 October 2003 23:07, Charles Curley wrote:
Is there any way to detect which boot loader is the working one?
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
Someone else will have to pipe up about LILO though...
LILO is also detectable:
[root@monitorus2 root]# dd ibs=512 count=1 if=/dev/hda | grep LILO 1+0 records in 1+0 records out Binary file (standard input) matches
If you will pipe "dd" output through "strings" before "grep", you will see "|lbaLILO", if LILO is installed or "GRUB", if GRUB is installed.
On Tuesday 28 October 2003 01:39, Leonid Mamtchenkov wrote:
- Mike Klinke lsomike@futzin.com [27-Oct-2003 23:28]:
On Monday 27 October 2003 23:07, Charles Curley wrote:
Is there any way to detect which boot loader is the working one?
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
Someone else will have to pipe up about LILO though...
LILO is also detectable:
[root@monitorus2 root]# dd ibs=512 count=1 if=/dev/hda | grep LILO 1+0 records in 1+0 records out Binary file (standard input) matches
If you will pipe "dd" output through "strings" before "grep", you will see "|lbaLILO", if LILO is installed or "GRUB", if GRUB is installed.
Yep, that's nice ;) In addition you might want to see if the boot loader is installed in /dev/hda | /dev/sda | /dev/whatever or in /dev/hda1 for example if this is a multiboot system (bsd, linux, window$). Long time ago ;))) I used the Win9x MBR with active partition /dev/hda1 where my /boot was (saved me a lot of pain when I had to reinstall win9x).
There are some more boot loaders I know of: aspldr - asploader - it uses some sort of dos booting -> mbr.sys, bootsect.sys, aspldr.sys, aspldrcd.sys and mouse.com. It's mbr.sys contains only 3 > 4 byte strings: "ro;^\uj", "VPP2" and "MBR Error". I have one ASPLinux arround so if ye are interested I can look further... sbm - Smart Boot Manager, which I saw in debian distro as far as I remember. It's a nice thing ;) can boot from CD on systems without CD-Rom boot support, can be installed on floppy and it can install itself on hdd later... used to love it year or two ago... ... and... maybe, this can be solved for fedora by simply putting an /etc/bootloader.conf with a single line bootloader="whatever" ;)... just an idea ;)
On Mon, Oct 27, 2003 at 04:07:15PM -0700, Charles Curley wrote:
Is there any way to detect which boot loader is the working one? Simply detecting whether a grub or lilo package is installed may not be sufficient, especially in the case where both are installed. I suppose I could look to see which is more recent, grub.conf or lilo.conf, but I can think of several scenarios unde which this would fail.
It's time to update my bare metal recovery scripts (http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html) to handle grub, and I'd like to detect the current boot loader if possible.
The solutions suggested seem too complicated. Just reboot. Unless things have changed radically the lilo boot screen looks completely different that the grub boot screen. ------------------------------------------- Aaron Konstam Computer Science Trinity University 715 Stadium Dr. San Antonio, TX 78212-7200
telephone: (210)-999-7484 email:akonstam@trinity.edu
Aaron Konstam wrote:
On Mon, Oct 27, 2003 at 04:07:15PM -0700, Charles Curley wrote:
Is there any way to detect which boot loader is the working one? Simply detecting whether a grub or lilo package is installed may not be sufficient, especially in the case where both are installed. I suppose I could look to see which is more recent, grub.conf or lilo.conf, but I can think of several scenarios unde which this would fail.
It's time to update my bare metal recovery scripts (http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html) to handle grub, and I'd like to detect the current boot loader if possible.
The solutions suggested seem too complicated. Just reboot. Unless things have changed radically the lilo boot screen looks completely different that the grub boot screen.
The original post very obviously needs a way to detect Grub and Lilo programmatically.
The solutions suggested are appropriate. Maybe you need to read the original post carefully.
Cheers, Michael
Watchout on this one - I've got a machine here which has had both bootloaders installed, and both GRUB and LILO show up in the MBR - but if you pipe it through strings - like Leonid said - it looks like you will see only see 'lbaLILO' on the machine where it's active. Here's what works for me:
#!/bin/bash dd ibs=512 count=1 if=/dev/hda 2>&1 | strings | \ grep GRUB 2>&1 > /dev/null isgrub=$? if [ $isgrub -eq 0 ] ; then echo "Grub" else dd ibs=512 count=1 if=/dev/hda 2>&1 | strings | \ grep lbaLILO 2>&1 > /dev/null islilo=$? if [ $islilo -eq 0 ] ; then echo "Lilo" else echo "Unknown" fi fi
Michael Kearey wrote:
Aaron Konstam wrote:
On Mon, Oct 27, 2003 at 04:07:15PM -0700, Charles Curley wrote:
Is there any way to detect which boot loader is the working one? Simply detecting whether a grub or lilo package is installed may not be sufficient, especially in the case where both are installed. I suppose I could look to see which is more recent, grub.conf or lilo.conf, but I can think of several scenarios unde which this would fail.
It's time to update my bare metal recovery scripts (http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html)
to handle grub, and I'd like to detect the current boot loader if possible.
The solutions suggested seem too complicated. Just reboot. Unless things have changed radically the lilo boot screen looks completely different that the grub boot screen.
The original post very obviously needs a way to detect Grub and Lilo programmatically.
The solutions suggested are appropriate. Maybe you need to read the original post carefully.
Cheers, Michael
-- fedora-list mailing list fedora-list@redhat.com http://www.redhat.com/mailman/listinfo/fedora-list
On Tue, 2003-10-28 at 10:39, Erik Williamson wrote:
Watchout on this one - I've got a machine here which has had both bootloaders installed, and both GRUB and LILO show up in the MBR - but if you pipe it through strings - like Leonid said - it looks like you will see only see 'lbaLILO' on the machine where it's active. Here's what works for me:
Be careful. lbaLILO will only show up if lba32 is enabled in lilo.conf IIRC
Cheers
Jeremy