Carlos Konstanski on 27 Mar 2005 19:39:12 -0000


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

Re: [PLUG] Need to reinstall grub


In case you're still trying to figure this one out:

I do this just often enough to sort of remember how to do it.  If this
doesn't work perfectly, at least it's on the right track.

1.  Boot up under a knoppix CD.  Use "knoppix 2" at the boot prompt to avoid a
     full GUI.

2.  cd /mnt brings you to the already-defined mount points.  Then
     mount your /boot partition with "mount /dev/hdb2 hdb2".  Notice that
     we're not using the fstab entry to mount /dev/hdb2.  Knoppix writes
     an fstab entry for it, but it uses switches that will not work for
     what we need to do.  So bypass fstab by specifying both the device
     and the mount point.

3.  Do we need to mount the root filesystem too?  I can't remember -
     probably not - but it couldn't hurt.

4.  Now that the /boot partition is mounted, we can install grub to it.
     Try "grub-install --root-directory=/mnt/hdb2 --recheck /dev/hdb".
     This will install grub to the MBR on /dev/hdb.  If you want to put
     it elsewhere, change the last arg to suit.

5.  Edit your menu.lst file, found (while up under knoppix) at
     /mnt/hdb2/grub/menu.lst.  Also edit your fstab file on your root
     filesystem.

6.  Reboot!  If you get a grub a grob prompt instead of a menu, type
     these 2 commands to get booted up (don't type the comments):

         root (hd1,1)                    // this is grub-ese for /dev/hdb2
         configfile /grub/menu.lst       // the leading slash may be unnecessary

That's it!  If you end up always getting a grub shell instead of a
configfile, it may be that grub is also installed to a partition, and
the active flag is set to that partition.  fdisk can fix probably fix that.
I've seen it happen, but never to me.  If it happened to me, I would
know how to fix it.  Think of it as added security; someone has to know
grub commands to boot your machine.  No good for remote servers, though
- they won't reboot unattended.

At least with grub, you have the ability to boot even if something is
not right.  With lilo, you'd be stuck.

Another command that can be added to a menu.lst entry or typed directly
in a grub shell is:

     setup (hd1,1)

This is analagous to the grub-install command.  You could do this while
booted up under knoppix too.  Typing "grub" will start a grub shell at
any time.  Putting the setup command in as an entry in the menu.lst file
has helped me on at least one occasion.  It allowed me to install grub
while not mounted or booted up or anything.  Typing the commands
manually would have had the same effect.

Hope this helps and I'm not way off base.

On Sun, 27 Mar 2005, Art Alexion wrote:

> Date: Sun, 27 Mar 2005 08:43:29 -0500
> From: Art Alexion <art.alexion@verizon.net>
> Reply-To: Philadelphia Linux User's Group Discussion List
>     <plug@lists.phillylinux.org>
> To: plug@phillylinux.org
> Subject: [PLUG] Need to reinstall grub
> 
> Grub was installed on my MBR on hda.  It seems that hda has given up the 
> ghost.  Not much lost (win98 that came with computer), but now I can't boot 
> (currently running knoppix).  Boot is a continuous loop from the mem test to 
> going through the BIOS-defined boot drives, then back to the mem test.
>
> How can I get the computer to boot from hdb (where linux, the kernel, and the 
> grub program are located).  To be more precise, I don't really understand 
> where the grub program is located, but I think most of it is in /boot/grub on 
> /dev/hdb2.
>
> If anyone can walk me through this using knoppix, that would be wonderful.  I 
> have the Knoppix 2.6.9 kernel loaded.  I know that the Ubuntu kernel on 
> /dev/hdb2 is a 2.6 kernel, but I am not sure of the exact version.
>
> Art
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug