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 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?

share|improve this question
1  
@EliahKagan: no! the first one contains the rescue image AND the bootloader by default -- the root partition is NOT set bootable or contain a bootloader. –  izx Jun 3 '12 at 5:16
    
@izx Can you explain in more detail? By default, some boot loader has to be installed to the MBR, and when Windows is the only OS, that's the Windows boot loader. Do you mean some part of the boot loader bootstraps into some other part, located in the first partition? (As you can see I'm not deeply knowledgeable about the architecture of the Windows boot loader, in recent Windows OSes.) Furthermore, unless I'm recalling incorrectly, I've always been able to boot Windows 7 systems like this by selecting the second option in GRUB2. –  Eliah Kagan Jun 3 '12 at 5:33
1  
@EliahKagan The "reserved" partition contains bootmgr and the BCD store (call it bootmgr.cfg); bootmgr presents the selection menu, etc. but if you select Windows, it will chainload it from the root partition. The MBR code per se just loads bootmgr into memory. See this bcdedit pastebin. I temporarily assigned Q: to the reserved partition; the "Windows Boot Loader" section contains the parameters telling bootmgr how to chainload. If you assign a drive letter, you'll see that dir /ah Q: contains bootmgr and the Boot dir, but dir /ah C: doesnt. –  izx Jun 3 '12 at 5:47
    
@EliahKagan Compare the first entry in the above pastebin to this one from my laptop, which (deliberately) doesn't have the reserved partition but puts everything on C:. BTW, when the drive assignment Q: is removed, it reverts to partition=\Device\HarddiskVolume1 –  izx Jun 3 '12 at 5:49

4 Answers 4

up vote 1 down vote accepted

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.

share|improve this answer
    
I've now confirmed that I can safely boot into both Windows entries. It is absolutely possible that I installed Windows into a partition that was already formatted as NTFS, but I do not remember selecting any options about not using the standard setup - would the installer automatically have put the bootloader on the C:\ partition anyway, since it was all NTFS already? –  Tomas Lycken Jun 5 '12 at 1:28
    
Anyway, removing one of the entries from the boot menu is enough for me - I don't really care whether the two partitions are still bootable or not, as long as only one shows up in the menu :P –  Tomas Lycken Jun 5 '12 at 1:35
    
@TomasLycken: See edited answer –  izx Jun 5 '12 at 1:56
    
I took the "safe road" and moved all those files and folders to a subfolder "backup" instead. After update-grub and update-burg my Windows installation only shows up once, and boots fine! However, I now have greater problems - Ubuntu won't boot at all...! update-burg gave a message to the effect that "the input file grub.cfg.new was the same as the output file", but didn't say that it was a problem. Apparently, it was anyway? How do I fix my Ubuntu installation now? –  Tomas Lycken Jun 5 '12 at 12:12
    
@TomasLycken: I'd recommend starting a new question. I haven't played with burg in a while but will try to look into it in the morning (tag me with an @ in a comment so I know). In the meanwhile, if you decide to take the new question route and feel this answer helped you out, please accept it. –  izx Jun 5 '12 at 12:19

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
That doesn't work for Grub2 because grub.cfg is updated on every update-grub run, which is upon every kernel upgrade at least. –  izx Jul 10 '12 at 9:09
    
So will you be updating your kernel everyday?? :P It worls and barely takes a minute. What is the problem?? –  Akshit Baunthiyal Jul 10 '12 at 9:15
1  
@AkshitBaunthiyal: It's a very temporary solution - having to do this after every kernel upgrade (or even every change to my boot menu) would be seriously annoying, even if it's not that often. –  Tomas Lycken Jul 11 '12 at 10:51

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.