This friend of mine had installed Windows and Fedora side by side on his laptop and wanted to remove the Fedora installation. Removing Fedora is quite easy. All you have to do is to go to Disk Management from Windows (Run -> diskmgmt.msc), find the Fedora partitions, delete them and format as new drives.
However, this also removes the MBR of the machine. To restore the MBR, the accepted method is to use a Windows CD. We didn’t have that luxury. Fortunately we had a Ubuntu Live USB in hand.
The method to fix the MBR is:
1. Boot the machine using the Live USB/CD.
2. Install lilo
sudo apt-get install lilo
3. Fix the MBR using lilo using the command:
sudo lilo -M /dev/sda mbr
Works like a charm!
Thanks a mil. Saved my sis’ Win 7 laptop install
Thank you so much!!
Very good info.. Thanks for sharing..
Thank you very much. I just resolved the problem with bootloader with your suggestion. I am following every step in your method. My windows is not working after linux mint deletion on dual system. But I must connect to internet first to download LILO.
Yes, you must connect to the internet to download LILO. Or you will be able to get the tar.gz files from http://freecode.com/projects/lilo and install I guess. I’m not sure about the second method.
in order to do that one you would half to be using a usb
Glad I found this before downloading any hiren or ultimate boot disk… Since my netbook can’t afford a cd to play, only USB is capable…
Didn’t know repairing through lilo is much more faster and hassle free rather than going through the trouble downloading again…
Thank you very much!!
THANK YOU SO MUCH! I spent several hours trying to fix my sister’s netbook (trying to use supergrubdisk, creating a repair disc… and none of that worked). But this solution worked perfectly and was so easy! Much appreciated.
apt-get install lilo gave a warning to run liloconfig (or some such) which i ignored, as i did not want it to install as boot loader. It seemed to work fine to fix the mbr anyway.
1) Clearest explanation;
2) Shortest procedure;
2) No need to put Windows on a usb pendrive (which is an annoying job);
3) Works on laptops with recovery partitions;
hats off man
thanks a lot. i had terrible problem. my laptop DVD writer failed, it has no USB boot option, the “/” partition got corrupted, not able to network boot. but i could attach its disk to my desktop and give the 2 commands you mentioned and it worked.
Thanks a lot again
Sajeev Chacko, New Delhi, India
Awesome. Worked like anything. Thanks for saving my ass
Sweet. Worked a treat and as others have said ‘Dead simple’. Thanks
ok i need to try this. in a pretty bad situation. the drive on which windows was installed can’t be read. as a result there are problems in linux (dual booted). for example if i run windows repair disk it won’t even find any windows partition.
do you think this will help solve the problem?
Doesn’t seem like a problem with the MBR. Anyway, you can try this method, no harm done.
You can’t open the Windows drive even from Linux?
nope. for example when linux (installed) boots it loops on trying to read that partition…and i sometimes need to stop it. and for some reason this corrupts something in linux and i cant access that disk, then again things like apt-get fails – it actually shows some system error.
i can’t install new copy of linux or windows! only hope right now is fixing something using the live cd.
It’s unlikely that trying to FIX the MBR might solve it. Sorry I’m not an expert to give advice on this; if everything else failed, I’d have backed up whatever data possible and done a full format.
thanks man! no problem. i really appreciate the quick replies 🙂
love U! 😉
Can you please tell from where to get the Ubuntu Live USB.I have been trying to find it with no luck.
Just get an Ubuntu ISO and make a bootable USB. Some googling might help.
Another problem has occured.I am unable to access internet while installing ubuntu even when my internet cable is attached,please help.
Usually, just plugging the cable in connects. Perhaps you forgot to configure your proxies?
Thank you, thank you, thank you. Worked like a charm. I was playing with several Linux OS-s and decided to start over and I cleaned them all out by reformatting all of the partitions, except for the Windows 7 partition and of course I blew away Grub. Thanks again!
thank you so much you save my life!
Thank you very much 🙂 Very useful info, when you migrate from Windows to Linux (and want to keep your windows environment as a virtual machine 😉 )
u r suupercool man…….i just gett riid of my prob… thanx..
Thanks very much for this post.
thanks a lot your a lifesaver and a special thanks to opensource!!!
i had winxp and win7 installed with a windows dual boot. i decided to install ubuntu over the winxp, thinking i’d get some sort of bootloader in the package (haven’t used any *nix in 3 years) but didn’t, so i installed LILO. i did what i thought i needed to for LILO, but when i boot it gives me nothing. how do i repair/get to my mbr from an ubuntu live usb??
Tnx man, you are a life safer!
Thanks a lot! It helped!
Thanks, this post is amazing!!! I can’t thank you enough.
God bless you!!!!! this saved my arse! This post should be Marked in most forums!!!!!!!
Thank you soo much! 🙂
Thanks so much. Just had to reboot into the Ubuntu live disc a second time because I had deleted the bootable partition, and had not set the boot flag on one of the remaining disks, so Lilo didn’t know what to do. GParted is in Ubuntu, so that was super easy. Once that was set it worked like a dream.
thank you so much
Pingback: Linux GRUB issues
Brilliant! This worked with no problems, just as described.
Really works like a cham! 😀
Thanks for ur help..
thanks u so so much…really when on the web most of the articles/suggestions use the windows cd to resolve this grub issue….
UR Solution is like a MAGIC after 2 weeks of struggling.thanks again…:-)
thanks so much your awesome!!!
man, im so thankfull right now! it’s been two days that i’ve been dealing with that grub problem and the solution, as always, easy and banal. Thanks!!!!
Worked like a charm
Thanks so much
great work man ,,,thank alot
Be blessed mate, you made my day! Thanks a lot this was life saving!
Thank you. This helped greatly after I needed to restore my PC to it’s factory config with Windows 7, after I had previously installed Ubuntu on it.
HEy mannnnnnn Thank you .
Thanks. You saved my laptop.
Thanks! It worked perfectly.
This doesn’t work in my case, can anyone help?
I ran a .exe which turned my Windows copy into not geniune and also made me not able to boot past the bios (it constantly boots to bios and repeats).
My files on my harddrive are fine. I have tried this lilo method but the boot problem still exists.
You are my hero.
I still have my Windows 7 Installation disc, but it rejected the system recovery option with the error: “This version of System Recovery Options is not compatible with the version of Windows you are trying to repair”. I found other isos of repair discs for literally every possible version and ruined some DVDs, all to get the same error each time I tried.
But your method, two commands in the console, worked perfectly. I did get a warning at the end of the lilo install saying I needed to configure it since it was my first install, but I didn’t end up needing to do anything outside of what you specified.
Thank you for writing this blog post.
thanks thanks thanks thanks….so simple…
A lifesaver! A wonderfully simple and effective solution which restored my Asus laptop to its pristine Win7 status.
Fantastic! Thank you.
Pingback: Repair windows MBR using Ubuntu « Two Black Coffees
Awesome…. Saved me! Two simple commands and I’m back on track!!! Thanks a lot:)
Its giving me error:
root@dell:~# lilo -M /dev/sdb mbr
Fatal: read /dev/sdb: Input/output error
Please help me…
Are you sure the MBR is on /dev/sdb (instead of /dev/sda) ?
Yes, I want to fix MBR on my external HDD.
I can verify it using lsblk command.
sda 8:0 0 xxxG 0 disk (This is internal HDD)
├─sda1 8:1 0 100M 0 part
├─sda2 8:2 0 xxxG 0 part /
└─sda6 8:6 0 xxxG 0 part
sr0 11:0 1 1024M 0 rom
sdb This is my ext hdd (500G)
└─sdb1 This is my ext hdd
Can you mount /dev/sdb1? If not, it’s very likely a problem with the hard disk or the controller.
None of googled solution worked. Finally I bought new HDD. Thanks btw 🙂
will this command format my drive?
It won’t. I won’t be responsible for any damage though 🙂
Thank you x1000000000000000!!!
Merci beaucoup, simple et efficace sur debian handylinux
HI I am a bit dumb to Ubunto lol, can someone walk me through…do I just get a Ubuntu iso and put it on a usb with ultra iso or something? and is lilo included in ubunto iso or do I need to get that separately and do I copy lillo to the usb?..please dumb it down.. most of my friends consider me a guru but please don’t tell them I needed dumbed down instructions.
You need to create a bootable USB using something like this: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows
Once you boot with the USB, you’ll have to install lilo using the apt-get command in the post.
wow.. thank you.
Thanks a lot. It was a panic about Windows and data.
I have Windows 7. I created a live Linux USB. With that I was trying to create persistent Linux USB sticks. installations were hanging. So when I powered off, I was caught in grub rescue even without any USBs.
fukingg workiss hawly crap after sok ling thanks alottttt
I had been trying for six days to find a fix for my corrupt MBR and get my Vista installation working again, I finally got there using your lilo command method.
Thank you so much!.
This is a godsen solution! Worked right away, and the command takes only some seconds (after some minutes installing lilo). Saved my mom’s work notebook!