PDA

View Full Version : [ubuntu] Windows no longer appears in GRUB on boot



AnsonKid
December 10th, 2011, 09:37 AM
Hello,

I have read other threads containing the same problem, and I was unable to find a fix that worked for my computer.

I am not using legacy GRUB, and are on GRUB version 1.99; I'm assuming this is the reason I do not have the file menu.lst in /boot/grub/

The command sudo fdisk -l reads:

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: 0x00005cb2

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 19123 153497600 7 HPFS/NTFS
/dev/sda3 19123 25497 51200000 83 Linux
/dev/sda4 25497 60802 283585536 7 HPFS/NTFS


where /sda2 is windows and /sda3 is ubuntu.



When I run the command sudo update-grub, the following is outputted:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-13-generic
Found initrd image: /boot/initrd.img-2.6.38-13-generic
Found linux image: /boot/vmlinuz-2.6.38-12-generic
Found initrd image: /boot/initrd.img-2.6.38-12-generic
Found linux image: /boot/vmlinuz-2.6.38-11-generic
Found initrd image: /boot/initrd.img-2.6.38-11-generic
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
done


It can be seen that windows couldn't be found. I tried making my own 40_custom in /etc/grub.d/ but to no success.

My grub.cfg file reads the following:


#
# 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 video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=30
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
if background_color 44,0,30; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
if [ ${recordfail} != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 2.6.38-13-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux /boot/vmlinuz-2.6.38-13-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro quiet splash vt.handoff=7
initrd /boot/initrd.img-2.6.38-13-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-13-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
echo 'Loading Linux 2.6.38-13-generic ...'
linux /boot/vmlinuz-2.6.38-13-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.38-13-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 2.6.38-12-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux /boot/vmlinuz-2.6.38-12-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro quiet splash vt.handoff=7
initrd /boot/initrd.img-2.6.38-12-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-12-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
echo 'Loading Linux 2.6.38-12-generic ...'
linux /boot/vmlinuz-2.6.38-12-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.38-12-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-11-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux /boot/vmlinuz-2.6.38-11-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro quiet splash vt.handoff=7
initrd /boot/initrd.img-2.6.38-11-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-11-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
echo 'Loading Linux 2.6.38-11-generic ...'
linux /boot/vmlinuz-2.6.38-11-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.38-11-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos

insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux /boot/vmlinuz-2.6.38-8-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro quiet splash vt.handoff=7
initrd /boot/initrd.img-2.6.38-8-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
echo 'Loading Linux 2.6.38-8-generic ...'
linux /boot/vmlinuz-2.6.38-8-generic root=UUID=13afdc05-ed53-47cd-9691-9af7d8d9b406 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.38-8-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/11_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos3)'
search --no-floppy --fs-uuid --set=root 13afdc05-ed53-47cd-9691-9af7d8d9b406
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/11_memtest86+ ###

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

### BEGIN /etc/grub.d/13_os-prober_proxy ###
### END /etc/grub.d/13_os-prober_proxy ###

### BEGIN /etc/grub.d/14_os-prober_proxy ###
### END /etc/grub.d/14_os-prober_proxy ###



I've also tried using a GRUB manager like start up manager or grub customizer, but they failed to put windows back on my menu..


Can anyone help me out and put windows back? It would be much appreciated!

Thanks,
Jay

EDIT: I forgot to mention that this happened roughly 1.5 weeks ago after an Ubuntu update. I have no idea what changed, and I would assume any sort of GRUB refresh would mean a simple sudo update-grub would be the fix.. but is not the case here :[.

SteveDee
December 10th, 2011, 01:03 PM
Open Synaptic and make sure that: os-prober is installed.

Without this the system will not include Windows after you update grub.

darkod
December 10th, 2011, 03:05 PM
I wonder if there is error in the partition table, so the windows boot files are not found correctly on sda1.


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: 0x00005cb2

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 19123 153497600 7 HPFS/NTFS
/dev/sda3 19123 25497 51200000 83 Linux
/dev/sda4 25497 60802 283585536 7 HPFS/NTFS

It seems the last partition ends on cylinder 60802 and the total is 60801. But I'm not sure if this is the problem.

Rubi1200
December 10th, 2011, 03:14 PM
Please post the results of the boot info script as it will help give us a better overview of the situation.

Thanks.

raja.genupula
December 10th, 2011, 03:20 PM
if not getting then use grub recovery from my signature

Rubi1200
December 10th, 2011, 03:45 PM
if not getting then use grub recovery from my signature
With all due respect, grub recovery won't help if there are, as darkod suspects, errors in the partition table.

The boot script results might help us better identify the issue.

darkod
December 10th, 2011, 03:56 PM
People have reported using a utility called fixparts helps with partition table errors, but I have never used it myself. You can give it a go.

http://www.rodsbooks.com/fixparts/

As always when touching the partition table, be careful and better to have a backup of your data first.

oldfred
December 10th, 2011, 06:10 PM
I am not sure we need fixparts, yet.

The error on the end of the drive when reported in cylinders is often just a rounding error (especially since it is just one). Drives do not use cylinders anymore and the fdisk report in cylinders rounds from sectors. The boot info script will show it correctly or use this for sectors:


sudo fdisk -lu

AnsonKid
December 10th, 2011, 10:21 PM
Thanks for the responses guys, I appreciate it.

The command sudo fdisk -lu gives the output


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
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00005cb2

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 206848 307202047 153497600 7 HPFS/NTFS
/dev/sda3 307202048 409602047 51200000 83 Linux
/dev/sda4 409602048 976773119 283585536 7 HPFS/NTFS



When I ran the boot script sh, it gave me an error output before giving me RESULTS.txt:

boot_info_script version: 0.60 [17 May 2011]


"gawk" could not be found, using "busybox awk" instead.
This may lead to unreliable results.

Identifying MBRs...

Finished. The results are in the file "RESULTS.txt"
located in "/home/jay/Desktop/".



In RESULTS.txt is the following:


Boot Info Script 0.60 from 17 May 2011


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


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

no valid partition table found
"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/sda1 B2F0F653F0F61CF3 ntfs System Reserved
/dev/sda2 82F203B4F203AB8B ntfs
/dev/sda3 13afdc05-ed53-47cd-9691-9af7d8d9b406 ext4
/dev/sda4 40A24BC91DC6E2D3 ntfs

================================ Mount points: =================================

Device Mount_Point Type Options

/dev/sda2 /media/82F203B4F203AB8B fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)
/dev/sda3 / ext4 (rw,errors=remount-ro,commit=600)
/dev/sda4 /media/40A24BC91DC6E2D3 fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)


