LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-04-2009, 06:57 AM   #1
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Rep: Reputation: 0
Question Removing Grub without windows recovery


First off all sorry if i posted this in the wrong section.

i wanted to install Backtrack on my 8gb usb. i did it from the live cd with the installer there is on the desktop. averything worked fine and the installation only took about 30 minutes. problem is now that it also installed grub and overwrited the windows boot loader. so if i remove my usb thumb drive i wont boot because it cant find the files. although it works fine with the thumb drive plugged in.
now i want to remove grub and get the normal bootloader back and i googled it and found i that i have the use the windows installer cd. since my xp media center edition was preinstalled i dont have any cd but i got and xp home cd. i booted up with that and got the recover console and then i tried the different commands. none of them worked. i tried:
fixmbr
fixboot
fdisk /mbr
bootcfg /rebuild

none work. either the console doesnt recognise them or with the bootcfg command it tells me that i have to run chkdsk wich i then do and itjust tells me that the drive is clean right when it starts. no search, no steps to go through.

i am starting to believe that the easiest thing to do is to wipe the drive and reinstall it all.

if anyone can help me with this, then please help me! i am new to linux and dont know nothing about it.
 
Old 10-04-2009, 07:29 AM   #2
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
you have both xp and linux in the usb drive?
 
Old 10-04-2009, 07:51 AM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Do you have a /backup_mbr file? If so you can use dd to install the original mbr to your hard drive's mbr.
You only want to restore the first 440 bytes. This is the part that has the bootstrap loader. Above that is
the discs partition table.

Before doing this take a look at it with the linux file command. Make sure that the partition table entries listed look right. You don't want to restore this file if it turns out it is from the pendrive rather than the hard disk.

sudo file /boot/backup_mbr

To restore it to the hard disk, assuming it is /dev/sda, "sudo dd if=/boot/backup_mbr of=/dev/sda bs=440 count=1"
Double check the line carefully, because this command could wipe out your drive if you aren't careful.
 
Old 10-04-2009, 08:10 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
How are you going to re-install everything without a Windows CD?

I'm puzzled as to why the commands don't work from the XP home disk....Regardless, please give more info on the exact configuration. From the Linux system, run "fdisk -l" as root and post the results here.

Depending on you setup, another option may be to put a small Linux partition on the hard drive and then install GRUB so it points there. It does not need to have anything on it except the GRUB files.
 
Old 10-04-2009, 08:24 AM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I would agree with pixellany that your Xp home CD should have worked.

When you get the Recovery Console it asks where partition you wish to repair and you have to click it. The repair is then done on the chosen partition. The Xp pro is protected by a password before allowing you into the partition. Not so sure in your case with xp media center edition.

In your case fixmbr is all that is needed. A Dos floppy with "fdisk /mbr" also works.

Last edited by saikee; 10-05-2009 at 11:09 AM.
 
Old 10-04-2009, 10:31 AM   #6
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Original Poster
Rep: Reputation: 0
wow. im amazed by the fast replies. thanks!

Quote:
Originally Posted by j_jerry View Post
you have both xp and linux in the usb drive?
no i run backtrack on the usb drive and windows xp media center edition on the harddrive of my laptop.

Quote:
Originally Posted by jschiwal View Post
Do you have a /backup_mbr file? If so you can use dd to install the original mbr to your hard drive's mbr.
You only want to restore the first 440 bytes. This is the part that has the bootstrap loader. Above that is
the discs partition table.

Before doing this take a look at it with the linux file command. Make sure that the partition table entries listed look right. You don't want to restore this file if it turns out it is from the pendrive rather than the hard disk.

sudo file /boot/backup_mbr

To restore it to the hard disk, assuming it is /dev/sda, "sudo dd if=/boot/backup_mbr of=/dev/sda bs=440 count=1"
Double check the line carefully, because this command could wipe out your drive if you aren't careful.
well i havent made one, so if its not something that it does automatically then im afraid no.

Quote:
Originally Posted by pixellany View Post
How are you going to re-install everything without a Windows CD?

I'm puzzled as to why the commands don't work from the XP home disk....Regardless, please give more info on the exact configuration. From the Linux system, run "fdisk -l" as root and post the results here.

Depending on you setup, another option may be to put a small Linux partition on the hard drive and then install GRUB so it points there. It does not need to have anything on it except the GRUB files.
i have a HP pavilion laptop with everything preinstalled. they have their own recovery disk that you can use to factory reset the computer, but it unfortunatly doesnt come with a windows cd.

what i am interested in is to make the usb drive boot like a live cd. so i just plug it in, turn on my pc which then boots from the usb drive with no change to the bootloader files.

im going to run fdisk -1 now and ill post the results later. im also going to run the recovery console again and then post the outcome here.
 
Old 10-04-2009, 10:54 AM   #7
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
you've installed grub and backtrak on the usb_drive, it wouldn't change your hdd's mbr. Isn't the xp's mbr working even when the bios is set to boot from the hdd and the usb is removed ?
 
Old 10-04-2009, 12:25 PM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
j_jerry,

I believe the OP has the Xp internal disk as the 1st boot disk and the USB become the 2nd boot disk. Thus if the OP allowed Backtrack's boot loader to take control of the MBR it will go to the Xp disk. If Backtrack did not do it then Backtrack could not boot itself and the installation would fail.

