PDA

View Full Version : [ubuntu] Grub can't find windows loader after update



bob-linux-user
November 29th, 2010, 10:23 PM
I am running Ubuntu 10.10. Normally when I boot, I get the choice to run Ubuntu or the Windows loader, where I choose between 7 or XP. I have just noticed that when I boot now, I do not have the choice of going into windows. This has happened on two of my PC's just in the last few days. I assume one of the updates has overwritten the grub configuration file as I still get the grub menu but not the windows option. I have tried sudo update-grub but this did not solve the problem.

Has anyone else had this problem and if so how did they solve it please?

bob-linux-user
November 30th, 2010, 11:25 PM
In reply to my own thread (!)
I booted my third computer (they are all hand me downs I am not rich) up.
I get the grub menu with an option to dual boot into windows as normal.
-I test all is ok by booting into windows. All good
-I reboot into Ubuntu 10.10. All is good
-The update manager says I need 216meg of updates so I let it download and install as usual. At the end a reboot is required:
-NO Windows option on grub
Now I guess this is not a problem with Maverick as we would all have heard by now. All three of my computers were running Macbuntu 10.10.
Now- I have to see if there is a conflict. Next stage is to reinstall ubuntu from scratch ( I hope it will pick up windows and add to grub)
then do all the upgrades. If all ok I least know what the problem was even if I don't know how to solve it.

Hippytaff
November 30th, 2010, 11:32 PM
It is probably worth posting the RESULTS.txt generated by this script
http://bootinfoscript.sourceforge.net/
Will give some info as to what is what as far as grub etc goes :-)

tommcd
December 1st, 2010, 12:18 AM
-NO Windows option on grub

Have you tried running: sudo update-grub to see if that will add Windows to your grub menu?
You could also try creating a custom Windows boot file in your /etc/grub.d/ directory. See this tutorial:
https://help.ubuntu.com/community/Grub2#Custom%20Menu%20Entries
I had to create custom boot entries for my other OSs after I installed Lubuntu 10.10, since the grub2 on my Lubuntu would not detect my other OSs for some reason.
For reference, here is my custom boot file for Windows XP:


menuentry "WindowsXP on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}

That should be all you need to boot Windows. Name this file 31_Windows so it will be listed after Ubuntu in the gtub menu. Be sure to make this file executable (sudo chmod +x Windows). Then run sudo update-grub to update your /boot/grub/grub.cfg file.

bob-linux-user
December 1st, 2010, 01:41 AM
I tried running sudo update-grub. Didn't work.

Tried reinstalling ubuntu from fresh. Windows reappeared on grub. All good until I let ubuntu update itself. Windows disappeared again. Will try again tomorrow.

wilee-nilee
December 1st, 2010, 02:39 AM
As per post #3
So from a booted live Ubuntu cd or thumbdrive lets see the bootscript read out; in my signature just click on it and follow the instructions. Come back to the thread and click on the # in the reply panel this makes code tags paste all the text in between.

Post the bootscript that is the way we roll around here if you want actual help not try this it works for me.;)

tommcd
December 1st, 2010, 07:45 PM
. All good until I let ubuntu update itself. Windows disappeared again. Will try again tomorrow.
Did you try creating a custom boot entry for Windows in the /etc/grub.d/ directory like I suggested in my last post? If Windows in your computer is on /dev/sda1, you could just copy my file that I have posted above and use that.

bob-linux-user
December 1st, 2010, 09:58 PM
Thanks to all who posted, Wilee Tom and Hippytaff. @Wilee- I take your comments on board thank you. I was in too much of a hurry and started on my own not very clever investigation prior to checking the forum. Sorry. Apologies also to the Macbuntu theme authors if they read my earlier post in this thread. I downloaded the script and ran it.Results below.@Tommcd I will try your solution next time I get a chance. Have to go to bed now as dog tired.Thanks.Will try to log on tomorrow.(Thursday)


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 #3 for (,msdos3)/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: Windows 7
Boot files/dirs: /bootmgr /Boot/BCD /Windows/System32/winload.exe
/ntldr /NTDETECT.COM

sda2: __________________________________________________ _______________________

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:

sda3: __________________________________________________ _______________________

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

sda4: __________________________________________________ _______________________

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

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

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 40.0 GB, 40016019456 bytes
255 heads, 63 sectors/track, 4865 cylinders, total 78156288 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 * 63 31,326,749 31,326,687 7 HPFS/NTFS
/dev/sda2 31,326,750 53,223,344 21,896,595 7 HPFS/NTFS
/dev/sda3 53,223,345 77,079,869 23,856,525 83 Linux
/dev/sda4 77,079,870 78,156,224 1,076,355 82 Linux swap / Solaris


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/loop0 squashfs
/dev/ramzswap0 swap
/dev/sda1 166C95AE6C9588DF ntfs
/dev/sda2 09C6BAD75AE88F47 ntfs BobFiles
/dev/sda3 73ca6445-21ba-4725-9cd5-6ce7cea68598 ext4
/dev/sda4 749ffa1f-76f2-47b5-93bc-ae7981ab822e swap
/dev/sda: PTTYPE="dos"

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

Device Mount_Point Type Options

aufs / aufs (rw)
/dev/sr0 /cdrom iso9660 (ro,noatime)
/dev/loop0 /rofs squashfs (ro,noatime)


=========================== sda3/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by 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
set have_grubenv=true
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
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
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.35-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=73ca6445-21ba-4725-9cd5-6ce7cea68598 ro quiet splash
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
echo 'Loading Linux 2.6.35-23-generic ...'
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=73ca6445-21ba-4725-9cd5-6ce7cea68598 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=73ca6445-21ba-4725-9cd5-6ce7cea68598 ro quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=73ca6445-21ba-4725-9cd5-6ce7cea68598 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 73ca6445-21ba-4725-9cd5-6ce7cea68598
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sda3/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/sda3 during installation
UUID=73ca6445-21ba-4725-9cd5-6ce7cea68598 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda4 during installation
UUID=749ffa1f-76f2-47b5-93bc-ae7981ab822e none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

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


31.9GB: boot/grub/core.img
32.4GB: boot/grub/grub.cfg
30.0GB: boot/initrd.img-2.6.35-22-generic
30.1GB: boot/initrd.img-2.6.35-23-generic
32.3GB: boot/vmlinuz-2.6.35-22-generic
32.4GB: boot/vmlinuz-2.6.35-23-generic
30.1GB: initrd.img
30.0GB: initrd.img.old
32.4GB: vmlinuz
32.3GB: vmlinuz.old

jkanounji
December 23rd, 2010, 06:58 PM
Have you tried running: sudo update-grub to see if that will add Windows to your grub menu?
You could also try creating a custom Windows boot file in your /etc/grub.d/ directory. See this tutorial:
https://help.ubuntu.com/community/Grub2#Custom%20Menu%20Entries
I had to create custom boot entries for my other OSs after I installed Lubuntu 10.10, since the grub2 on my Lubuntu would not detect my other OSs for some reason.
For reference, here is my custom boot file for Windows XP:


menuentry "WindowsXP on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}

That should be all you need to boot Windows. Name this file 31_Windows so it will be listed after Ubuntu in the gtub menu. Be sure to make this file executable (sudo chmod +x Windows). Then run sudo update-grub to update your /boot/grub/grub.cfg file.

Hello,
I'm having the same issue as OP, and I tried your method, however nothing has changed.

Output of sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3b7b3b7a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 21673 173977600 7 HPFS/NTFS
/dev/sda4 21673 60801 314301985+ f W95 Ext'd (LBA)
/dev/sda5 41243 60801 157107636 7 HPFS/NTFS
/dev/sda6 21673 22417 5975040 82 Linux swap / Solaris
/dev/sda7 22417 29225 54686720 83 Linux
/dev/sda8 29225 41242 96530432 83 Linux

Partition table entries are not in disk order


and my 31_windows file looks like this

#!/bin/sh
exec tail -n +3 $0

menuentry "Windows 7 on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}


after I run sudo update-grub, this is the output:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-24-generic
Found initrd image: /boot/initrd.img-2.6.35-24-generic
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
done


Any ideas please? :)

jkanounji
December 23rd, 2010, 07:19 PM
Thought I'd share my RESULTS.TXT as well, could be helpful


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 #7 for (,msdos7)/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 /grldr

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: /Windows/System32/winload.exe

sda4: __________________________________________________ _______________________

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

sda5: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda5 starts
at sector 63.
Operating System:
Boot files/dirs:

sda6: __________________________________________________ _______________________

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

sda7: __________________________________________________ _______________________

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

sda8: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:

=========================== 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 206,847 204,800 7 HPFS/NTFS
/dev/sda2 206,848 348,162,047 347,955,200 7 HPFS/NTFS
/dev/sda4 348,164,094 976,768,064 628,603,971 f W95 Ext d (LBA)
/dev/sda5 662,552,793 976,768,064 314,215,272 7 HPFS/NTFS
/dev/sda6 348,164,096 360,114,175 11,950,080 82 Linux swap / Solaris
/dev/sda7 360,116,224 469,489,663 109,373,440 83 Linux
/dev/sda8 469,491,712 662,552,575 193,060,864 83 Linux


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 EE50045C50042DC1 ntfs System Reserved
/dev/sda2 B0040BFA040BC278 ntfs
/dev/sda4: PTTYPE="dos"
/dev/sda5 138C0B23CD28AE69 ntfs
/dev/sda6 7290f1f5-9e20-4b73-a7d3-fa9d45b548ab swap
/dev/sda7 a16e027a-4efd-4dfc-b19a-d8cacfe81a10 ext4
/dev/sda8 c30e4283-f5cd-44c1-85f4-d717955a2653 ext4
/dev/sda: PTTYPE="dos"

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

Device Mount_Point Type Options

/dev/sda7 / ext4 (rw,errors=remount-ro,commit=0)
/dev/sda8 /home ext4 (rw,commit=0,commit=0)
/dev/sr0 /media/DAVID_GILMOUR udf (ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000, iocharset=utf8,umask=0077)


=========================== sda7/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by 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
set have_grubenv=true
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
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
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.35-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
linux /boot/vmlinuz-2.6.35-24-generic root=UUID=a16e027a-4efd-4dfc-b19a-d8cacfe81a10 ro quiet splash
initrd /boot/initrd.img-2.6.35-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
echo 'Loading Linux 2.6.35-24-generic ...'
linux /boot/vmlinuz-2.6.35-24-generic root=UUID=a16e027a-4efd-4dfc-b19a-d8cacfe81a10 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a16e027a-4efd-4dfc-b19a-d8cacfe81a10 ro quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a16e027a-4efd-4dfc-b19a-d8cacfe81a10 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a16e027a-4efd-4dfc-b19a-d8cacfe81a10
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/21_windows ###

menuentry "Windows 7 on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}
### END /etc/grub.d/21_windows ###

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sda7/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/sda7 during installation
UUID=a16e027a-4efd-4dfc-b19a-d8cacfe81a10 / ext4 errors=remount-ro 0 1
# /home/ was on /dev/sda8 during installation
UUID=c30e4283-f5cd-44c1-85f4-d717955a2653 /home/ ext4 defaults 0 2
# swap was on /dev/sda6 during installation
UUID=7290f1f5-9e20-4b73-a7d3-fa9d45b548ab none swap sw 0 0

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


193.1GB: boot/grub/core.img
204.0GB: boot/grub/grub.cfg
185.8GB: boot/initrd.img-2.6.35-22-generic
185.9GB: boot/initrd.img-2.6.35-24-generic
193.2GB: boot/vmlinuz-2.6.35-22-generic
193.2GB: boot/vmlinuz-2.6.35-24-generic
185.9GB: initrd.img
185.8GB: initrd.img.old
193.2GB: vmlinuz
193.2GB: vmlinuz.old

tommcd
December 24th, 2010, 03:47 AM
Hello,
I'm having the same issue as OP, and I tried your method, however nothing has changed.
For your 31_windows file, you don't need this part:


#!/bin/sh
exec tail -n +3 $0

I don't have that in mine. You only need:


menuentry "Windows 7 on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}

Also, make sure the file is executable. Post the output of:

ls -l /etc/grub.d/
Which partition is Windows7 on? Your /dev/sda1 from your output of fdisk -l looks too small to be Windows7. Is /dev/sda1 a recovery partition or boot partition or something? I am not familiar with Windows7.
If using /dev/sda1 in your 31_windows file does not work, try changing it to /dev/sda2; and change set root=(hd0,1) to
set root=(hd0,2). Then run sudo update-grub again and see if you can boot Windows.

If the 31_windows file is written properly and is executable, it should have added an entry for Windows in your /boot/grub/grub.cfg file. Did it?

jkanounji
December 24th, 2010, 02:06 PM
Thanks for your response.

First of all, the file is executable, so it's safe to get that out of the way :)

Well, soon after I posted these above, I noticed that /dev/sda1 was a bit too small to be the windows partition, so I tried /dev/sda2 and /dev/sda5 to no avail.

As for

#!/bin/sh
exec tail -n +3 $0

update-grub would throw an error if these were not found in the file:


Found linux image: /boot/vmlinuz-2.6.35-24-generic
Found initrd image: /boot/initrd.img-2.6.35-24-generic
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
/etc/grub.d/21_windows: 1: menuentry: not found
/etc/grub.d/21_windows: 3: chainloader: not found
/etc/grub.d/21_windows: 4: Syntax error: "}" unexpected


I think however that the problem now is not with GRUB, for I read somewhere that a new updated version of ntfs-3g could cause this, if GRUB is not yet compatible with this version. Found it as in Ubuntu's bugs page. However, I would appreciate it if you took a look at this post to check that everything from my end is fine (hence to confirm it's an ntfs-3g issue, not a GRUB configuration)

Regards

mmullers
January 6th, 2011, 11:41 AM
jkanounji,

I had the exact same problems as you after a grub-update on lubuntu 10.10.

Thanks to tommcd, I created a new file in /etc/grub.d named 15_xp. My file looks like this:


#!/bin/sh
exec tail -n +3 $0
menuentry "WindowsXP Pro sp 3 on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}

made it executable:


sudo chmod +x 15_xp

then I ran:


sudo update-grub

Like you, I needed the first two lines or I got an immediate error similar to yours from update-grub.

But update-grub still did not find the xp partition, and there was no XP entry in the grub menu at boot.

Taking a cue from you, I downgraded ntfs-3g by removing the current maverick versions:


sudo apt-get purge ntfs-3g
sudo apt-get purge libntfs-3g79

I then got a copy of the lucid versions of the above two files from another of my machines (you can probably also get them from http://packages.ubuntu.com/lucid/libntfs-3g75 -and-
http://packages.ubuntu.com/lucid/ntfs-3g):


ntfs-3g_1%3a2010.3.6-1ubuntu1_i386.deb
libntfs-3g75_1%3a2010.3.6-1ubuntu1_i386.deb

and installed them:


sudo dpkg -i libntfs-3g75_1%3a2010.3.6-1ubuntu1_i386.deb
sudo dpkg -i ntfs-3g_1%3a2010.3.6-1ubuntu1_i386.deb

(libntfs-3g75 must be installed first to satisfy ntfs-3g dependency)

Then i re-ran:


sudo update-grub

After a re-boot, the XP menu entry was there!

Moral to the story:

1) It indeed appears to be a ntfs-3g anomaly or at least interaction.

2) I never thought I would say that I miss legacy grub1. grub2 for me is not user friendly.

presence1960
January 6th, 2011, 02:48 PM
@ bob-linux:

The output you posted shows your XP and 7 boot files combined in the sda1 partition, but you have no XP partition??? Where did it go?

tommcd
January 7th, 2011, 03:14 AM
I had the exact same problems as you after a grub-update on lubuntu 10.10. ...
Like you, I needed the first two lines or I got an immediate error similar to yours from update-grub.
That is weird. I am also using Lubuntu 10.10. For some reason, Lubuntu 10.10 will not find any of my other operating systems (XP, Slackware, and Salix) when I run update-grub. This is why I created custom boot entries in /etc/grub.d/ for them all; but I have never used these 2 lines:


#!/bin/sh
exec tail -n +3 $0

in any of my custom boot entries in /etc/grub.d/, and they all work fine without errors. For the record, here is my full 31_WindowsXP file:

echo "Adding WindowsXP on /dev/sda1" >&2
cat << EOF
menuentry "WindowsXP on /dev/sda1" {
set root=(hd0,1)
chainloader +1
}
EOF

Note: The echo "Adding WindowsXP on /dev/sda1" >&2 part is only there to provide visual feedback when running update-grub. It is optional and should not matter, so I left it out of my post #4 in this thread.


Taking a cue from you, I downgraded ntfs-3g by removing the current maverick versions:

I am also using the stock ntfs-3g that came with Lubuntu 10.10:


tom@desktop1:~$ aptitude search ntfs-3g
p libntfs-3g-dev - ntfs-3g filesystem in userspace (FUSE) library headers
i A libntfs-3g79 - ntfs-3g filesystem in userspace (FUSE) library
i ntfs-3g - read-write NTFS driver for FUSE

I don't know why ntfs-3g would cause problems with grub2. In any case, I have not experienced these problems. I do not have my XP partition in my /etc/fstab file though, so my XP partition is not mounted when I boot Lubuntu. I can manually mount it if I want to though. Even if my XP partition is mounted, and I run update-grub I do not get any errors for my 31_WindowsXP file.

mmullers,
Welcome to the Ubuntu forums! Glad you got this worked out ok!

bob-linux-user
January 9th, 2011, 11:30 PM
@presence1960

It was some time ago and I am not sure which one of my three computers I was using at the time. In normal use I have 3 partitions, one each for xp,7 and ubuntu. I install Xp first then 7 then ubuntu. 7 creates a menu like grub for choosing between windows 7 and xp.

When I boot I have a choice between Ubuntu and Windows 7. If I choose 7 I can then carry on or choose xp from the windows menu.

bob-linux-user
March 6th, 2011, 11:50 AM
Can anyone who has tried Natty Narwhal in a dual booting environment (which would be quite brave) advise if this bug is still present in "Natty" please?

bob-linux-user
April 18th, 2011, 10:59 PM
In reply to the last post (me) - I have downloaded the beta of Natty and installed it. So far so good, it has not deleted the Windows entry.

(As an aside, as someone else commented recently as regards the new interface, it is like marmite* in that you either love it or hate it. I know which camp I fall into so, as the traditional gnome interface will soon go from Ubuntu so I will go to another distro.)

*Marmite: is dark brown-colored savory spread made from the yeast that is a by-product of the brewing industry. It has a very strong, slightly salty flavor.

Dutch70
April 18th, 2011, 11:17 PM
I know what you mean about Ubuntu & Unity, but it does seem to get better every day. So I'm not going to judge it just before it's released.

No reason to go to another distro just yet though, Natty also offers the classic desktop. What's wrong with that?

On the other hand, Kubuntu Natty is sweet!!!

bob-linux-user
April 19th, 2011, 01:34 PM
@ Dutch

Yes I know you can switch to the classic desktop but I read somewhere that Ubuntu will be Unity only, maybe from as early as Ubuntu 11.10 so I will make the change sometime before then.

I notice also that the "classic desktop" is not the same as it was. The slidebars are barely visible in Nautilus and they only appear as a weird looking slider when you hover over them.

I always thought the "Windows 95" style menu was Microsoft's best move after windows 3.11. It is obviously popular,it was more or less retained for XP and the basic principle is not that much different on MS operating sytems today. (I am not suggesting we should slavishly copy MS of course)

Gnome 2 is broadly similar and I like it.

Dutch70
April 19th, 2011, 02:37 PM
Yes I know you can switch to the classic desktop but I read somewhere that Ubuntu will be Unity only, maybe from as early as Ubuntu 11.10 so I will make the change sometime before then
Yeah, I'm hoping Unity will be much better by then & it should be. I'm starting to think this was the right thing for Ubuntu to do, even though I don't like it right now. I think it will be much better in the long run.


I notice also that the "classic desktop" is not the same as it was. The slidebars are barely visible in Nautilus and they only appear as a weird looking slider when you hover over them.
I wasn't aware of that, as I'm actually trying to establish a decent work flow with Natty when I use it, which isn't a whole lot right now.



I always thought the "Windows 95" style menu was Microsoft's best move after windows 3.11. It is obviously popular,it was more or less retained for XP and the basic principle is not that much different on MS operating sytems today. (I am not suggesting we should slavishly copy MS of course)
If you've got a usb stick or something to try out OS's with, you should have a look at Zorin OS. It can be made to look like windows7, XP, or Ubuntu, with one single click.