6

This is the first question I have ever asked the Ubuntu Community.

I'm fairly new to Ubuntu, but I understand the basics and know how to navigate the Terminal. I also know how to search the existing solutions before asking for help. I have scoured the Internet high and low and learned much of how Grub2 works. But nothing has helped me to solve my problem.

My problem is this: I have a computer that has three hard drives. It previously had Windows XP, but I upgraded to Windows 7. I also installed Ubuntu 12.04 LTS (Precise Pangolin).

During my installation of Windows 7, there was a failure and I had to restart the installation. Afterwards, I installed Ubuntu. After some trouble removing all traces of the XP OS (Ubuntu auto-detected it, but not Windows 7) I got the two OSes working flawlessly. Or, almost.

When booting up, Grub2 used to display Ubuntu, Ubuntu Recovery Mode, Other Versions of Linux, memtest, followed by Windows 7 (loader) on /dev/sda1 and Windows 7 (loader) on /dev/sdb1.

I eventually removed Recovery Mode, Other Versions, and Memtest. Now, when I run:

sudo update-grub

I get this print-out:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-26-generic
Found initrd image: /boot/initrd.img-3.2.0-26-generic
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sdb1

I would like to remove "Windows 7 (loader) on /dev/sda1", as it is a broken entry that shouldn't exist, and must have been installed during my first Windows 7 attempt.

I cannot find a Windows 7 entry in /etc/grub.d folder And I don't know where to look.

Here is a layout of my hard drives:

/dev/sda1/ (1.82 TiB), NTFS ("Media")

/dev/sdb1/ (100 Mib), NTFS ("System Reserved")
/dev/sdb2/ (149 GiB), NTFS ("Windows 7")
/dev/sdb3/ (149 GiB), Extended (" ")
    /dev/sdb4/ (145 GiB), ext4 (" ")
    /dev/sdb5/ (4 GiB), linux-swap (" ")

/dev/sdc1/ (488.28 GiB), NTFS ("Downloads")
/dev/sdc2/ (488.28 GiB), NTFS ("AltMedia") 
/dev/sdc3/ (886.45 GiB), NTFS ("Personal")
unallocated (2.09 MiB), unallocated

What I think has happened: Windows 7 installed first and badly. I installed it again. First, there was Windows XP to guide where the bootloader went to so it was put on /dev/sdb1/. But, the second time no such guide existed so the machine put another bootloader on /dev/sda1/. sda1, by the way, is the only partition on a 2TB drive. No boot record partition appears to exist according to gedit. I'm not sure where Grub2 is getting this information from. But, there it is.

Is there anything somebody can do to help me? Or, is there any more information I should add?

1

2 Answers 2

8

A quick solution if sda is a external drive

I don't know whether your /dev/sda hard drive is an internal or an external drive. If it is an external drive, Unplug the external drive before running update-grub2 command. This should help quickly.

Solution:

Mount the /dev/sda1 drive. (I assume you can do that very easily). Then in that drive look for a folder named Boot and a file named bootmgr. Remove both the folder and file. Then run update-grub2 command again.

You might want to install grub2 again. As I see your Ubuntu installation is at /dev/sdb, the commands will be

sudo grub-install /dev/sdb
sudo update-grub 

What was the cause of the problem:

Grub2 looks for the Windows boot files for detecting Windows entries. Though you removed Windows 7, the Windows 7 boot files aren't removed (which are "Boot" folder and "bootmgr" file). And as Windows 7 boot files are there, grub2 simply assumes that, there are Windows 7 installation also. Hence the dual entry.

2
  • 1
    Your help was fantastic and solved my problem immediately! I realize now I was working in the right direction, but I thought that the bootmgr and boot information would be on its own partition. Not seeing those folders in Windows, it never occurred to me that they might show up on Ubuntu!
    – jwarner112
    Jul 2, 2012 at 5:39
  • 1
    Thanks. I was using Windows 8.1 and had two entries on sda1 and sda2. After reading advice elsewhere (help.ubuntu.com/community/MountingWindowsPartitions) I left the "System" partition on sda1 alone and removed the file and folder on sda2 (my Windows OS partition) then run "sudo update-grub" as suggested and everything is now as I wanted. Thanks again.
    – Craig
    Mar 22, 2014 at 17:07
1

You should find what you're looking for inside of /boot/grub/grub.cfg. This file is dynamically generated by update-grub2. I am dual booting Ubuntu 32bit and 64bit. If I wanted to remove one, I would simply delete it's section from this file. Here is what one of my entries looks like-

menuentry 'Ubuntu, with Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos2)'
    search --no-floppy --fs-uuid --set=root 94916094-afe9-4b74-9413-a3c54b39eb91
    linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=94916094-afe9-4b74-9413-a3c54b39eb91 ro   quiet splash $vt_handoff
    initrd  /boot/initrd.img-3.2.0-23-generic
}

Changes should take effect immediately, so make a backup and be careful. Also, anything you change in this file will be completely over written if you run update-grub2 again.

2
  • 1
    Thank you, and your advice teaches me something valuable about grub, however I was looking for a more permanent fix which @Anwar happened to provide for me. Thanks again. My next project: Custom Grub theme! Haha. I want to make my computer dance!
    – jwarner112
    Jul 2, 2012 at 5:41
  • 2
    That's ok, I learned something too ;)
    – Sepero
    Jul 3, 2012 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .