Try this:
chroot /mnt bash
mount -a
update-grub
grub-install /dev/sda8 # <- are you sure about this? (see below)
unmount -a
exit
About installing grub to a specific partition
If you do this, your boot loader needs to be aware that the partition has something interesting. Microsoft's bootloader is configured by editing c:\boot.ini
. You do this by first copying the bootloader into a file:
dd if=/dev/sda8 of=grub.bin bs=512 count=1
Then saving grub.bin
onto c:\grub.bin
then add something like this to your c:\boot.ini
:
c:\grub.bin="Linux (GRUB)"
If you don't understand any of that, don't bother. Read the next section.
About installing grub to the master boot record
Grub is the better boot loader. Putting it in the master boot record lets you use it to start Windows, instead of the other way around.
Before you continue, check your grub configuration file after running update-grub
to make sure it "knows" about Windows:
cat /boot/grub/grub.cfg # used for grub2 users
cat /boot/grub/menu.lst # used for grub1 users
Whatever you're using, look for lines that indicate something about Windows, and your (hd0,0)
device. When you're satisfied, simply chroot like before and then:
grub-install /dev/sda # <- note this installs to the "master boot record"
When you reboot, Grub will start, and you can pick Windows. If you had entries to boot Linux/Grub in your boot.ini
file, you can delete them now.
The only downside to this method is that Microsoft Windows may delete grub as part of a system update, or general incompetence. Using the ubuntu disk and simply re-running update-grub
and grub-install
may be easier than dealing with grub.bin
If you still have your Ubuntu (and hopefully it is the live disk), boot off that. Browse through the file systems on both your Windows and Linux partitions. If you can get to both, you're fine; you just need to reinstall grub.
Just remember a couple of things:
In linux, partition numbers start at 1 and disk starts with letters. With grub, they both are numbers and start from 0.
Worse, sometimes BIOS "lies" to grub about the device mapping. You will need to verify your mapping in device map file under /boot directory
Make sure to find out the location of your windows partition and boot loader. Fortunately, it probably still exists under /boot/grub, so you probably won't have to make any changes - just reinstallation.
Here are a couple of things that will help you out.
http://www.dedoimedo.com/computers/grub.html
http://www.howtogeek.com/howto/ubuntu/reinstall-ubuntu-grub-bootloader-after-windows-wipes-it-out/
Best Answer
Ubuntu has a "cute" (read: annoying) feature where it records a boot failure and sets a grub timeout of
-1
, disabling auto-boot. You aren't the only one that doesn't like it, see here.You should be able to work around this by editing
/etc/grub.d/00_header
, find the section that reads....and change it to something sane, like..
..then run
update-grub
.This file might get reset to default on you during an upgrade of the
grub2
package (or the OS), so be careful of that.