========= Devices which don't seem to have a corresponding hard drive: =========

sda

=============================== StdErr Messages: ===============================

grep: Unmatched [ or [^


Not really sure what any of this means though..

thanks for the help!
-Jay

oldfred
December 10th, 2011, 11:27 PM
Try rerunning it with gawk installed also. The above was just a small part of what it normally shows. But it also says you have a partition table issue, but the fdisk output looks ok.

sudo apt-get install gawk

AnsonKid
December 10th, 2011, 11:44 PM
After installing gawk, I reran the shell script and got the following output now:



Boot Info Script 0.60 from 17 May 2011


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


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

no valid partition table found
"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/sda1 B2F0F653F0F61CF3 ntfs System Reserved
/dev/sda2 82F203B4F203AB8B ntfs
/dev/sda3 13afdc05-ed53-47cd-9691-9af7d8d9b406 ext4
/dev/sda4 40A24BC91DC6E2D3 ntfs

================================ Mount points: =================================

Device Mount_Point Type Options

/dev/sda2 /media/82F203B4F203AB8B fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)
/dev/sda3 / ext4 (rw,errors=remount-ro,commit=600)
/dev/sda4 /media/40A24BC91DC6E2D3 fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)


========= Devices which don't seem to have a corresponding hard drive: =========

sda

=============================== StdErr Messages: ===============================

grep: Unmatched [ or [^

oldfred
December 11th, 2011, 12:17 AM
That did not help.

Script seems not to be able to parse partition table, but your fdisk output looks ok? I cannot see any overlap of sector output. Maybe fixparts will do something?

Backup partition table and post the text file this creates. Save a copy to another device just in case partition fixes do not work, as we can recover using this file if necessary.

sudo sfdisk -d /dev/sda > parts.txt

darkod
December 11th, 2011, 01:35 AM
fixparts or testdisk.
I wonder if testdisk will detect all partitions (like fdisk) does but in testdisk you have the option to write the partition table if they are detected correctly.
Assuming the detection is correct, just doing a write of the partition table should be helpful.

AnsonKid
December 13th, 2011, 03:14 PM
I'm a bit confused on what to do with fixparts.

I created the parts.txt file and saved it onto a USB. It reads:


# partition table of /dev/sda
unit: sectors

/dev/sda1 : start= 2048, size= 204800, Id= 7, bootable
/dev/sda2 : start= 206848, size=306995200, Id= 7
/dev/sda3 : start=307202048, size=102400000, Id=83
/dev/sda4 : start=409602048, size=567171072, Id= 7


I ran fix parts and had it print my partition tables again, but it looks roughly the same.


MBR command (? for help): p

** NOTE: Partition numbers do NOT indicate final primary/logical status,
** unlike in most MBR partitioning tools!

** Extended partitions are not displayed, but will be generated as required.

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x00005CB2
MBR partitions:

Can Be Can Be
Number Boot Start Sector End Sector Status Logical Primary Code
1 * 2048 206847 primary Y Y 0x07
2 206848 307202047 primary Y 0x07
3 307202048 409602047 primary Y 0x83
4 409602048 976773119 primary Y 0x07


What's next?

oldfred
December 13th, 2011, 05:50 PM
I am not sure I see a issue with partition table, and then am not sure why script does, may be something in script but script has always shown partition tables correctly unless there was a partition table error. Perhaps something else is wrong, but I just do not see it.

Sometimes just rewriting table can fix things.

AnsonKid
December 14th, 2011, 02:50 PM
So what specifically should I be doing to help put Windows back on my grub..?

How do we rewrite the tables?

Mark Phelps
December 14th, 2011, 02:55 PM
If you want to try a Windows-based solution, I've heard in another forum that the Partition Wizard Boot CD (free download) has an option to repair partitions. You could try using that -- it might be able to fix the NTFS partitions.

You could also check out EASEUS Partition Master. I believe they have a free download version as well.