Windows wont load, grub error?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

blue4paper

Thread Starter
Joined
Aug 10, 2007
Messages
129
My windows has this error when i try and load it "Error 13 Invalid or unsupported executable format" i've googled around and found lots of people had this problem and it all resulted from grub issues. Unfortunately i couldn't find any good solutions seeing as people had different scenarios. Anyways here's a copy of my grub.

# 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 4

## 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

## 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 XP
# root (hd0,0)
# savedefault
# makeactive
# map (hd0) (hd1)
# map (hd1) (hd0)
# 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=2f19714a-5ea2-472c-bc37-642844e9adc3 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,5)

## 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=quiet splash

## 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

## 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 7.10, kernel 2.6.22-14-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=2f19714a-5ea2-472c-bc37-642844e9adc3 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd0,5)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=2f19714a-5ea2-472c-bc37-642844e9adc3 ro single
initrd /boot/initrd.img-2.6.22-14-generic

title Ubuntu 7.10, memtest86+
root (hd0,5)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
makeactive
chainloader +1
 
Joined
Jan 17, 2004
Messages
804
First Name
Jim
Most likely the grub issue is with that entry titled; "root", which is just above your Windows XP boot information. If you just have Ubuntu and XP installed and dual booting, then just edit the menu.lst file which is located in; /boot/grub/, and you need to be logged in as root. I did this with this typed in a command prompt terminal window; sudo gedit /boot/grub/menu.lst , and this will open your grug file to edit as root, and do a save, then close it. Also here is a good and helpful Linux forum site; http://www.linuxquestions.org/questions/
 
Joined
Jun 11, 2004
Messages
3,888
The OP has already posted the menu.lst in Post #1.

As usual the OP has done most other posters have done, just reported the error and showed insufficient detail to enable others to fix it.

The error "Error 13 Invalid or unsupported executable format" actually means Grub cannot execute the "chainloader +1" command. To put it bluntly the partition (hd0,0) Grub has been asked to chainload is not chainloadable. In chainloading Grub is asked to surrend its control to another boot loader which in this case should be XP's NTLDR. Grub is ready to pass over the control but no one is available to receive it.

It is likely the 1st partition of the 1st disk or (hd0,0) in Grub's convention, is a recovery partition of one that stored computer's hardware drivers. Thus if the correct partition is specified Xp will boot because by default it "always" has NTLDR installed in its boot sector.

To cure it one needs to know which partition has XP. The easiest is to post the partition details by commands in Ubuntu terminal
Code:
sudo su
fdisk -l
The partition that has type 7, indicating it is a ntfs partition, and shown "active", attached by a *, will be the bootable Xp partition.
 

blue4paper

Thread Starter
Joined
Aug 10, 2007
Messages
129
heres my fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc55dc55d

Device Boot Start End Blocks Id System
/dev/sda1 * 8551 19457 87610446 7 HPFS/NTFS
/dev/sda2 2 8550 68669842+ f W95 Ext'd (LBA)
/dev/sda5 2 263 2104483+ 82 Linux swap / Solaris
/dev/sda6 264 8550 66565296 83 Linux
 
Joined
Oct 27, 2004
Messages
191
I would do a search for "Super Grub" and put on a CD(bootable). This will boot to anything (O/S) you have in the computer. Works great!
 

blue4paper

Thread Starter
Joined
Aug 10, 2007
Messages
129
thanks for suggestions, unfortunately didn't work. I fiddled around with just about every option in Super Grub and windows still didn't boot.
 
Joined
Jun 11, 2004
Messages
3,888
Your menu.lst actually proves I was wrong because your (hd0,0) is indeed Type 7 and has a *.
Code:
/dev/sda1 [COLOR="Red"]*[/COLOR] 8551 19457 87610446 [COLOR="Purple"]7[/COLOR] HPFS/NTFS
In that case can I ask you to boot the XP up manually?

As you can post the Ubunu's menu.lst this make me think your Grub is displaying the menu.lst and you can boot to Ubuntu. It is just the XP that is not working, right?

To boot operating systems manually you press "c" key and get a Grub prompt. No matter how hard I try I cannot find a working PC system that cannot be booted by a Grub prompt! You can boot any system manually using the commands in menu.lst by omitting the "title" statement and finish lastly with an extra "boot" statement. Any line in menu.lst with a "#" in front is not acted by Grub.

You first ask Grub to verify the partition details by command
Code:
geometry (hd0)
This command produces the same output as "fdisk -l" in Linux except the partition numbering system is in Grub's convention. You then try to fire up XP by these command, one line at a time
Code:
root (hd0,0)
chainloader +1
boot
The above is virtually identical to the command in menu.lst. I did not use "savedefault" because there is no need. I omitted "makeactive" because (hd0,0) is already active, as confirmed by the *.

Grub will respond to each line. It will confirm Type 7 partition is found after the "root (hd0,0)" command. No message is acceptable. A problem is always responded with a message.

If it doesn't object to the 2nd line of "chainloader +1" then Xp should fire up by the 3rd line "boot".

If the same error 13 as before is reported after the 2nd line then your NTLDR has been accidentally damaged and you need to restore it by "fixboot" and/or "fixmbr" command using the XP installation CD.

If Xp can be booted manually but not automatically by menu.lst then you need to restore Grub. Instruction to do this will be provided if you need it.

Let's us know how you get on.

"Super Grub" is to let a middleman in between you and Grub. You can get everything you want from a Grub prompt because you are talking to Grub directly equivalent to pointing a gun to its head! Why people want to do it through a middleman I never know.
 
Joined
Aug 4, 2008
Messages
1
Hi there,

Thanks for your advice. I had the same problem with the 'Error 13' during boot. It initially happened when I tried to alter the bootloader with a program kalled QGrub (or something like that). I wanted to change the default boot as it was starting the memtest as default instead of Windows XP. After changing the boot default to XP I restarted and it would fail with the 'error 13'.

Now I just tried your advice with the manual boot and it seems to work (I'm typing this from Windows XP).

But hwo can I restore the original menu.lst, so I don't have to manually start my windows XP?

Thanks,

P
 
Joined
Jun 11, 2004
Messages
3,888
If you know to boot a system manually with Grub you can also ask it to display the menu.lst.

Say your Linux is in the 2nd partition of the 1st disk known to Grub as (hd0,1) as it counts from zero. Grub will display the menu.lst on the screen if you issue this command
Code:
cat (hd0,1)/boot/grub/menu.lst
You can then type the booting instructions manually, word for word and line by line, and the system will fire up when you give the green light to boot by adding this coomand last
Code:
boot
You can modify menu.lst anyway you want using an editor.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top