Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I erased a Windows XP partition and installed Windows 7 on it. I have no grub screen now and the computer boots straight to Windows. What can I do to reinstall grub?

EDIT: I tried this

sudo grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

  -h, --help              print this message and exit
  -v, --version           print the version information and exit
  --modules=MODULES       pre-load specified modules MODULES
  --boot-directory=DIR    install GRUB images under the directory DIR/grub
                          instead of the /boot/grub directory
  --grub-setup=FILE       use FILE as grub-setup
  --grub-mkimage=FILE     use FILE as grub-mkimage
  --grub-mkrelpath=FILE   use FILE as grub-mkrelpath
  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
  --grub-probe=FILE       use FILE as grub-probe
  --no-floppy             do not probe any floppy drive
  --allow-floppy          Make the drive also bootable as floppy 
                          (default for fdX devices). May break on some BIOSes.
  --recheck               probe a device map even if it already exists
  --force                 install even if problems are detected
  --disk-module=MODULE    disk module to use

INSTALL_DEVICE can be a GRUB device name or a system device filename.

grub-install copies GRUB images into /boot/grub, and uses grub-setup
to install grub into the boot sector.

Report bugs to <bug-grub@gnu.org>.
ubuntu@ubuntu:~$ sudo grub-install /boot/grub
/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).

sudo grub-install /boot/grub didn't work, what to do then?

share|improve this question
add comment

2 Answers

When you reinstalled Windows it overwrote the MBR. To fix this, boot into a live session of Ubuntu (or any Linux Distribution that uses GRUB), open a command line and run the command sudo grub-install /dev/sda. That will reinstall grub and you will be able to choose between Windows 7 and Ubuntu 12.04 to boot from.

share|improve this answer
    
didn't work, please read the edit to help me figure why –  omgzor Dec 24 '12 at 20:30
    
Sorry, I forgot to add that you need to specify the drive you want to install do. Check my edit to the command. –  kelvinafox Dec 25 '12 at 0:41
add comment

When I reinstalled my Windows OS, I ran into the same issue. I decided to fix it by using Window's boot manager instead of GRUB, so if you really want GRUB this won't help you, but:

Boot into Windows (obviously, you don't have any other choice) and download EasyBCD. Watch this video tutorial that will explain how to use EasyBCD to configure the Windows Boot Manager. In this process, you will add an entry for Windows and an entry for Ubuntu, so when you start your computer you will be prompted to chose one (or boot into Windows by default - you can change all that too). The caveat is that the Ubuntu entry will take you into GRUB, where you will be again prompted to chose an OS. That will allow you to get into Ubuntu, but to avoid the extra boot menu, you may want to change the GRUB timeout to 0 or .1 seconds. Here's a tutorial on the timeout change.

Good luck!

share|improve this answer
    
thanks, I'll try this –  omgzor Dec 24 '12 at 20:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.