LinuxQuestions.org
Help answer threads with 0 replies.
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 09-16-2006, 01:53 PM   #1
android6011
Member
 
Registered: May 2005
Posts: 255

Rep: Reputation: 30
restore grub after xp install


I installed Windows XP after Debian Etch, because I wasnt sure if I even wanted windows any more. So now grub is gone, and all I have is the net install cd for Etch. How can I restore grub?
 
Old 09-17-2006, 10:47 AM   #3
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Actually the easiest way is

(a) boot up any Live Linux CD,
(b) obtain root privileage or to become the super user, command="su",
(c) create a temporary directory in /mnt, command="mkdir /mnt/temp", of the boot-up Linux
(d) mount the Debian root partition, command="mount /dev/hda2 /mnt/temp" assuming Debian in hda2
(e) Change root to Debian, command="chroot /mnt/temp", and
(f) ask Grub to be installed in the disk hda again, command="grub-install /dev/hda"

You can then "exit" and "reboot" and Grub will be there waiting to greet you.

You need root privileage to play around with the system files. The Chroot command actually puts you inside Debian.
 
Old 09-17-2006, 11:10 AM   #4
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,884
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Here are a couple ways of doing it and hopefully one of them will work for you:

Boot with a Knoppix CD (or some other live-cd), or use a rescue/boot floppy like Tomsrtbt ( http://www.toms.net/rb/ ); determine your root partition and mount it to a temporary mount point; then chroot into it; then reinstall GRUB:

sudo mkdir /mnt/temp

sudo mount /dev/hda1 /mnt/temp
(change /dev/hda1 to match your own root partition)

sudo chroot /mnt/temp

sudo grub-install /dev/hda

or...

determine your root partition, then mount it "dev" option enabled with write permissions. If the filesystem isn't mounted you'll need to mount it like this (be sure to change "hda1" and "hda" to match the location/device in your own system):

sudo mount -o dev,rw /mnt/hda1

if it's already mounted, remount it like this:

sudo mount -o remount,dev,rw /mnt/hda1

now restore grub like this:

sudo chroot /mnt/hda1 grub-install /dev/hda

if it doesn't work using chroot, try remounting as outlined above and do:

sudo grub-install -root-directory=/mnt/hda1 /dev/hda

Kanotix has an option to "Restore Grub", simply boot with the livecd and choose restore grub.
 
  


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
Restore GRUB Nilesh.Shah Linux - Hardware 6 01-09-2010 11:43 AM
How to restore Grub after Win Xp install MRMadhav General 18 04-04-2008 08:20 AM
Install another MS OS and restore Grub? luwigie Linux - General 5 08-30-2004 01:30 PM
How can I restore GRUB ? xtrips Linux - Software 5 07-30-2003 03:22 PM

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

All times are GMT -5. The time now is 10:16 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