How to Restore a Grub Menu.Lst File

Linux users, especially those who dual-boot with Windows, start things off with a boot loader to power up the computer and choose the operating system for the session. But if the GRUB boot loader fails, the whole computer is totally out of commission. One of the likeliest reasons for boot loader is that the GRUB menu.lst file may be corrupted. It's not that difficult to restore it, as it is a plain text file. Getting to it will not be possible, though, without bypassing the normal boot process.

These step assume your computer is a dual-boot with two partitions, with Windows in the first partition (/hda1) and Linux in the second partition (/hda2).

Things You'll Need

  • Live Linux CD
  • Text editor
Show More

Instructions

    • 1

      If the computer won't boot up, the best workaround is to start it up with a small Linux version--Puppy Linux or Slax--on a live CD-ROM. If you don't have one, borrow a computer with an online connection and go to any of these Linux sites and download the .iso file. Then burn it to a fresh CD as an .iso image, following the prompts from your CD burner.

    • 2

      Put in the live Linux CD, reboot, and log in as root. With Slax, the root username is "root" and "toor" is the password. If you're using Puppy Linux, you are automatically logged in as root.

    • 3

      Although your menu.lst file may be fouled up, you'll want to back it up anyway to be on the safe side. In a command shell, type:

      cp /mnt/hda2/boot/grub/menu.lst mnt/hda2/boot/grub/menu.lst_backup1

      This copies your existing menu.lst file, and puts it in the same directory as your menu.lst file.

    • 4

      Now you're going directly into the menu.lst file. In your command shell type:

      mcedit /mnt/hda2/boot/grub/menu.lst

      This will open the file in mcedit, an easy-to-use text editor. Most menu.lst files will look like this:

      # Linux bootable partition config begins
      title Vector Linux (on /dev/hda2)
      root (hd0,1)
      kernel /boot/vmlinuz root=/dev/hda2 ro vga=790
      # Linux bootable partition config ends

      # Other bootable partition config begins
      title Windows (on /dev/hda1)
      root (hd0,0)
      makeactive
      chainloader +1
      # Other bootable partition config ends

      In GRUB, disks and partitions start at zero, so (hd0,1) means the Linux system is on the first disk, second partition. Type in whatever changes you need check your editing, save, and exit.

    • 5

      Reboot, remove the CD-ROM, and test the computer. If it boots up and everything works, back up the restored menu.lst file. In a root shell, type:

      cp /mnt/hda2/boot/grub/menu.lst mnt/hda2/boot/grub/menu.lst_backup0

Tips & Warnings

  • It is recommended you keep a live Linux CD on hand for emergencies; when you're done put it in a safe place.

  • Be very careful working in a Linux root shell. You are able to change any system file, and can potentially do real damage.

  • If the restored menu.lst file does not work, typing errors are a likely reason. Check your work carefully.

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured