# [SOLVED] fixmbr wont work!!



## stressfreesoul

I recently installed Ubuntu x64, but after a hardware failure I lost the install. Ubuntu gets installed with a GRUB loader (OS selection) which was left behind, now all I get after POST is...
"GRUB loader
error 22 (plus 16 and 21 at times)"
....Then it sticks.
I tried a FIXMBR with my XP disk in recovery console, but it doesnt work, it just changed the error number from 16 to 21. Then when I used one of the BOOT tools on the 'Ultimate Boot Disk' to try and repair the boot sector and remove any remnants of the GRUB loader, but all it did was change the error to "error 22".
What have I missed? There is obviously a fix for this, Im just not sure of it, any help is greatly appreciated.


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Are you dual booting?

Check to see if your windows partition is set to active. If it isn't, no amount of work with fixmbr is going to change anything.


----------



## stressfreesoul

*Re: fixmbr wont work!!*

I am in my XP install now. I used the ultimate boot disk to get me in. Therefore it must be set to active. I was dual booting until this issue. I was also working on getting tri-booting to work too (which did work in the end). Im now left with half a grub loader that wont let me into a fully functioning install of windows XP.


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Humor me and check Disk Management.

The Active attribute is only important for booting initially. If you bypass the bootloader, it will work regardless.


----------



## hal8000

*Re: fixmbr wont work!!*

Boot with the live hardy CD, at a terminal type:

sudo fdisk -l

to list all partitions, copy this output as you will need it later when you reinstall grub.
Now use DD to remove grub from the MBR (ONLY the first 446 bytes NOT the partition table)

sudo dd if=/dev/null of=/dev/sda bs=446 count=1

Important! I've used sda this represents the first hard drive in Ubuntu (be it SATA or IDE). If your hard drive is not the first drive change "a" to the appropriate letter.
This command writes 0's into the first 446 bytes of the MBR, after which you will need to replace the windows standard bootloader again.

The tool to do this is fixmbr from the windows recovery console, or in debian systems there is a linux tool called "install-mbr". I know its available for knoppix and debian not sure if its in the ubuntu repositories or on the debian disk.
If the command is available then:

sudo install-mbr /dev/sda

will replace the first 446 bytes of the mbr with standard bootloader code, providing the first primary partition is set active, windows will boot. The next 64 bytes are your partition table data which never get touched.

I should add that setting the windows partition as active is only important if windows is booting, once grub is installed the grub command "makeactive" can set any partition as active required for boot.
Hope that helps.


----------



## stressfreesoul

*Re: fixmbr wont work!!*

I cant boot with any live disk. It wont let me. It goes to the live disk option screen, then doesnt execute any of the options properly, ie it sticks on a black screen with the HDD light flashing on and off in a perfect regular pattern until a reset.
Adrynalyne: I cant see anything in diskmgmt.msc that would change the drive to active. Or were you referring to a completely different app?


----------



## Adrynalyne

*Re: fixmbr wont work!!*

That is an app that should work.

If you right click your partition in the second half of the screen, there should be something that says Make partition Active. If its greyed, its already in place.


----------



## stressfreesoul

*Re: fixmbr wont work!!*

Yes its alredy active. Sorry, I didnt see that before (as its greyed out). Any other fixes?


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Yes, I do 

http://www.sysint.no/nedlasting/mbrfix.htm


----------



## stressfreesoul

*Re: fixmbr wont work!!*

How do I use it? (I downloaded it and ran it in explorer, was this correct?)


----------



## Adrynalyne

*Re: fixmbr wont work!!*

No its a commandline tool.

So you will want to save it somewhere simple, like to your C:\ drive.

Then open cmd.exe.

I have only used this for Vista, but it should go something like this.

C:\> MbrFix /drive 0 fixmbr /XP /yes


Assuming that C:\ is drive 0 in your system. Drive 1 would be a second hard disk, and so on.


----------



## stressfreesoul

*Re: fixmbr wont work!!*

No, it wont work... My cmd line aint that good to be able to tweak it either...Ive tried a few combinations, but every time, it tells me that "c:\>" is a bad command that doesnt exist.


----------



## Adrynalyne

*Re: fixmbr wont work!!*

If you are already at a C:\ prompt, you don't type that.

Thats not part of the command, just what it would look like.

Just make sure mbrfix.exe is in the same directory that your command console is working from. For example, if its in D:\mbr, then your command console should be in that directory and be at a D:\mbr> prompt. Then you would type 
MbrFix /drive 0 fixmbr /XP /yes 
and hit enter.

Does that make sense?


----------



## stressfreesoul

*Re: fixmbr wont work!!*

Yeah sorry, I have fuzzy patches sometimes... that makes total sense and I would have probably worked it out if I was less tired. So the cmd console is up and I have used that command, it now shows the list of command options. Do I need to use any of them or has the previously entered command done that job?


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Sorry, as I mentioned before, I've only run it on Vista--so the commands are a bit different. It must not have processed.

Try this.

MbrFix /drive 0 fixmbr /yes


----------



## stressfreesoul

*Re: fixmbr wont work!!*










Does this mean its worked? I pressed enter after the line you gave me and it went straight to the prompt, as shown above...
I just dont want to restart without knowing its worked cos its a pain in the backside going through the UBCD to boot the XP partition.


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Alas, thats the best way to test it.

Yes, what you saw means it processed without error.


----------



## stressfreesoul

*Re: fixmbr wont work!!*

Kudos to you. And thankyou for your invaluable help. It worked a treat. Thats definately an app to add to the tool folder!!


----------



## Adrynalyne

*Re: fixmbr wont work!!*

Quite welcome


----------



## tjwalker

Greetings,
Don't know if Adrynalyne is still around. I just joined this forum for no other reason than to express my thanks. Spent hours and hours today trying to solve this same issue - a bad MBR left over from deleting a Unbuntu dual-boot. Even restore disk from Acronis disk image - nothing would fix the MBR - except the instructions here. Just wanted to express my appreciation.


----------

