Beginning to understand grub
From: Leonard Evens (len_at_math.northwestern.edu)
Date: 01/31/05
- Next message: prg: "Re: Authenticate a linux client to a directory (ldap)"
- Previous message: Madhusudan Singh: "A question regarding g3data"
- Next in thread: prg: "Re: Beginning to understand grub"
- Reply: prg: "Re: Beginning to understand grub"
- Reply: Lawrence D'Oliveiro: "Re: Beginning to understand grub"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 17:45:40 -0600
This started because upgrading to XP in a dual boot system wrote over
grub in the MBR, making it difficult to boot Linux. I got lots of good
advice, some of it even right, but I felt uneasy so I spent some time
studying the documentation, looking at web sites and trying some
experiments. I haven't yet actually put grub back in the MBR, but I've
managed to create a boot floppy which brings up the grub menu I had
before. It works as usual, allowing me to scroll down to various
choices for Linux kernels or Windows or just boots Linux after the
timeout. Since there is some misleading information about this out on
the web, let me tell you what worked. If anyone finds anything wrong
below, please let me know.
Remember I had intact grub files in my Linux system to start, in
/boot/grub. The following assumes you have a running system, but you
can also do it from a rescue system. It works for Fedora Core 2. In
other systems the configuration file may be called menu.lst. With
Fedora, menu.lst is a link to grub.conf, which is apparently what grub
expects.
mkfs /dev/fd0
mount /dev/fd0 /mnt/floppy #or anywhere convenient
mkdir -p /mnt/floppy/boot/grub
cd /boot/grub
cp stage1 stage2 grub.conf /mnt/floppy/boot/grub
ln -s /mnt/floppy/boot/grub/grub.conf /mnt/floppy/boot/grub/menu.lst
# I don't know if the above link is necessary, but I'm coping what is in
# /boot/grub.
umount /dev/fd0
The run grub and use the following commands
grub> root (fd0) # I don't know if this is necessary
grub> setup (fd0)
You then get a series of messages about stage1, stage 1_5, and stage2.
You also get a message about using the configurations file grub.conf.
With this floppy, I can boot my system. grub reads the configuration
file, which puts up the usual menu on the screen. It gets the graphical
splash screen off the hard disk since the grub.conf file sets root to
the /boot partition and grub now knows where to look. You can then
scroll down or whatever, press enter, and you boot the desired OS.
I think I now understand the setup command. It copies relevant parts of
the raw stage1 file into the argument, usually the MBR of the first
disk. In the MBR, it leaves certain information alone,in particular,
the partition table. It then changes stage2, so that knows where to
look for additional information, including where the configuration file
is and that it should load it.
When you boot, the computer goes to the MBR, where it finds the stage1
grub code. That contains information about where stage2 is, and the
system then jumps there. That code tells it to put up the splash screen
based on the configuration file information. You then make your choice
and boot.
I've also tried to decypher the shell script grub-install. It basically
runs setup after it has copied the relevant staging files from wherever
they were installed, in this case, /usr/share/grub/i386... I presume
during installation of Fedora Core, the Anaconda script first creates an
appropriate grub.conf file, and then runs grub-install.
- Next message: prg: "Re: Authenticate a linux client to a directory (ldap)"
- Previous message: Madhusudan Singh: "A question regarding g3data"
- Next in thread: prg: "Re: Beginning to understand grub"
- Reply: prg: "Re: Beginning to understand grub"
- Reply: Lawrence D'Oliveiro: "Re: Beginning to understand grub"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|