i just installed ubuntu 12.10 alongside windows 7 but now my computer automatically boots to ubuntu. i want windows 7 as my default operating system. when i start up my laptop it shows me no settings or any screen asking me what operating system to use. the ONLY way for me to boot into windows 7 not is to hit f12 at startup to bring up which to boot from, select my hard drive then bring up the grub loader in ubuntu, then select windows 7 loader. when i go into msconfig in windows 7 ONLY windows 7 is listed under the operating systems… i see no ubuntu at all. please help this is really annoying!
Thanks.
Ubuntu – Dual boot to windows 7
dual-bootgrub2windows 7
Related Solutions
The way Ubuntu should be set up by default in dual boot mode is that you will see a menu for some seconds to choose the OS from.
Shown here for 10.04 LTS and Windows XP but similar in later releases
If you don't see it, make it visible by pressing and holding the left SHIFT key while booting.
In case you look for a way to reboot into Windows see this question.
For a way to reduce the time until Grub loads the default entry see this question
To change the default boot entry have a look at this answer
Boot into Linux, type the following three commands in a shell, and post the output here:
ls -l `find /boot/efi -iname "*\.efi"`
ls -l `find /boot/efi -iname "*\.bkp"`
sudo parted /dev/sda print
Note that those are back-ticks (to the left of the "1" key on most keyboards) around the find
commands.
The result should be a list of all the boot loaders on your ESP, including both the regular names and the renamed versions created by Boot Repair; and a list of all the partitions on your disk.
Also, what sort of computer are you using? (Brand and model.) Did it come with Windows 8 or did you install it yourself?
Unfortunately, some manufacturers are playing very annoying games with their boot loaders on pre-loaded Windows 8 computers. IMHO, blowing those installations away and starting from scratch is looking more and more like a good solution.
Edit/answer given new information:
There's nothing in your output that's weird or unexpected, so it looks as if something in Windows is "repairing" what it sees as its own "broken" boot loader. This requires some elaboration, which will help you understand what's going on:
An EFI (or UEFI, which is just EFI 2.x) implementation is supposed to check NVRAM entries to decide which boot loader (a file with a .efi
extension) to run when it boots. Some implementations are broken, though, and will only boot the EFI/BOOT/bootx64.efi
or EFI/Microsoft/Boot/bootmgfw.efi
boot loader. Others will boot other boot loaders, but only if they've got the name "Windows Boot Manager" or "Red Hat Enterprise Linux".
To work around this type of bug, the Ubuntu Boot Repair tool implements a fix that's at least as ugly and confusing as the bug it bypasses: It renames those two default boot loaders with .bkp
extensions, places copies of GRUB in their place, and adjusts GRUB so that it will launch the Windows boot loaders using their new names. This gets GRUB booting, but in a way that Windows doesn't understand and might try to "fix" itself. I think that this is what's happening -- when Windows boots, it's seeing that its boot loader has been overwritten by another one and so it tries to correct the problem.
I recommend you try the following:
- Check your manufacturer's Web site to see if there's a firmware update. If there is, update your firmware to the latest version, just in case there's a bug fix for this type of boot bug.
- Boot Windows and reboot to verify that when you reboot you go straight into Windows. You want to start from this point because it's more standard than the way that Boot Repair sets up.
- Boot a Linux emergency disc in EFI mode. (The Ubuntu install disc should work fine for this.)
- Install the
efibootmgr
utility, if necessary. In the Ubuntu live CD, you'd do this by typingsudo apt-get install efibootmgr
. - Type
sudo efibootmgr -c -l \\EFI\\ubuntu\\shimx64.efi -L "Windows Boot Manager" -p 2
. Be careful to type this command exactly as specified, including the doubled-up backslashes as directory path separators. This should set up GRUB to launch as the default boot loader, giving it the firmware label "Windows Boot Manager" in case you've got that bug. (You could try with a less deceptive name, and on most systems that will work, but maybe not for you.) If you're not using Secure Boot, you could substitutegrubx64.efi
forshimx64.efi
in this command, but given thatshimx64.efi
is present on your system, my suspicion is that you are using Secure Boot. - Reboot and test it.
If it works at this point, then great. If it boots to GRUB but GRUB can't launch Windows, you may need to adjust your GRUB configuration so that it references EFI/Microsoft/Boot/bootmgfw.efi
rather than EFI/Microsoft/Boot/bootmgfw.efi.bkp
.
If you can't get your system to launch GRUB in this way, then you may have a very brain-damaged firmware combined with something in Windows that's automatically "fixing" a "damaged" boot loader on every boot, closing off your best (albeit ugly) avenue of repair. In that case, I have several further suggestions:
- If the computer is new enough, return it to the store and get a new one. Make it very clear, both to the store and to the manufacturer, why you're returning it.
- Look for whatever in Windows is checking and "repairing" its boot loader and disable that. You should then be able to use Ubuntu's Boot Repair, or do something similar manually, to get it all working.
- Create a second ESP and install GRUB (or another Linux boot loader) to it using the Microsoft names. By juggling partition ID numbers (using gdisk, for example -- use the
t
option on the experts' menu), you might be able to get the firmware to use your desired boot loader while getting Windows to look at its own boot loader. This is highly speculative, though; it might not work at all. - Create a USB flash drive with my rEFInd boot manager. You'll then be able to insert it into the computer and boot from the USB device to get rEFInd, which should then detect both Windows and GRUB and give you the option of booting either. With a little extra reconfiguration, you could get it to boot Linux directly. If you can set your firmware to boot from the USB device by default, you could leave the USB drive plugged in permanently for a permanent solution.
- Install rEFInd or GRUB from Windows. I'm far from positive of this, but if you install a boot loader from Windows (as described on rEFInd's Web site), it might bypass whatever in Windows is juggling the boot loaders, thus enabling your preferred boot loader to run by default.
Note that, if you use any solution that involves rEFInd, you may need to set it up with Secure Boot, with involves jumping through some extra hoops. (This situation will improve in time, but for now it's still a bit awkward.) Alternatively, you could disable Secure Boot in your firmware.
I hope this helps!
Best Answer
It sounds like you're dual booting Windows 7 and Ubuntu from the same hard drive. If that is the case you can go into Ubuntu and edit your grub settings by opening a terminal and pressing CTRL+ALT+T.
There you can input
sudo gedit /etc/default/grub
This will open the grub settings changer and the topline should readGRUB_DEFAULT=0
saying that your default OS is the first one (0-th one) in the list.To find out number what your Windows 7 installation is you can open another terminal window and input
sudo gedit /boot/grub/grub.cfg
. (It is not recommended that you edit this file as your edits will be erased from here if grub is updated) Here you can see number what your W7 installation is. Just pressCTRL+F
and search forwindows 7
. Now count the number of menuentries above and you will have your magic number.Going back to the /etc/default/grub file change the number of GRUB_DEFAULT=0 to whatever number your W7 installation is. Save and close.
Now open up a new terminal window and run
sudo update-grub
.You can now reboot and by default it should boot into your W7.
If this does not work you can also try Boot-Repair and Grub-customizer.
Good luck.