I was setting up Windows 7 on my laptop, which trashed access to the existing Linux Ubuntu installation on the machine (as any Windows install will do). By the way – if you want to install Windows 7 on a free partition to dual boot, its possible, but I had to make the free partition ‘active’ to make Windows recognise it as a ‘system’ partition … but I digress.

Anyway, I followed the instructions in this post – http://ubuntuforums.org/showthread.php?t=224351 – to restore the boot loader (Grub) and get Linux booting again, but then had to add an entry to allow me to select the new Windows installation.

Well, again I was able to use the usual way you get another non-Linux OS running within Grub, and there are loads of resources on the Internet to tell you how to do this.

For me it was an entry like this in menu.lst:

title Windows 7
rootnoverify (hd0,1)
makeactive
chainloader +1

But I was getting the error “Invalid or Unsupported Executable Format”. After quite a bit of searching around, with lots of varied responses to this particular error, I just couldn’t see what was wrong.

Then, after staring at the grub configuration for quite a long time, eventually I realised that the rootnoverify command had no space between the rootnoverify and the brackets – i.e. “rootnoverify(hd0,1)” … after adding a space, as shown above, all was well.

This post is just in case someone else has the same problem, and to remind them that before they start trying all the variants of grub commands and partition numbers that the Internet serves up in response to that error, do check the exact syntax of the menu.lst file first!