Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 09-16-2006, 02:53 PM   #1
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, 11:47 AM   #3
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
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, 12:10 PM   #4
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid
Posts: 4,734
Blog Entries: 12

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
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 ( ); 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


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.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Restore GRUB Nilesh.Shah Linux - Hardware 6 01-09-2010 12:43 PM
How to restore Grub after Win Xp install MRMadhav General 18 04-04-2008 09:20 AM
Install another MS OS and restore Grub? luwigie Linux - General 5 08-30-2004 02:30 PM
How can I restore GRUB ? xtrips Linux - Software 5 07-30-2003 04:22 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:34 PM.

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