The OP's wish can be granted if the Backtrack boot loader is installed/restored/replicated in the MBR of the USB pen drive and the Xp has its own MBR back. The Bios can be instructed to boot USB device first and if none is found boots the internal hard disk as the second choice. In such a case putting the USB in will boot up Backtrack. Remove the USB then Xp will boot. It is a very simple arrangement but alteration of the booting configuration and /etc/fstab may have to be updated (if USB was installed as the device sdb and later booted up as the device sda).
 
Old 10-05-2009, 10:27 AM   #9
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by saikee View Post
j_jerry,

I believe the OP has the Xp internal disk as the 1st boot disk and the USB become the 2nd boot disk. Thus if the OP allowed Backtrack's boot loader to take control of the MBR it will go to the Xp disk. If Backtrack did not do it then Backtrack could not boot itself and the installation would fail.

The OP's wish can be granted if the Backtrack boot loader is installed/restored/replicated in the MBR of the USB pen drive and the Xp has its own MBR back. The Bios can be instructed to boot USB device first and if none is found boots the internal hard disk as the second choice. In such a case putting the USB in will boot up Backtrack. Remove the USB then Xp will boot. It is a very simple arrangement but alteration of the booting configuration and /etc/fstab may have to be updated (if USB was installed as the device sdb and later booted up as the device sda).
that is exactly how it is and that is exactly my wish

Quote:
Originally Posted by saikee View Post
I would agree with pixellany that your Xpo home CD should have worked.

When you get the Recovery Console it asks where partition you wish to repair and you have to click it. The repair is then done on the chosen partition. The Xp pro is protected by a password before allowing you into the partition. Not so sure in your case with xp media center edition.

In your case fixmbr is all that is needed. A Dos floppy with "fdisk /mbr" also works.
well thats not how my cd does. it loads up and tells me that if i want to acces the recovery console press "r". i do and now im in the recovery console ready to type commands. im just going to check again if its just me that made a newbie error

Quote:
Originally Posted by pixellany View Post
How are you going to re-install everything without a Windows CD?

I'm puzzled as to why the commands don't work from the XP home disk....Regardless, please give more info on the exact configuration. From the Linux system, run "fdisk -l" as root and post the results here.

Depending on you setup, another option may be to put a small Linux partition on the hard drive and then install GRUB so it points there. It does not need to have anything on it except the GRUB files.
for some reason i cant log into root using the default username/password root/toor. but im looking into this and trying to find a work around.

thanks for the help so far.
 
Old 10-05-2009, 01:13 PM   #10
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Original Poster
Rep: Reputation: 0
snapshot1.png
here is the fdisk -l result.

and i checked my windows recovery console again.
When i boot the cd it just loads, puts me to the screen where i can choose if i want to install windows xp or open the recovery console. (there is a third option which i think is exit but im not sure and i press "r" to open the console and it just opens and there is no prompt for password or anything. and when i write fixmbr it just continues to the next line. no error or message or anything, and i doesnt fix anything.
 
Old 10-05-2009, 02:43 PM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
OK lets say you can't fix the Xp but you can boot it without its MBR.

Just press the "c" key at the Grub screen (before booting up Backtrack) to drop Grub into a terminal mode fire up Xp manually with the commands
Code:
root (hd0,0)
chainloader +1
boot
Normally when you open up a Recovery Console you will be presented with a partition and asked if that is the one you want to repair. The issue of the "fixmbr" command also attracts a warning hinting almost you are committing a serious offense.
 
Old 10-05-2009, 03:55 PM   #12
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Original Poster
Rep: Reputation: 0
isnt there a way to fix this without the recovery console? and om going to try with a xp pro d later this week(i know one i can borrow it from.)
and i dont know if i just misunderstood something about an offence but im running genuine windows xp media center edition and the cd is a geniune xp home edition cd

anyway im probably in the end just going to wipe my hdd and reinstall it all. but then how do i avoid this problem in the future?
 
Old 10-05-2009, 04:27 PM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I am asking you to boot the Xp manually with Grub. That must be one of most wonderful experience of using a boot loader face to face. If it boots then it proves Xp is in a working order and then we can sort out how to restore its MBR.

The methods of restoring Xp MBR is detailed in Task B section of my Just booting tips in my signature. You can do it with a Dos floppy downloadable from bootdisk.com. If you haven't got a floppy drive you can download FreeDFos that also has the command "fdisk.exe". Some Linux Live CDs also have this function too like SystemRescue CD. Xp Home does not demand a password by XP pro protects its partition by a password. Using a Dos fdisk.exe on a floppy or CD can bypass it.
 
Old 10-06-2009, 12:27 AM   #14
KasperZ
LQ Newbie
 
Registered: Oct 2009
Posts: 6

Original Poster
Rep: Reputation: 0
oh nice! im gonna try that. but i already can boot xp nicely. i just need to have the usb drive in place so the grub files can load. then i just have to select xp and it loads up.
 
  


Reply

Tags
backtrack, boot, 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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub booting gateway system recovery instead of windows SSJGoku Linux - Newbie 8 08-13-2009 10:51 PM
How To:fixing Grub Re-install After Mbr Recovery In A Fedora/windows Multiple Boot DOTT.EVARISTI Fedora 8 06-01-2008 04:36 AM
incomplete ubuntu uninstal, grub wont let windows run,XP CD recovery mode not working DJGCrusader Linux - Newbie 13 08-13-2007 03:37 AM
problems making grub boot windows (after removing a HD) eantoranz Linux - General 8 07-05-2006 12:19 PM
Removing Windows (SuSE 10.0/Grub 1.5) Myrlin Linux - General 7 05-24-2006 08:07 AM


All times are GMT -5. The time now is 07:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration