PDA

View Full Version : [ubuntu] grub not detecting windows 7 even after updating grub



noobad@linux
April 22nd, 2010, 08:35 PM
installed windows 7....then tried restoring grub using live cd....mounted partition somewhere else......then installed ubuntu again where it was installed previously and now grub is not detecting windows 7
but i am able use my windows files

used sudo update-grub2...but didnt help ............
plz help

oldfred
April 22nd, 2010, 08:45 PM
Just to know what is where:
Boot Info Script courtesy of forum member meierfra
Page with instructions and download:
http://bootinfoscript.sourceforge.net/
Be sure to highlight and use code tags (# in edit panel) to make it easier to read when you post the results.txt.

noobad@linux
April 26th, 2010, 04:30 PM
from bootscript file i am able to know in which partiton windows is ......how do i make grub detect it ?????

presence1960
April 26th, 2010, 04:55 PM
post the entire contents of the RESULTS.txt file generated by the boot info script so we can see exactly your setup & boot process.

HolyAvenger
June 24th, 2010, 02:00 AM
Hello,

I'm experiencing this same issue on UBuntu 9.04. I had a previous W7 installation and after installing Ubuntu 9.04 (And Grub with it, it installed itself on its own), I can only boot Ubuntu. It does not offer a menu of any kind, it goes straight for the splash and login screen on Ubuntu.

I wish to recover my installation of windows, because I had sensitive data and programs I need to work/study.

I followed the step of runing the bash script and here is the RESULTS.txt content.

As a side-note; gedit /boot/grub/menu.lst made me realize I have no such thing as a menu.lst (I assume its a list file/config file). I tried following this guide, but was stuck on that step because I have no such file.
Link to the guide I was following (http://forums.opensuse.org/get-help-here/install-boot-login/431691-help-grub-not-detecting-windows-7-a.html) (Yes, it's for SuSE. But I assume that, since its GNOME, and its GRUB and not the SO itself, there shouldn't be much of a difference.

If you need me to post any extra information, please tell me so.

Thank you for any kind of help you can provide.


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 #1 for /boot/grub.
=> Windows is installed in the MBR of /dev/sdb

sda1: __________________________________________________ _______________________

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

sda2: __________________________________________________ _______________________

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

sda6: __________________________________________________ _______________________

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

sdb1: __________________________________________________ _______________________

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:

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

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x09bf09bf

Partition Boot Start End Size Id System

/dev/sda1 * 63 104,872,319 104,872,257 83 Linux
/dev/sda2 104,872,320 488,375,999 383,503,680 f W95 Ext d (LBA)
/dev/sda5 104,872,383 209,744,639 104,872,257 7 HPFS/NTFS
/dev/sda6 209,744,703 488,375,999 278,631,297 7 HPFS/NTFS


Drive: sdb ___________________ __________________________________________________ ___

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
240 heads, 63 sectors/track, 64601 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000001

Partition Boot Start End Size Id System

/dev/sdb1 63 976,767,119 976,767,057 7 HPFS/NTFS


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 b609c930-ef9d-43f9-9cb1-bdebecdf157d ext4
/dev/sda5 1C4C84354C840BA8 ntfs Sistema Operativo
/dev/sda6 28E4BF47E4BF1652 ntfs Juegos
/dev/sdb1 8C42B21E42B20CC8 ntfs Miscelaneo

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

Device Mount_Point Type Options

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


=========================== sda1/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 /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set b609c930-ef9d-43f9-9cb1-bdebecdf157d
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
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/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-22-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set b609c930-ef9d-43f9-9cb1-bdebecdf157d
linux /boot/vmlinuz-2.6.31-22-generic root=UUID=b609c930-ef9d-43f9-9cb1-bdebecdf157d ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic
}
menuentry "Ubuntu, Linux 2.6.31-22-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set b609c930-ef9d-43f9-9cb1-bdebecdf157d
linux /boot/vmlinuz-2.6.31-22-generic root=UUID=b609c930-ef9d-43f9-9cb1-bdebecdf157d ro single
initrd /boot/initrd.img-2.6.31-22-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set b609c930-ef9d-43f9-9cb1-bdebecdf157d
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=b609c930-ef9d-43f9-9cb1-bdebecdf157d ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set b609c930-ef9d-43f9-9cb1-bdebecdf157d
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=b609c930-ef9d-43f9-9cb1-bdebecdf157d ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ ${timeout} != -1 ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### 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 ###

=============================== sda1/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 defaults 0 0
# / was on /dev/sda1 during installation
UUID=b609c930-ef9d-43f9-9cb1-bdebecdf157d / ext4 errors=remount-ro 0 1
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

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


3.7GB: boot/grub/core.img
3.7GB: boot/grub/grub.cfg
.6GB: boot/initrd.img-2.6.31-14-generic
.3GB: boot/initrd.img-2.6.31-22-generic
.5GB: boot/vmlinuz-2.6.31-14-generic
.7GB: boot/vmlinuz-2.6.31-22-generic
.3GB: initrd.img
.6GB: initrd.img.old
.7GB: vmlinuz
.5GB: vmlinuz.old
=======Devices which don't seem to have a corresponding hard drive==============

sdc

darkod
June 24th, 2010, 02:09 AM
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: Windows 7
Boot files/dirs: /Windows/System32/winload.exe

You are missing two win7 boot files. And your win7 is installed in a logical partition. Usually windows needs to be on primary partition.

Did you delete any partitions before installing ubuntu? Sometimes the win7 boot files are on a small 100MB partition. If you delete it, you loose the files. Since you don't have a swap partition I guess you must have used a manual partitioning while installing.

HolyAvenger
June 24th, 2010, 12:37 PM
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: Windows 7
Boot files/dirs: /Windows/System32/winload.exe

You are missing two win7 boot files. And your win7 is installed in a logical partition. Usually windows needs to be on primary partition.

Did you delete any partitions before installing ubuntu? Sometimes the win7 boot files are on a small 100MB partition. If you delete it, you loose the files. Since you don't have a swap partition I guess you must have used a manual partitioning while installing.

Hmmm, I have two HD. One 250 HD is partitioned in 3:
c: 50gb, d: 50gb, e: 150gb

I had the three of them be NTSF and I had in C: an old XP installation, in d: my windows7 installation and in e: games (Steam's installed there).

It was my intention all along to install Ubuntu on C: right after installing windows7 on D: to delete XP, but I did it just yesterday due to time constraints.

Just out of curiosity, can something be done to recover that installation? Or must I reinstall it all? If so, how do I make it so that when I install windows, it DOES keep my booting option for Ubuntu? I often install on dual boots windows first because when I install Ubuntu it handles the booting stuff it on its own.

darkod
June 24th, 2010, 12:52 PM
I'm not sure, somehow it resulted in a huge mess. You have ubuntu on a primary partition and win7 on a logical. Usually it's the other way around because windows requires to work from primary partition (at least it's boot files to be on one), and linux is fine on a logical.

One option might be creating small primary ntfs partition. I see you have around 10MB unallocated space after the extended partition, but I'm not sure if that's enough.

You could try creating primary ntfs partition from it, then use Gparted to set a boot flag on it, and remove it from /dev/sda1.

After that try to repair with your win7 install dvd. Get an image of repair cd here if you don't have one:
http://neosmart.net/blog/2009/windows-7-system-repair-discs/

Try the manual procedure from here, if it doesn't work also try the automated repair:
http://ubuntuforums.org/showthread.php?t=1014708

If that makes win7 boot it will probably overwrite grub2 on the MBR. Reinstall grub2 back from live mode with:

sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda

HolyAvenger
June 24th, 2010, 03:57 PM
OK, thanks for the help.

I think it will be just faster if I back everything up and reinstall.

But before doing so, let me see if I understand this right;

If I were to reinstall Windows7 on C: (which is a primary partition) and Ubuntu on D: (Logical), it would work just fine? I'm asking just in case.

Also, can't I make them both Primary? I know it might sound as a silly question, but I had that doubt suddenly come up.

edit
Oh, by the way;
Can I install Ubuntu first and THEN Windows? Is there a guide to do that?

darkod
June 24th, 2010, 04:21 PM
Number 1. Stop calling them C: and D:. For example use the linux labeling, /dev/sda1, /dev/sda5, etc. The number of the partition on the disk. The idiotic way windows "calls" partition is why this problem happened. The boot files were on /dev/sda1 which had XP, because they need to be on a primary partition. In that moment win7 worked fine even though it was on logical partition /dev/sda5 because its boot files were on the primary /dev/sda1. You installed ubuntu on /dev/sda1 deleting the win7 boot files, and that's where you stand.

Yes, you can make them primary. You can have 4 primary, or 3 primary + 1 extended partitions on a hdd.

My suggestion:
If possible, copy all your necessary data from /dev/sda5 and /dev/sda6 to ext hdd. You can do that from ubuntu which is still working.
After that is done, and you are happy with your backup, open Gparted in ubuntu and delete in this order /dev/sda6, /dev/sda5 and then /dev/sda2. That will leave only /dev/sda1 and the rest of space unallocated. Hit the green button in Gparted to execute the changes.

After that, again in Gparted create a 50GB primary ntfs partition, to hold your win7. It's better to use Gparted and not the win7 installer because that way you save a primary partition. The win7 installer will want to create small 100MB boot partition which is pointless.

Again in Gparted, from the rest of the space create logical ntfs partition but leave around 2GB unallocated at the end, don't use all space. This is for swap partition that you didn't install with ubuntu. But we will talk about that later.

You should calculate for swap either 2GB or if you hibernate regularly 1.5 x RAM size. That much space you need to leave unallocated at the end of the disk.

Don't forget to use the green button in Gparted to execute changes after you make them. When all this is done boot with the win7 dvd and tell it to install in the 50GB partition you prepared. Boot win7 few times to make sure it's OK.

After that reinstall grub2 to the MBR from live mode with:
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda

Copy back your data from the ext hdd, either using ubuntu or win7, doesn't matter.

In this situation you will have ubuntu on /dev/sda1 untouched, win7 on a primary partition probably named /dev/sda2, and the ntfs data partition named /dev/sda5 (logical partitions start to get counted from 5).

Later if you feel like it, you can create swap area with Gparted from the space you left at the end, and set ubuntu to use it as swap partition.

This would be the best way, but the big question is can you move the data to ext hdd.

darkod
June 24th, 2010, 04:22 PM
edit
Oh, by the way;
Can I install Ubuntu first and THEN Windows? Is there a guide to do that?

You don't need to reinstall ubuntu at all, just add grub2 to the MBR after installing win7. Read the previous post, it will be clear I hope. :)

oldfred
June 24th, 2010, 04:43 PM
I have not done it, but since you have sda5 & sd6 in sda2, extended and have available primary partitions you can redefine the partition table and in effect change sda5 to sda2, sda6 to sda3 and still have sda4 available for extended and additional logical partitions if you want.

You still would need a full backup in case it does not work. You export your partition table to a text file, manually recalculate start & lengths and partition types. since you only have 4 and are changing 2 the math should be relatively simple.

Caljohnsmith using sfdisk to edit partition table from text file
http://ubuntuforums.org/showthread.php?t=1036600
caljohnsmith and meierfra use sfdisk links:
Using sfdisk to fix partition table problems - not without risk
http://ubuntuforums.org/showthread.php?t=1192598