LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2004, 11:24 AM   #1
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Rep: Reputation: 30
Grub boot loader


Hey,
I recently reinstalled Windows XP on the same partition as it was before with RedHat 9.0 on the other. However, now when I restart my computer, it skips the bootloader and boots right into Windows XP. Does anyone know how I can get the bootloader to come up again everytime I restart without having to reinstalled RedHat? Thanks in advance.
 
Old 03-22-2004, 12:55 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
The problem is that the Windows XP install over-wrote your boot sector. To replace it so that grub launches instead of the XP boot loader, you need to do the following.

Put your linux install CD into the drive and boot from it. At the boot prompt type:

linux rescue

When you get a command prompt, type:

% chroot /mnt/sysimage

Now type:

% /sbin/grub-install /dev/hda

Note: /dev/hda is probably correct, but you may need to change /dev/hda to whatever drive you boot from. Consult the following guide:

Primary Master /dev/hda
Primary Slave /dev/hdb
Secondary Master /dev/hdc
Secondary Slave /dev/hdd
Tertiary Master /dev/hde
Tertiary Slave /dev/hdf
Quaternary Master /dev/hdg
Quaternary Slave /dev/hdh

If you are using scsi, then you will need to put the /dev/sd? of your scsi device.

Hope this helps,

Forrest

Last edited by forrestt; 03-22-2004 at 12:59 PM.
 
Old 03-22-2004, 07:34 PM   #3
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
It said I was unable to change the root directory after that first command. I can boot into RedHat fine with a boot floppy disk. Is there a easier way to do it from RedHat? Thanks for your help.
 
Old 03-22-2004, 07:42 PM   #4
sirpimpsalot
Member
 
Registered: Feb 2004
Posts: 141

Rep: Reputation: 15
simplest method.... boot to a dos or windows 9x floppy and type

fdisk/MBR

rewrites the master boot record.
 
Old 03-22-2004, 08:41 PM   #5
Brane Ded
Member
 
Registered: Nov 2003
Location: over there
Distribution: Debian Testing
Posts: 191

Rep: Reputation: 30
fdisk /mbr won't restore his bootloader.

Quote:
It said I was unable to change the root directory after that first command. I can boot into RedHat fine with a boot floppy disk. Is there a easier way to do it from RedHat? Thanks for your help.
Get to a command line, and type "grub-install /dev/hda" like forrestt said, replacing hda with the appropriate device.
 
Old 03-23-2004, 12:46 AM   #6
dubya
Member
 
Registered: Mar 2004
Location: Kitchener, Ontario, Canada
Posts: 386

Original Poster
Rep: Reputation: 30
Thanks for your help everyone. As root, grub-install /dev/hda did it. Thanks again.
 
Old 04-30-2004, 10:18 AM   #7
ruzer
LQ Newbie
 
Registered: May 2002
Posts: 5

Rep: Reputation: 0
Hi,

I have a similar problem, but I don't have a floppy drive or a rescue disk. I booted up from knoppix, and can access my hard disk partitions, but i can't get grub to install back on the mbr. Here's what happens:

root@ttyp0[/]# chroot /mnt/hda4 grub-install /dev/hda
/dev/hda does not have any corresponding BIOS drive

I think it might be because I booted from knoppix so /mnt/hda4/proc is empty, whereas /proc/ is full of stuff (i presume from the knoppix boot process)

Does anyone know what to do?

Cheers
Ruzer
 
