Need Help Editing Grub

Eric Shubert ejs at shubes.net
Sun Jan 24 20:59:06 MST 2010


Mark Phillips wrote:
> I found a helpful post at 
> http://ubuntuforums.org/showthread.php?t=159346. The best part is:
> 
> 3.Type "grub" ,which makes a grumb prompt appear.
> 
> 4.Type "find /boot/grub/stage1. youll get an response like "(hd0)" or in 
> my case (hd0,3),use whatever your computer spitts out for the next lines.
> 
> 5.Type "root (hd0,3).
> 
> 6.Type "setup (hd0,3)", *other instructions says to use "(hd0) ,and 
> thats fine if u want to write GRUB to the mbr. if you want to write it 
> to your linux root partition, then you want the number after the 
> comma,such as "(hd0,3).*
> 
> In my case, /boot/grub/stage1 is at (hd1,4), so i guess I need to try
> grub
> root (hd1,4)
> setup (hd1)
> quit.
> 
> Sound right?

That sounds right for you (no period after quit though).

> Mark
> 
> On Sun, Jan 24, 2010 at 7:34 PM, Mark Phillips 
> <mark at phillipsmarketing.biz <mailto:mark at phillipsmarketing.biz>> wrote:
> 
>     Eric,
>      
>     Maybe this is what KP was trying to say
>     grub
>     root (hd1,0)
>     setup(hd1)
>     quit
> 
>     Because, when I boot the system now, hd1 is my Linux drive. So I
>     have to setup grub on my Linux drive while it is running. Then I
>     switch the Linux drive to the first ide channel, so it becomes the
>     first mbr to be read, and it has grub installed there. I believe the
>     current configuration has the mbr on the first ide drive (windows)
>     point to the mbr on the second ide drive (linux and grub). I have to
>     break that chain so the mbr of the second ide drive is now the boot mbr.
>      
>     The alternative would be to switch drives now, boot with a rescue
>     disk and perform
>     grub
>     root (hd0,0)
>     setup (hd0)
>     quit
> 
>     Does this make sense?
>      
>     Mark
> 
> 
>     On Sun, Jan 24, 2010 at 7:18 PM, Eric Shubert <ejs at shubes.net
>     <mailto:ejs at shubes.net>> wrote:
> 
> 
>         Mark,
>         I don't understand entirely the commands that kitepilot said to
>         use either.
> 
>         Your menu.lst file looks correct.
> 
>         savedefault, along with the "default" setting listed earlier in
>         menu.lst, controls which kernel is used as the default. savedefault
>         means "use me to boot next time", so generally speaking, the
>         computer
>         boots whichever OS was running last. Providing the "default" setting
>         corresponds to this behavior.
> 
>         makeactive and chainloader commands are used with windows
>         partitions.
>         makeactive makes the partition active (whatever that means, but
>         windows
>         seems to require it), and chainloader, which effectively passes
>         control
>         over to the windows loader program, not unlike what happens when the
>         bios passes control to grub. At least that's what I would guess.
> 
>         If grub is not installed in the mbr of the 2nd drive, it needs
>         to be. I
>         think that might be what kp was trying to get to. In order to
>         install
>         grub on mbr of drive hda, issue the "grub" command at the cli.
>         Then at
>         the grub prompt, enter the part after the prompt:
>         grub> root (hd0,0)
>         grub> setup (hd0)
>         grub> quit
> 
>         If your OS is the 2nd partition on the drive, then you'd specify:
>         grub> root (hd0,1)
> 
>         If your drive is hdb, then you'd use hd1 in place of hd0.
> 
>         That drive would then run grub when it's booted.
> 
>         --
>         -Eric 'shubes'
> 
> 
>         Mark Phillips wrote:
>          > This is what I have in menu.lst
>          >
>          > title           Debian GNU/Linux, kernel 2.6.26-2-686
>          > root            (hd1,4)
>          > kernel          /boot/vmlinuz-2.6.26-2-686 root=/dev/hdb5 ro
>          > initrd          /boot/initrd.img-2.6.26-2-686
>          >
>          > title           Microsoft Windows XP Professional
>          > root            (hd0,0)
>          > savedefault
>          > makeactive
>          > chainloader     +1
>          >
>          > So, I change
>          > title           Debian GNU/Linux, kernel 2.6.26-2-686
>          > root            (hd1,4)
>          > kernel          /boot/vmlinuz-2.6.26-2-686 root=/dev/hdb5 ro
>          > initrd          /boot/initrd.img-2.6.26-2-686
>          >
>          > to
>          >
>          > title           Debian GNU/Linux, kernel 2.6.26-2-686
>          > root            (hd0,4) <-- change1 to 0 here
>          > kernel          /boot/vmlinuz-2.6.26-2-686 root=/dev/hda5 ro
>         <--- change
>          > b to a here
>          > initrd          /boot/initrd.img-2.6.26-2-686
>          >
>          > and remove
>          > title           Microsoft Windows XP Professional
>          > root            (hd0,0)
>          >
>          > What about these bad boys.....
>          > savedefault
>          > makeactive
>          > chainloader     +1
>          >
>          > I still don't understand the grub commands that I was told to
>         use.
>          >
>          > Mark
>          >
>          > On Sun, Jan 24, 2010 at 5:58 PM, Eric Shubert <ejs at shubes.net
>         <mailto:ejs at shubes.net>
>          > <mailto:ejs at shubes.net <mailto:ejs at shubes.net>>> wrote:
>          >
>          >     "every reference to hd1,0 is converted to hd0,0"
>          >     You need to edit this manually. hd1 in grub corresponds
>         to hdb in linux,
>          >     and hd0 in grub is hda in linux.
>          >
>          >     Mark Phillips wrote:
>          >      > I understand the flow....shouldn't I tell grub somehow
>         that the
>          >     new boot
>          >      > drive is hd0,0? In your steps below, is there perhaps,
>         a typo?
>          >      >
>          >      > Thanks!
>          >      >
>          >      > Mark
>          >      >
>          >      > On Sun, Jan 24, 2010 at 3:58 PM,
>         kitepilot at kitepilot.com <mailto:kitepilot at kitepilot.com>
>          >     <mailto:kitepilot at kitepilot.com
>         <mailto:kitepilot at kitepilot.com>>
>          >      > <mailto:kitepilot at kitepilot.com
>         <mailto:kitepilot at kitepilot.com> <mailto:kitepilot at kitepilot.com
>         <mailto:kitepilot at kitepilot.com>>>
>          >     <kitepilot at kitepilot.com <mailto:kitepilot at kitepilot.com>
>         <mailto:kitepilot at kitepilot.com <mailto:kitepilot at kitepilot.com>>
>          >      > <mailto:kitepilot at kitepilot.com
>         <mailto:kitepilot at kitepilot.com>
>          >     <mailto:kitepilot at kitepilot.com
>         <mailto:kitepilot at kitepilot.com>>>> wrote:
>          >      >
>          >      >      >> 1. How do I change grub on the Linux drive
>         (hdb) to say
>          >     "the ...
>          >      >     If you are running GRUB 0.XX (GRUB 1.XX is different):
>          >      >     Boot your Debian machine and as root run:
>          >      >     grub
>          >      >     root (hd1,0)
>          >      >     root (hd1)
>          >      >     It should answer that it found the stages, verify
>         that there
>          >     are no
>          >      >     errors.
>          >      >     quit
>          >      >
>          >      >
>          >      >     Then take a backup of /boot/grub/menu.lst and and
>         make sure that
>          >      >     everything
>          >      >     is either using UUID(s) or labels or every
>         reference to hd1,0 is
>          >      >     converted
>          >      >     to hd0,0
>          >      >
>          >      >     Verify your /etc/fstab likewise.
>          >      >
>          >      >
>          >      >      > 2. Do I move the second drive to the first ide
>         port, or
>          >     leave it
>          >      >     as ...
>          >      >     Shutdown, pull the cable from the windoze drive
>         and plug it
>          >     to Linux
>          >      >     drive.
>          >      >     Turn on and pray...   :)
>          >      >     Free advice, you can't sue me   ;-)
>          >      >     YMMV
>          >      >     ET
>          >      >
>          >      >
>          >      >
>          >      >
>          >      >     Mark Phillips writes:
>          >      >
>          >      >      > I have two ide drives in one machine - drive 1 is a
>          >     Windows drive
>          >      >     and drive
>          >      >      > 2 is a Linux drive. Using grub, I can boot into
>         either
>          >     windows or
>          >      >     debian. I
>          >      >      > want to remove the windows drive and replace it
>         with a larger,
>          >      >     blank drive
>          >      >      > for backup storage. I have a feeling if I just
>         remove the
>          >     first
>          >      >     drive and
>          >      >      > put the new one there, the machine will not
>         boot, since
>          >     the MBR
>          >      >     is probably
>          >      >      > on the first drive (it came with the machine,
>         and I just added
>          >      >     the second
>          >      >      > drive for Linux). My questions:
>          >      >      >
>          >      >      > 1. How do I change grub on the Linux drive
>         (hdb) to say "the
>          >      >     windows drive
>          >      >      > is dead, boot here instead, long live linux"?
>          >      >      >
>          >      >      > 2. Do I move the second drive to the first ide
>         port, or
>          >     leave it
>          >      >     as the
>          >      >      > second ide drive and put the new drive in the
>         fist ide port?
>          >      >      >
>          >      >      > Thanks!
>          >      >      >
>          >      >      > Mark
>          >      >     ---------------------------------------------------
>          >      >     PLUG-discuss mailing list -
>          >     PLUG-discuss at lists.plug.phoenix.az.us
>         <mailto:PLUG-discuss at lists.plug.phoenix.az.us>
>          >     <mailto:PLUG-discuss at lists.plug.phoenix.az.us
>         <mailto:PLUG-discuss at lists.plug.phoenix.az.us>>
>          >      >     <mailto:PLUG-discuss at lists.plug.phoenix.az.us
>         <mailto:PLUG-discuss at lists.plug.phoenix.az.us>
>          >     <mailto:PLUG-discuss at lists.plug.phoenix.az.us
>         <mailto:PLUG-discuss at lists.plug.phoenix.az.us>>>
>          >      >     To subscribe, unsubscribe, or to change your mail
>         settings:
>          >      >    
>         http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>          >      >
>          >      >
> 
> 
>         --
>         -Eric 'shubes'
> 
>         ---------------------------------------------------
>         PLUG-discuss mailing list -
>         PLUG-discuss at lists.plug.phoenix.az.us
>         <mailto:PLUG-discuss at lists.plug.phoenix.az.us>
>         To subscribe, unsubscribe, or to change your mail settings:
>         http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> 
> 
> 


-- 
-Eric 'shubes'



More information about the PLUG-discuss mailing list