View Full Version : [ubuntu] Grub2 - windows partition

July 11th, 2010, 08:00 AM
Hello everybody,
just a quick question, as I know it most probably is a dumb quickly-fixable question, but how do you make a Windows partition bootable ? I had Win7 installed on a partition a while ago, with Windows Xp, so the bootloader was Win7's. I now replaced Win7 with Ubuntu10.04 64-bit but my WinXp is not bootable anymore. I've added a menu entry in grub2 but to no avail, as the partition is not bootable. Any ideas ? Thanks !

Device Boot Start End Blocks Id System
/dev/sda1 1 244 1951744 82 Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2 2159 56881 439562497+ 7 HPFS/NTFS
/dev/sda3 56882 60799 31471304+ f W95 Ext'd (LBA)
/dev/sda4 * 244 2158 15380480 83 Linux
/dev/sda5 56882 60799 31471303+ 7 HPFS/NTF

July 11th, 2010, 08:27 AM
A little update:

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 #4 for /boot/grub.

sda1: __________________________________________________ _______________________

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

sda2: __________________________________________________ _______________________

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

sda3: __________________________________________________ _______________________

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 XP
Boot files/dirs:

sda4: __________________________________________________ _______________________

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

=========================== 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 3,905,535 3,903,488 82 Linux swap / Solaris
/dev/sda2 34,668,270 913,793,264 879,124,995 7 HPFS/NTFS
/dev/sda3 913,793,326 976,735,934 62,942,609 f W95 Ext d (LBA)
/dev/sda5 913,793,328 976,735,934 62,942,607 7 HPFS/NTFS
/dev/sda4 * 3,905,536 34,666,495 30,760,960 83 Linux

blkid -c /dev/null: __________________________________________________ __________


/dev/sda1 58400c6e-483d-4bac-ba93-a66c90a332d2 swap
/dev/sda2 6050EBB950EB9456 ntfs E
/dev/sda3: PTTYPE="dos"
/dev/sda4 1b811f97-a2ef-4b34-b259-1c18355304cd ext4
/dev/sda5 90ACFB2EACFB0E0A ntfs
/dev/sda: PTTYPE="dos"
error: /dev/sdb: No medium found
error: /dev/sdc: No medium found
error: /dev/sdd: No medium found
error: /dev/sde: No medium found

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

Device Mount_Point Type Options

/dev/sda4 / ext4 (rw,errors=remount-ro)
/dev/sda5 /media/90ACFB2EACFB0E0A fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)
/dev/sda2 /media/E fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)

=========================== sda4/boot/grub/grub.cfg: ===========================

# 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
set default="2"
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

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

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,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
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
insmod ext2
set root='(hd0,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
set timeout=-1
set timeout=10
### 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-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd0,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=1b811f97-a2ef-4b34-b259-1c18355304cd 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 {
insmod ext2
set root='(hd0,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=1b811f97-a2ef-4b34-b259-1c18355304cd 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/11_Windows ###
menuentry "Windows XP" {
set root=(hd0,5)
chainloader +1
### END /etc/grub.d/11_Windows ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
linux16 /boot/memtest86+.bin
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,4)'
search --no-floppy --fs-uuid --set 1b811f97-a2ef-4b34-b259-1c18355304cd
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
set timeout=0
if sleep --interruptible 3 ; then
set timeout=0
### 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 ###

=============================== sda4/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/sda4 during installation
UUID=1b811f97-a2ef-4b34-b259-1c18355304cd / ext4 errors=remount-ro 0 1
/dev/sda1 none swap sw 0 0

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

15.2GB: boot/grub/core.img
4.3GB: boot/grub/grub.cfg
15.2GB: boot/initrd.img-2.6.32-21-generic
15.2GB: boot/vmlinuz-2.6.32-21-generic
15.2GB: initrd.img
15.2GB: vmlinuz
=======Devices which don't seem to have a corresponding hard drive==============

sdb sdc sdd sde

July 12th, 2010, 01:12 AM
When you install two copies of windows, it copies the boot files to the one with the boot flag (active partition).

It looks like you deleted the copy of windows that contained all the boot files. I hope your install is not in sda5. Windows will only boot a logical partition thru a primary partition.

If you XP install is in sda2, move the boot flag to sda2. Windows has to have the boot flag. Grub/Ubuntu does not use a boot flag, but some BIOS require a boot flag on a primary partition (assumes windows).

You can use gparted or disk utility or :
set boot flag on for sda2 (off for others)
sudo sfdisk -A2 /dev/sda

Description of the Windows XP Recovery Console for advanced users
To run the Recovery Console from the Windows XP startup disks or the Windows XP CD-ROM, follow these steps:
1. Insert the Windows XP startup disk into the floppy disk drive, or insert the Windows XP CD-ROM into the CD-ROM drive, and then restart the computer.

Click to select any options that are required to start the computer from the CD-ROM drive if you are prompted.
2. When the "Welcome to Setup" screen appears, press R to start the Recovery Console.
3. If you have a dual-boot or multiple-boot computer, select the installation that you must access from the Recovery Console.
4. When you are prompted, type the Administrator password. If the administrator password is blank, just press ENTER.
5. At the command prompt, type this commands one at a time.

FIXMBR C: #do not run if you still want grub or be prepared to reinstall grub
Can you boot into Ubuntu? If so you can mount your Windows drive and navigate to C:\windows\ServicePackFiles\i386 folder and copy
ntdetect.com and ntldr to root of C:\.

BOOTCFG /rebuild