Old 04-30-2004, 10:29 AM   #8
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
The command needs to be separated (Not sure if you did this correctly and typed it differently in the post, or if you didn't do it correctly). It should be:

root@ttyp0[/]# chroot /mnt/hda4
root@ttyp0[/]# grub-install /dev/hda

However, hda might not be correct. See my above post regarding drive assignments. If you do:

root@ttyp0[/]# ls /mnt/hda4

do you see your system? If you do, then hda is correct. If you do not, then you need to determine where your system is really located.

Another thing you might want to try is to copy all of the grub stuff from your real systems /etc to /etc on the knoppix system. After it is all copied, then run the grub-install command and see if that works. I have never done it that way before, but it might work. Post back and let me know how things are working.

Forrest
 
Old 04-30-2004, 10:46 AM   #9
ruzer
LQ Newbie
 
Registered: May 2002
Posts: 5

Rep: Reputation: 0
i separated the commands, and i get the same

root@ttyp0[/]# chroot /mnt/hda4
bash-2.05b# grub-install /dev/hda

when i run:
root@ttyp0[/]# ls /mnt/hda4

it lists all the system folders, so this is where the actual system is.

First I copied from /mnt/hda4/etc/ to /etc/

Then i tried to run grub-install /dev/hda4, and I got the same error as before, (no matching device in BIOS, or something similar)

Then I tried to copy from /proc/* to /mnt/hda4/proc/ and the a few files were copied, and then the system just hung(!)

Can I tell grub-install to use the /proc folder of knoppix?

Is there a gentoo rescue image i can download anywhere?

Cheers
Ruadhan
 
Old 04-30-2004, 10:57 AM   #10
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
run the mount command
root@ttyp0[/]# mount

and look for the line that lists /mnt/hda4. is the device that is mounted there /dev/hda4 or something else? If it is something else, replace that with the /dev/hda in the grub-install command, but leave off the 4. If it is /dev/hda4, then write back and I'll see if I can come up with something else.

Forrest
 
Old 04-30-2004, 11:04 AM   #11
ruzer
LQ Newbie
 
Registered: May 2002
Posts: 5

Rep: Reputation: 0
it is /dev/hda4 !

Full listing:

/dev/root on / type ext2 (rw)
/dev/cdrom on /cdrom type iso9660 (ro)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/ramdisk on /ramdisk type tmpfs (rw, size=611168k)
usb on /proc/bus/usb type usbdevfs (rw,devmode=0666)
automount(pid403) on /mnt/auto type autofs (rw, fd=4,pgrp=403,minproto=2,maxproto=4)
/dev/hda4 on /mnt/hda4 type reiserfs (rw, nosuid, nodev)
/dev/hda1 on /mnt/hda1 type ext2 (rw, nosuid,nodev)

Ruadhan
 
Old 04-30-2004, 11:30 AM   #12
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Is grub configured to load into the mbr or the first partition? If it is in the partition, then the problem might be the nodev option for /dev/hda1 (although I'm not super familiar with that option). Try remounting it without the nodev option

root@ttyp0[/]# umount /dev/hda1
root@ttyp0[/]# mount /dev/hda1 /mnt/hda1

Let me know,

Forrest
 
Old 04-30-2004, 11:43 AM   #13
ruzer
LQ Newbie
 
Registered: May 2002
Posts: 5

Rep: Reputation: 0
i unmounted and then mouted as you said, but grub-install /dev/hda still gives same error

here is the grub.conf file that is located at /mnt/hda1/grub:

default 0
timeout 5
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Linux 2.4.25-gentpp-r2
root (hd0,0)
kernel /vmlinuz-2.4.25-r2 root=/dev/hda4

title=Windows
root(hd0,1)
makeactive
chainloader +1


Does this tell you where its configured to load?
 
Old 04-30-2004, 12:35 PM   #14
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Apparently this is a problem with gentoo. Here is a link to the chapter on installing the boot-loader in gentoo:

http://www.gentoo.org/doc/en/handboo...?part=1&chap=9

Basically they want you to install grub with the interactive grub shell.

Hope this helps.
 
Old 05-04-2004, 07:40 AM   #15
ruzer
LQ Newbie
 
Registered: May 2002
Posts: 5

Rep: Reputation: 0
hey forrestt,

thanks for all your posts- i'll give this a go later on and report any successes

cheers
ruzer
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless Keyboard not working to select boot options (Grub boot loader) psrini_vasan Fedora 7 12-16-2009 06:45 PM
GRUB boot loader blocking windows boot julienroger Linux - Newbie 3 10-12-2004 02:11 PM
Grub boot loader menu shows two linux boot options pramos Linux - Newbie 3 09-13-2004 12:40 AM
Need help with boot loader. Multi boot questions. Grub? 1993gt40 Linux - Software 1 10-16-2003 09:28 PM
How to add a boot record which used to startup windows under my Grub boot loader? yunxiang Linux - Newbie 6 02-01-2003 03:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration