I installed Windows 7, which ate Ubuntu's boot file. When starting up the computer, it now goes straight to Windows, without giving me the option of booting Ubuntu.
How can I get Ubuntu back?
When you install Windows, Windows assumes it's the only OS on the machine--or at least it doesn't account for Linux. So, it replaces grub with its own boot loader. What you have to do is replace the Windows boot loader with grub. I've seen various instructions for replacing grub by mucking around with grub commands or some such, but to me the easiest way is to simply
If you cannot boot normally, and didn't do step 7 because there were no error messages, try again with step 7.
|show 11 more comments|
The windows installer doesn't care about other OS in the system. So it writes own code over the master boot record. Its not a problem of windows installer, its intended. If you reinstall, upgrade windows you will face the issue. Fortunately the solution is easy too.
You need to repair the mbr. Do the following
Boot using a live usb/cd of ubuntu.
After booting with live usb/cd ,Run following command in terminal,
More info - https://help.ubuntu.com/community/Boot-Repair
|show 2 more comments|
I never got in trouble by using these instructions:
First of all, you must start your system from a live cd. Then
"METHOD 3 - CHROOT
This method of installation uses the chroot command to gain access to the broken system's files. Once the chroot command is issued, the LiveCD treats the broken system's / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.
1) Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing - either 32-bit or 64-bit (if not then the chroot will fail).
2) Open a terminal (Applications > Accessories > Terminal).
3) Determine your normal system partition - (the switch is a lowercase "L")
sudo fdisk -l
If you aren't sure, run
Look for the correct disk size and ext3 or ext4 format.
4) Mount your normal system partition:
Substitute the correct partition: sda1, sdb5, etc.
Example: sudo mount /dev/sda1 /mnt
5) Only if you have a separate boot partition: sdYY is the /boot partition designation (for example sdb3)
sudo mount /dev/sdYY /mnt/boot6) Mount the critical virtual filesystems:
sudo mount --bind /dev /mnt/dev sudo mount --bind /dev/pts /mnt/dev/pts sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys7) Chroot into your normal system device:
sudo chroot /mnt
8) If there is no /boot/grub/grub.cfg or it's not correct, create one using
9) Reinstall GRUB 2:
Substitute the correct device - sda, sdb, etc. Do not specify a partition number.
10) Verify the install (use the correct device, for example sda. Do not specify a partition):
sudo grub-install --recheck /dev/sdX
11) Exit chroot: CTRL-D on keyboard
12) Unmount virtual filesystems:
sudo umount /mnt/dev/pts sudo umount /mnt/dev sudo umount /mnt/proc sudo umount /mnt/sys
13) If you mounted a separate /boot partition:
sudo umount /mnt/boot
14) Unmount the LiveCD's /usr directory:
sudo umount /mnt/usr
15) Unmount last device:
sudo umount /mnt
Then you can choose Ubuntu on the Windows 7 bootloader to go to Grub2 (previous bootloader).
Boot from a live Ubuntu USB pendrive or CD
Open the terminal and run the following commands
After completing the installation you can launch it from System->Administration->Boot-Repair menu if you use Gnome, or search "boot-repair" in the dash if you use Unity. Then follow the following screenshots:
Press Apply and Reboot the system
Boot-Repair worked for me. It's very very easy to use graphical application, you do not need to use the command line, you only have to click a button :)
All the available repair options are described in the Ubuntu documentation and there is a separate page explaining how to start Boot-Repair (by creating a bootable disk or installing it in an existing Ubuntu live disk) and how to use it.
Just boot a Ubuntu live CD, install Boot-Repair and run it.
When GRUB is broken, the user generally does not have access to systems, so repair must be performed from a live-session (live-CD or live-USB).
There are many possible causes to a GRUB break: Windows writing on the MBR, DRM preventing GRUB from installing correctly, installer bug, hardware change... Updating GRUB as proposed initially by Scott is generally not sufficient, reinstalling GRUB as proposed by Marco is more efficient, but still there are various situations requiring other tweaks (adding options to kernel, unhiding GRUB menu, changing GRUB options, choosing the right host architecture...). Other difficulties for repairing GRUB is the use of chroot, and the choice of the right partitions /disks.
All of this has been made easy in a little graphical tool: Boot-Repair. It shall be integrated in Ubuntu 12.04 CD for easier use, but for people needing it now, there are already some distros integrating it: Ubuntu-Secured-Remix (Ubuntu CD integrating Boot-Repair), Boot-Repair-Disk (CD running Boot-Repair at start-up), ...
Hope this helps.
Windows does not see Linux formatted partitions. You need to use gparted from a liveCD and create a primary partition formatted NTFS with the boot flag.
Some have had issues if the new primary partition is after the extended partition as Windows does not always reset partition table correctly. Best to have good backups and a separate backup of partition table.
Backup partition table to text file & save to external device. sudo sfdisk -d /dev/sda > PTsda.txt
This is only for MBR(msdos) systems. If your Ubuntu install is in gpt partition drive you can only install Windows in UEFI mode or convert drive back to MBR(msdos).
There is now a simpler solution:
This has been tested on a Samsung Series 7 Chronos laptop dual booting Windows 8 and Ubuntu 13.10, secure boot disabled, UEFI and legacy boot enabled.
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.