LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-27-2005, 08:51 AM   #1
lixy
Member
 
Registered: Apr 2004
Posts: 120

Rep: Reputation: 15
write grub to the MBR


Hi all,

I had an erratic behavior from my system lately (debian "testing") after upgrading all the packages, I had a kernel panic message at boot and thus was stuck.
After fiddling a bit, I did a new fresh debian install that detected my old system and by some luck was able to boot my old system without the panic message once I added the intird option in the menu.lst of the new system next to the old kernel entry (and then giving the initrd image as parameter of course).
Now, I'd like to reinstall the old system's grub in the MBR (I added the initrd line in it) but have no idea how. Updare-grub does not seem to be doing the job (at least it doesn't say so in the man page).
Can anybody tell me what to do, please?
 
Old 08-27-2005, 09:54 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
If you know what partition the system is on it helps. You can actually use grub to help you find that.
So boot up into Linux and get to the grub tool with the command: grub
At the grub prompt use the following comands....
grub > find /sbin/init
That should get the available Linux partitions. For example, on my box .....
grub> find /sbin/init
(hd0,0)
(hd0,4)
(hd1,1)

Now, you use the partition for whichever distro you want to boot the grub menu from ....
grub> root (hd1,1)
Filesystem type is ext2fs, partition type 0x83

Now, you can tell grub to use the MBR with the command: setup (hd0)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd1,1)/boot/grub/stage2 /boot/
grub/grub.conf"... succeeded
Done.

Then exit the grub with this command:
grub> quit
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB MBR overwritten by WIN98 MBR TOuseef Linux - General 7 11-14-2004 04:25 PM
Lilo don't write on MBR clapton Slackware 7 10-11-2004 07:20 AM
Does LoadLin write to the MBR? jhecht Linux - Software 1 06-25-2004 10:50 AM
Can write GRUB at first sector of MBR invinciblemk Linux - Newbie 2 02-01-2004 08:59 PM
mbr had over write so lilo is gone how to rewrite lilo to mbr mch Linux - Software 4 10-25-2002 02:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:36 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
Open Source Consulting | Domain Registration