PDA

View Full Version : [SOLVED] extra OS listed in grub menu



chrisdude
June 25th, 2010, 09:53 PM
I have a extra OS listed in my grub menu. I'm dual booting Ubuntu 10.04 and Windows 7. I am able to boot into both Ubuntu and Windows. 30_os-prober has two menu entries for Windows though. The first one is Windows 7 (loader) (on /dev/sda1) and the second is Windows Vista (loader) (on /dev/sda2). My laptop came with Windows 7 and had 4 primary partitions (System, Windows, Recovery, HP_TOOLS). After making my recovery disks I removed the Recovery partition and shrunk the Windows partition to make space for Ubuntu. So Windows 7 (loader) (on /dev/sda1) is the System partition which I select to boot Windows. Windows Vista (loader) (on /dev/sda2) is where my Windows 7 is installed.

Here is output from Boot Info Script (http://sourceforge.net/projects/bootinfoscript/):

Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #5 for /boot/grub.

sda1: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /bootmgr /Boot/BCD

sda2: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files/dirs: /bootmgr /boot/BCD /Windows/System32/winload.exe

sda3: __________________________________________________ _______________________

File system: vfat
Boot sector type: Vista: Fat 32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs:

sda4: __________________________________________________ _______________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sda5: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.04 LTS
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda6: __________________________________________________ _______________________

File system: swap
Boot sector type: -
Boot sector info:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 * 2,048 409,599 407,552 7 HPFS/NTFS
/dev/sda2 409,600 321,200,127 320,790,528 7 HPFS/NTFS
/dev/sda3 976,560,128 976,771,119 210,992 c W95 FAT32 (LBA)
/dev/sda4 321,202,174 976,560,127 655,357,954 5 Extended
/dev/sda5 321,202,176 952,829,951 631,627,776 83 Linux
/dev/sda6 952,832,000 976,560,127 23,728,128 82 Linux swap / Solaris


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 E682A32C82A30063 ntfs SYSTEM
/dev/sda2 50A2A4E8A2A4D42E ntfs
/dev/sda3 0682-A288 vfat HP_TOOLS
/dev/sda4: PTTYPE="dos"
/dev/sda5 583ed875-0fc5-4791-b6ad-7d72b712bbc0 ext4
/dev/sda6 107057c4-c5d1-47b1-bcf9-90f7b38f2ee0 swap
/dev/sda: PTTYPE="dos"

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sda5 / ext4 (rw,errors=remount-ro)


=========================== sda5/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
set saved_entry=${prev_saved_entry}
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z ${boot_once} ]; then
saved_entry=${chosen}
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=583ed875-0fc5-4791-b6ad-7d72b712bbc0 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
echo 'Loading Linux 2.6.32-22-generic ...'
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=583ed875-0fc5-4791-b6ad-7d72b712bbc0 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=583ed875-0fc5-4791-b6ad-7d72b712bbc0 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=583ed875-0fc5-4791-b6ad-7d72b712bbc0 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 583ed875-0fc5-4791-b6ad-7d72b712bbc0
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set e682a32c82a30063
chainloader +1
}
menuentry "Windows Vista (loader) (on /dev/sda2)" {
insmod ntfs
set root='(hd0,2)'
search --no-floppy --fs-uuid --set 50a2a4e8a2a4d42e
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

=============================== sda5/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=583ed875-0fc5-4791-b6ad-7d72b712bbc0 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=107057c4-c5d1-47b1-bcf9-90f7b38f2ee0 none swap sw 0 0

=================== sda5: Location of files loaded by Grub: ===================


250.5GB: boot/grub/core.img
246.3GB: boot/grub/grub.cfg
250.4GB: boot/initrd.img-2.6.32-21-generic
250.6GB: boot/initrd.img-2.6.32-22-generic
250.4GB: boot/vmlinuz-2.6.32-21-generic
164.9GB: boot/vmlinuz-2.6.32-22-generic
250.6GB: initrd.img
250.4GB: initrd.img.old
164.9GB: vmlinuz
250.4GB: vmlinuz.oldDoes anyone know why I have this extra menu entry? Maybe sda2 has some unnecessary boot files? What is the best way to clean up my grub menu?

wilee-nilee
June 25th, 2010, 09:57 PM
n

Don Barzini
June 25th, 2010, 10:00 PM
Have you tried running sudo update-grub?


sudo update-grub


If you did, and that didn't fix the problem then..... Edit the file /etc/grub.d/30_os-prober and remove the following text (including the bracket at the end of the entry)...



menuentry "Windows Vista (loader) (on /dev/sda2)" {
insmod ntfs
set root='(hd0,2)'
search --no-floppy --fs-uuid --set 50a2a4e8a2a4d42e
chainloader +1
}


Then run sudo update-grub again.


sudo update-grub

chrisdude
June 25th, 2010, 11:10 PM
Thanks for the quick response.

A few days after installing Ubuntu I had a kernel update so the update-grub command would have been run after the install and both Windows entries were still present when I restarted.

When I run update-grub command here is the output I get:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-22-generic
Found initrd image: /boot/initrd.img-2.6.32-22-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Windows Vista (loader) on /dev/sda2
doneSo grub is still adding the extra Windows entry.

The menu entry isn't in /etc/grub.d/30_os-prober. /etc/grub.d/30_os-prober is the script which detects your other operating systems. /boot/grub/grub.cfg has the menu entry in but this is an auto generated file and will be updated every time you get a kernel update or run update-grub.

Any other suggestions? Does any one know why its a Windows Vista entry too?

darkod
June 25th, 2010, 11:25 PM
sda1: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /bootmgr /Boot/BCD

sda2: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows Vista/7
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files/dirs: /bootmgr /boot/BCD /Windows/System32/winload.exe

Because you have vista/7 type boot files on sda2 too. If win7 boot files /bootmgr and /boot/BCD are on sda1 and it boots correctly, out of what ever reason you also have boot files on sda2 too.
Grub2 is making entries for all boot files it can find.
I suggest leaving them right now. Or you can delete the boot files from sda2 if you are sure the sda1 are the correct ones. NOTE: You do need the winload.exe file, I am only talking about /bootmgr and /boot/BCD.
In case you need them, don't delete them right away, just move them somewhere. You can put them back if it messes up anything.

chrisdude
June 26th, 2010, 02:32 PM
Thanks for the help.

I moved the files (/bootmgr and /boot/BCD) on sda2. I then run the update-grub command and the extra menu entry disappears. I can still boot into Windows 7 using the Windows 7 (loader) on /dev/sda1 so all is good.

If I have any problems I'll post them to this thread, thanks again.