GRUB problem

I am dual booting Windows 7 with Ubuntu 11.04 but when booting I get the message

error: unknown filesystem
grub rescue>

I have managed to boot into GRUB 2 using

set prefix=(hd0,5)/boot/grub
set root=(hd0,5)
insmod normal
normal

Is there a way to fix GRUB so I don’t have to manually boot into it?
Thanks

If your above boot procedure works all the time …

First thing I’d do is set the system to run fsck on the next boot:

sudo touch /forcefsck

then reboot … use your procedure to boot … fsck will run automatically during the boot.

if that doesn’t fix things … try:

sudo update-grub

if that doesn’t fix things … see here for instructions on reinstalling GRUB from a LiveCD;
http://linuxforums.org.uk/index.php?topic=7201.0