4

I have a dual boot system with Ubuntu 12.04 and Windows 7, using GRUB2 (with Burg) as boot loader.

For some reason, the Windows installation shows up twice in the boot menu:

Ubuntu GNU/Linux, with Linux 3.2.0-24-generic
Ubuntu GNU/Linux, with Linux 3.2.0-24-generic (recovery mode)
Windows 7 (loader) (on /dev/sda1)
Windows 7 (loader) (on /dev/sda2)

If I look in my partition table, /dev/sda2 is C:\ of the Windows installation, and /dev/sda1 is the "System Reserved" partition (which, IIRC, is Windows' own bootloader). Furthermore, gparted shows /dev/sda2 - but no other partitions - with a boot flag:

enter image description here

What is going on here? I'd like to have only the entries for Ubuntu and one entry for Windows in my boot menu - how do I remove one of them?

ish
  • 141,990
Tomas Aschan
  • 2,952

4 Answers4

3

You are correct that Windows 7 puts it's "boot" partition on /dev/sda1 by default, but it is possible to get Win 7 to put the everything on its "root" partition too -- e.g. by installing to a pre-formatted NTFS partition.

Perhaps you have tweaked Windows in the past such that the bootloader/bootable flag went on /dev/sda2? Can you successfully boot from both Windows entries? If so, it's safe to delete one of them.

How to remove the entries

Danger!

This may make your Windows unbootable; to follow the steps below you'll have to insert sudo where appropriate and make sure the NTFS partition is mounted read-write beforehand.

cd /mnt/where-o-where-my-ntfs-be
rm -rf bootmgr Boot BOOTSECT.BAK Recovery
cd && umount /mnt/ntfs1
update-grub

That should do it - obviously I haven't tried on my dual-boot system(s). Please let me know if it doesn't work and I'll either give you more dangerous methods or maybe look in the grub source to see how it detects Windows partitions for a definitive answer.

ish
  • 141,990
3

I've it already solved persistently enough for my needs. I've changed /etc/grub.d/30_os-prober script a little:

start at line 150 (just add variable and condition to check if windows 7 has already been found):


wubi=

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  echo "Found ${LONGNAME} on ${DEVICE}" >&2

change to:


wubi=
windows7_found=

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  # Mi-La patch to add Windows 7 only once
  if [ "${LONGNAME}" = "Windows 7 (loader)" ]; then
    if [ "${windows7_found}" = yes ]; then
      echo "Skipping duplicated entry for ${LONGNAME} on ${DEVICE}." >&2
      continue
    else
      windows7_found=yes
    fi
  fi

  echo "Found ${LONGNAME} on ${DEVICE}" >&2

Should be working at least till grub won't be updated. Enjoy.

EDIT: Ubuntu 12.10

30_os-prober changed a little, but using the same if after the following lines:


  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

works well.

Mi-La
  • 31
0

Just edit the Burg configuration file via Terminal: 1.) Open Terminal 2.) Type

Sudo gedit /boot/burg/burg.cfg

3.) Find the menuentry "Windows..." and just after --class os add:

--group group_secondary

Where "group_secondary" is a unique name to group a group of operating systems together. If you look at the file, you'll see that the Linux kernels have:

--group group_main

Now you should have Windows and Windows Recovery look like:

menuentry "Windows 8 (loader) (on /dev/sdc1)" --class windows --class os --group group_secondary {
    insmod ntfs
    set root='(hd2,1)'
    search --no-floppy --fs-uuid --set b896bf7f96bf3d26
    drivemap -s (hd0) ${root}
    chainloader +1
}
menuentry "Windows 8 (loader) (on /dev/sdc2) (recovery mode)" --class windows --class os --group group_secondary {
    insmod ntfs
    set root='(hd2,2)'
    search --no-floppy --fs-uuid --set c46cc0a06cc08f1c
    drivemap -s (hd0) ${root}
    chainloader +1
}

4.) The MOST IMPORTANT PART!!! Save!!! Now you can either REBOOT or Start :

sudo burg-emu

5.) On the selection screen press "F" to collapse the folders.

***SIDE NOTE: When collapsed, Burg will use the FIRST menuentry in the file as the default in collapsed mode.

-2

sudo nano /boot/grub/grub.cfg Then comment the second Windows entry (sda2), i.e., put a '#' from where the entry begins. It will remove the entry without affecting your files. Same goes for burg as well. Just replace grub with burg in the command.