Repair XP MBR with only an Ubuntu Live CD

I just deleted and old Ubuntu off the Journo’s dual-boot Ubuntu/XP HP Pavillion and along with it Ubuntu’s Grub and her Master Boot Record (MBR), which of course rendered the machine useless.

I had an Ubuntu 10.04 Lycid Lynx Live CD at hand (never leave home without it), so here’s how to repair an XP MBR with only an Ubuntu Live CD.

Repairing XP MBR with Ubuntu Live DC

It’s actually ridiculously easy:

  1. Boot from the Live CD and into Ubuntu (it’s option 1, Try Ubuntu Without Making Any Changes to your Computer);
  2. Once you’re in the OS, from the menu choose Applications -> Accessories -> Terminal;
  3. In the Terminal Window type “sudo apt-get install lilo“, which is a Linux gadget that will fix your woes;
    It downloaded, then gave me a prompt box which required me to hit enter before it installed Lilo.  There were some warnings telling me to do something otherwise the computer might not work. The computer wasn’t working anyway, so I ignored those warnings and…
  4. type “sudo lilo -M /dev/sda mbr“;
  5. Done. Reboot.

The above assumes a straight forward flub with the Master Boot Record and a default setup as far as harddrives go.

I rebooted the PC and voila! it booted straight back in to Windows XP.

If you enjoyed this post, consider subscribing to my RSS feed, or follow me on Twitter.
This entry was posted in in malaysia, techie stuff, Ubuntu Linux and tagged , , , , , , , , . Bookmark the permalink.

12 Responses to Repair XP MBR with only an Ubuntu Live CD

  1. rodrigo says:

    finally!

  2. Enrique says:

    Hi, hey man, great work… I had this issue and I had found many solutions that required installing ms-sys, but a couldn't got it to install with ubuntu 10.10 live, but this lilo thing worked great.

    Just one thing, you see, when I turn on my pc, at some point it displays "no active partition" or something like that, obviusly is because lilo is trying to boot or is looking for some partition to boot from, do you know how to remove that?, anyways that message didn't even last that long, so if you don't know, or requieres to much work, it doesn't really worth it :O

    Thanks!

  3. njetpopcorn says:

    Yeah, I agree finally! Been trying to use the ms-sys package, until I realized it didn't exist anymore :(

    This made my day :D

  4. Sonsum says:

    This worked amazing! Thank you!

  5. 1Earth says:

    I'm glad it worked for you guys too.

    @Enrique – OK, this is not the solution, but using this thread (especially CalJohnSmith's 12 Aug 2008 reply), it will give you enough info to search for the Windows solution to your problem.

    http://ubuntuforums.org/showthread.php?t=887895

  6. Paul says:

    I'm a foolish newbie and fouled up my Win MBR on my work laptop while goofing around with Ubuntu. Thanks a million for this… you saved me!

  7. Vj says:

    Awsome fix! Great work around if you don't have an XP recovery disc at hand.

  8. vince says:

    many many thanks,

    this worked a treat.

  9. heriz says:

    saya selalu menggunakan 2 os : windows xp dan ubuntu 11.04

    tetapi windows

    saya rusak dan harus di install ulang, saya melakukan instal ulang dan menyebabkan bootloader ubuntu saya tertimpa dan hilang.. kemudian saya menggunakan cd ubuntu untuk memperbaiki bootloader saya dan kemudian berhasil bootloader saya pun kembali seperti semula..

    namun yg saya bingung saya tidak bisa boot untuk masuk ke windows xp?

    tolong bantu saya agar bisa masuk boot untuk ke dua-duanya???

    terimakasih

    ini tampilan saat masuk ke w xp:

    error: no suce device: DE6CCF186CCEEA7B.

    error: device format “/devsda,msdos1″ invalid: must be (f|h) dN, with 0

    <=N< 128.

    error: no such disk.

    Tekan tombol apapun untuk melanjutkan…

    saya tekan tombol ga bisa2 masuk

    mohon dibantu ya

  10. Hi thank you very much for this article i follow all your instructions and everything seems to be fine but after i reboot my computer i still can not use my windows. it show that
    ——————————————————————————————–
    Windows failed to start.A recent hardware or software change might be the cause. to fix the problem:
    1. insert your windows installation disc and restart your computer.
    2. choose your language setting, and then click "next."
    3. Click "Repair your computer."

    if you do not have this disc, contact your system administrator or manufacturer for assistance.

    File: BootBCD
    Status : 0xcooooo98
    Info: The windows Boot Configuration Data file dose not contain valid os entry.
    ——————————————————————————————–
    before i got this problem i just delete Linux partition in windows 7 and another Partition (i cont remember which one because i click it unintentionally hope that it is not windows partition).before that i already use EasyBCD to set the mbr already.

    sorry for my long psot i really need to use my com to finish my project

    thank you very much

  11. Bhabani says:

    thanx alot it saved me from formatting my system

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>