Had everything working perfectly, then I tried to be clever.

SSSS

Member
I've been setting up a new system, triple-boot between Ubuntu, Windows 7 64-bit, and Windows 7 32-bit. I wanted to be able to boot between all three using the Grub menu alone, no Windows boot menu. And it worked fine, until I tried to mess with stuff; I accidentally screwed up the boot loader or boot sector or something on the 32-bit Windows 7 partition and I've been trying to use EasyBCD and other tools to fix it with no luck.

Here's what the partition table looks like (in Linux terms):

/dev/sda1 -- Ubuntu ext4
/dev/sda2 -- Windows 7 64-bit NTFS
/dev/sda3 -- Extended
/dev/sda4 -- Windows 7 32-bit NTFS

I installed Ubuntu first, installed Grub to /dev/sda1 (I haven't used Linux in years but back in 2001 I was a huge advocate of never putting anything in the MBR other than the standard MBR). Installed Windows 7 64-bit to /dev/sda2; the Windows installer made /dev/sda2 the only active partition & put a BCD on there. Then I installed Windows 7 32-bit to /dev/sda4; the Windows installer made /dev/sda4 the only active partition & put a BCD on there. I used the Ubuntu Live CD to set /dev/sda1 as the active partition again, added Grub entries pointing to the two Windows installs, and I had full functionality to boot between the OS's using Grub alone.

Perfect, right? I should have left it at that, but I had some leftover space at the end of the drive that I'd intended to put in my Extended partition, but I didn't so I couldn't do anything with it. So I booted into Ubuntu and made a disk image of /dev/sda4 onto an external drive using the dd command (Disk Duplicator). I expanded my Extended parition and re-created /dev/sda4 so that it was EXACTLY the same size as before, but now 100% of my disk was partitions. Yay! So I used dd again to restore that disk image to the partition, booted into 64-bit Windows (/dev/sda2), and verified that the filesystem on /dev/sda4 was completely intact and functional. Yay!

But... I apparently lost the boot sector on /dev/sda4, since I can no longer boot it through Grub (hangs on a "Starting Up" message), or boot it directly by seeing it as the only active partition ("A disk read error occurred" message). Jeer!

I used EasyBCD in order to create an entry on /dev/sda2 pointing to /dev/sda4 so I can now boot into Windows 7 32-bit using the Windows boot menu.... but that's not how I want to do it, I want it back the way it was before so I can boot them all directly from Grub!

I tried creating the BCD on /dev/sda4, I tried booting from the Windows 7 install CD and letting it Repair it, I tried booting from the Windows 7 install CD and using the command line to run the "bootsect" program to fix the boot sector on /dev/sda4... no luck!

Anything else I can try other than just reinstalling the 32-bit Windows 7 installation on /dev/sda4? I had it working before I moved the partition so it has to be possible to get it working like that again.

Addendum:

And just to clarify, since moving the partition I CAN still boot into the 32-bit Windows 7 on /dev/sda4, I just can't do it directly or through Grub., I have to do it through a boot menu on the 64-bit Windows 7 partition /dev/sda2; I can either make /dev/sda2 the primary partition and select the appropriate entry (added with EasyPCB) to boot from /dev/sda4, OR I can make /dev/sda1 the primary partition, get the Grub menu, select the entry that boots /dev/sda2 at get the Windows boot menu, then select the entry that jumps it to /dev/sda4... sheesh. Before I moved the partition, I could boot /dev/sda4 directly through Grub, or I could even boot it directly by seeing it as the active partition.... but I can't do that anymore.
 
Last edited:
Sure thing! menu.lst is attached. I'm new at using Grub, I've been out of the Linux world for years and in the past I mainly used lilo and Chos (which was awesome but I guess it's been dead since 2003).

And while I'm in there, here's my partition table too.

Code:
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b6bc4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       13055   104864256   83  Linux
/dev/sda2   *       13056       26110   104864287+   7  HPFS/NTFS
/dev/sda3           26111       30220    33013575    5  Extended
/dev/sda4   *       30221      121601   734017799+   7  HPFS/NTFS
/dev/sda5           26111       26371     2096482   82  Linux swap / Solaris
/dev/sda6           26372       26632     2096448   83  Linux
/dev/sda7           26633       30220    28820578+   b  W95 FAT32
 

Attachments

  • menu.lst.txt
    4.6 KB · Views: 2
Your menu.lst doesn't display correctly in Notepad. Please open it up, copy the contents, and paste into your next post, and then wrap quote tags around it.
 
Sorry about that.

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 3

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 5

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

#A splash image for the menu
splashimage=/boot/grub/splashimages/fiesta.xpm.gz

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
## password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=e6a4f625-ac40-4fcc-8fbf-5fa76f639b21 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=e6a4f625-ac40-4fcc-8fbf-5fa76f639b21

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=splash quiet

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=detect

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid e6a4f625-ac40-4fcc-8fbf-5fa76f639b21
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=e6a4f625-ac40-4fcc-8fbf-5fa76f639b21 ro splash quiet
initrd /boot/initrd.img-2.6.28-11-generic
quiet

title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid e6a4f625-ac40-4fcc-8fbf-5fa76f639b21
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=e6a4f625-ac40-4fcc-8fbf-5fa76f639b21 ro single
initrd /boot/initrd.img-2.6.28-11-generic

title Ubuntu 9.04, memtest86+
uuid e6a4f625-ac40-4fcc-8fbf-5fa76f639b21
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

title Windows 7 64-bit
rootnoverify (hd0,1)
chainloader (hd0,1)+1

title Windows 7 32-bit
rootnoverify (hd0,3)
chainloader (hd0,3)+1
 
Replace
title Windows 7 32-bit
rootnoverify (hd0,3)
chainloader (hd0,3)+1
at the end of your menu.lst file, with
Code:
title Windows 7 32-bit
root (hd0,3)
makeactive
chainloader +1
boot
instead, and see if that helps.
 
Last edited:
Wow! It worked, thanks! That raises the question, though, why did it work okay before I moved the 32-bit Windows partition, and why did I only have to do that for the 32-bit but not for the 64-bit?

Addendum:

Just noticed you edited your post, I actually did it the first way before you edited it, and it worked like that.
 
Last edited:
Can you get in all OSes now directly from Grub?

Addendum:

Wow! It worked, thanks! That raises the question, though, why did it work okay before I moved the 32-bit Windows partition, and why did I only have to do that for the 32-bit but not for the 64-bit?

Addendum:

Just noticed you edited your post, I actually did it the first way before you edited it, and it worked like that.
Right. :smile: That is why I changed it back...
I have no idea why it caused problems when you deleted the original Win 7 sda4 partition, after making an image of it, and then re-creating the partition, and restoring the image back to that partition, and why that fixed it. It was just an idea, something I thought may work, and I'm certainly not an expert at Grub. :brows:
But it would seem Windows insists on having itself be made "active" sometimes, and other times it doesn't, and I have no idea why.
 
Last edited:
One strange thing that I noticed on your system is that you have two NTFS partitions marked as "boot" (in Linux terms, or "active" in Windows terms): sda2 (your Win 7 64-bit partition), and sda4 (your Win 7 32-bit partition). Until now I have never heard of such a thing, and I believe the standard is to only have a single "active" partition on any given disk (and I believe it may confuse things-the Microsoft boot manager for sure-if you have more than one "active" partition on a disk at a time). But, apparently, you have two partitions marked as "active", and it could have something to do with restoring an image to the partition. Just curious...but did you happen to have sda4 set to "active" before you made an image of it, and then later set sda2 to "active"? :wink:
 
I was toggling that around all day trying different things; originally when everything was working I had /dev/sda1 set as active to go straight to Grub, and I had both Windows partitions set as active as well (I know it's not really needed, but I believe it only pays attention to the first one so it shouldn't have hurt anything). When I copy/pasted that partition table I had /dev/sda2 set as active so it'd hit the Windows boot menu first, and then I used an option in the Windows boot menu (added with EasyBCD) to get to Grub (kind of cool that I can freely switch back & forth betweent he two menus), but that was just because I was trying different things. Right now I have /dev/sda1 set as active again so I go straight to Grub, and the Windows partitions not set as active, but it seems to work either way since I edited the menu.list, whereas before that it didn't work any way I did it.
 
I was toggling that around all day trying different things; originally when everything was working I had /dev/sda1 set as active to go straight to Grub, and I had both Windows partitions set as active as well (I know it's not really needed, but I believe it only pays attention to the first one so it shouldn't have hurt anything). When I copy/pasted that partition table I had /dev/sda2 set as active so it'd hit the Windows boot menu first, and then I used an option in the Windows boot menu (added with EasyBCD) to get to Grub (kind of cool that I can freely switch back & forth betweent he two menus), but that was just because I was trying different things. Right now I have /dev/sda1 set as active again so I go straight to Grub, and the Windows partitions not set as active, but it seems to work either way since I edited the menu.list, whereas before that it didn't work any way I did it.
Ok, but which partition was set to active when you made an image of the sda4 partition?
Also, what did you use to "copy/paste the partition table"?
Not really important since you got it fixed now, but it may help future users. :wink:
 
I believe when I made the image, sda1 sda2 and sda4 were all set as active. Then I believe as soon as I re-created sda4 in the new position & restored the image, I set it to active again (meaning once again all three were), but I couldn't boot off sda4 anymore. I'm not sure what I was thinking having them all set as active, but it's been about 7 years since I've this sort of stuff so my memories were rather fuzzy but now I remember that's not the normal way of doing it. (And I was hoping that after 7 years they'd have replaced the primary/extended/logical system with something more flexible, but I guess not; at least they managed to get rid of the 1024-cylinder thing.)

And when I referred to copy/pasting the partition table I was just referring to when I pasted it out of fdisk into my post towards the top of this thread.
 
And I'm assuming you used Gparted to set those partitions to active? I know for a fact Windows Disk Management will not let you do that; it will only allow you to have one partition on any given disk set to active at any given time, and when you change the "active" status to a different partition, it makes the current "active" partition relinquish its "exalted" status at the same time. That is also true of the 3rd party boot manager that I use.
 
Last edited:
Jake, Linux "boot" is WIndows "system"
The "active" flag is separate
The "active" flag tells the MBR which "system" or "boot" to start with.
Windows confuses the issue by only displaying "system" on the set of boot files that started the current "boot" ("boot" in red meaning the Windows definition of "boot" ie the system that's running).
On my PC with 4 primaries on 2 HDDs each containing a complete independent install (Vista XP W7 and Ubuntu), each of the OSs becomes both "system" and "boot" when you boot it, but the tiny partition (which I've named Boot, just to add further confusion) containing my grub4dos, is the only one which is "active" on the first HDD, and is never "system" or "boot"
If I boot W7 on the 2nd HDD, it is also "active" as well as "system" and "boot" because it's on a different HDD.
There can only be one "active" partition per HDD, but they can all contain boot files.
I haven't verified it, but I suspect that GPartEd will show "boot" on all four.
 
Back
Top