If you messed up your VM and made it unbootable, it's often useful to be able to go in and edit /boot/grub/grub.conf. This guestfish script shows how to do that.

Usage assumes that the VM has a separate /boot partition containing grub, which is usually the case. So for example:

editgrub.sh broken-guest.img /dev/sda1