I ruined my Window's MBR by trying to install Ubuntu on a USB stick
Linux - GeneralThis 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.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I ruined my Window's MBR by trying to install Ubuntu on a USB stick
I wanted to install Ubuntu on a USB stick, and apparently something went wrong with the mbr.
I was using a Windows machine at the time, inserted the Ubuntu live CD into the computer, installed Ubuntu on the USB stick but now the machine won't start unless the memory stick is connected to the computer! (I get a GRUB error, I can't remember the number of the error atm)
Could anyone please help me? I know this is really a Windows problem but any help would be really appreciated.
I believe if you boot Windows from the installation CD but choose "Recovery Console" instead of "Install" you can then use the 'fixmbr' command to fix the Windows boot sector.
NOTE: I haven't done this in years, but the procedure here is correct; it's just that the 'fixmbr' command might have a slightly different name.
There are solutions even if you don't have a Windows install CD. But most of us here don't remember enough details to talk you through that. The Microsoft documented solutions generally assume you have the install CD.
I expect you accepted the default bootloader installation which is putting Grub stage1 file in the mbr of the disk listed first in boot priority in BIOS. During your installation of the bootloader with Ubuntu, you have an advanced tab you can click to get other options than the mbr. You should select root partition of the USB drive. When you want to boot Ubuntu, you will have to make the selection of the USB disk in the BIOS.
The suggestions above for fixing windows mbr should work for xp, w2k. vista uses a different bootloader and you can download EasyBCD to use to edit its bootloader.
If you have a Windows install CD, there is a program on it for repairing the MBR.
What version of Windows is it?
I unfortunately don't have the Windows CD, but it's Windows XP.
I didn't really understand yancek's response- is it possible to fix the Windows bootloader from the Window's operating system or do I have to result to the Linux command line?
(this is a pretty important problem so I want to get it right)
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369
Rep:
Quote:
Originally Posted by baldurpet
I unfortunately don't have the Windows CD, but it's Windows XP.
I didn't really understand yancek's response- is it possible to fix the Windows bootloader from the Window's operating system or do I have to result to the Linux command line?
(this is a pretty important problem so I want to get it right)
If you like to restore the MBR for windows you need a Windows XP CD
And use the rescue mode in the WINDOWS XP CD
If you googled for it you will find a detailed information how to do it
The OP can currently boot Windows or Linux through grub when the USB device is present (but can't boot without the USB).
I'm sure there is some downloadable program that can be downloaded and run in Windows that will fix the MBR for Windows XP. But I don't know what it is nor where to download it from.
Fixing the Windows XP with command line tools you could download and run in Linux is also possible, but those are probably even harder to find.
There may be a Windows recovery partition on the hard drive that would be an easier method to fix the MBR. In the Windows partitioning tools, the recover partition may be hidden of disguised. To find out if it is there (and to set up to use it) you should boot into Linux. First use gparted to examine the hard drive partition table. If you find the recovery partition, it should be easy to edit the /boot/grub/menu.lst file on the USB so that on the next reboot it gives you the option to boot from the recovery partition.
If you have and boot from a recovery partition, that should act just like the install CD that you would have used if you had one.
Unfortunately, in this case which now does not have the original XP CD, I am at a loss. I'm quite sure there's likely a way to repair the Windows bootloader without the CD, but unless someone can provide some info on how to do it (from their own experience would be good) then the OP might be at the mercy of whatever tool he/she can download from who-knows-where.
What I am wondering though, is this:
The machine will boot (Windows boots too I presume) when the USB drive is connected. Therefore, the Windows bootloader IS still intact *somewhere*, ie maybe it is on the USB drive's MBR? So, I wonder if reinstalling GRUB to the correct MBR (on the HDD) would allow the machine to boot without the USB stick. NOTE: This might cause a boot menu to appear from GRUB, however at least Windows ought to be bootable from the menu too. It would bridge the gap until you could maybe *find* your XP CD and repair the MBR the right way.
NOTE: I don't know if this will work!!! It's just a theory. Don't try this until someone else with a more solid background with GRUB can provide some more help.
NOTE: The post I linked to here also claims that along with 'fixmbr' you will need to run the 'fixboot' command. I can't recall doing this when I borked Windows years ago, but it sounds logical.
The machine will boot (Windows boots too I presume) when the USB drive is connected. Therefore, the Windows bootloader IS still intact *somewhere*, ie maybe it is on the USB drive's MBR?
I think you're mistaken here. The bootloader is the bootloader. Windows places it in the MBR. Under Linux you can define where you want it, but in this case it also went into the MBR. So the Windows bootloader is gone. Grub has taken over this function in this case.
The bootloader will load the operation system (in layman's terms).
The problem here is Grub (this would not have happened with Lilo). Grub only fits partially in the MBR and therefore is also partially somewhere else on the HD (in /boot). Wiping the partition or removing the USB stick makes that Grub can not continue after a certain point.
Lilo fits fully in the MBR and therefore does not suffer from this problem.
I think you're mistaken here. The bootloader is the bootloader. Windows places it in the MBR. Under Linux you can define where you want it, but in this case it also went into the MBR. So the Windows bootloader is gone. Grub has taken over this function in this case.
Correct. And GRUB knows enough about windows to chain-load NTLDR when it is selected as an option in the boot menu.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.