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.
"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.
Arrgggh. Nothing's perfect; I guess I'm going to have to muck with it. I'll probably have to warn the readers and suggest they hard code which one (if any) to use.
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...
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 document.
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.