Missing Your menu.lst? You've Got Grub2!

Tuesday, June 15, 2010

If you're like me, you'd have been taking advantage of the popularity of Virtual Machine software to try out new Linux distributions. Or if you have a dual-boot (with Windows on one end and a Linux favorite on the other), you've been content at upgrading Linux from version to version without doing a full reinstall. Then there comes the confusion when doing a fresh install and you realize you don't know what that heck happened to the /boot/grub/menu.lst file on your Grub.

Since Ubuntu 9.10, Grub 2 has become the default boot loader. If you are looking for the menu.lst file that used to be what you edited to specify which OS to boot into by default, then I'm telling you it is gone. In Grub 2, the file that closely resembles its functionality is /boot/grub/grub.cfg, but that isn't supposed to be edited. You need to edit something else and then update grub.cfg. Here's how to do it in Ubuntu and Linux Mint, 2 of the distros I usually end up installing.

After installing Ubuntu or Mint and rebooting for the first time, take note of the menu entries. They usually follow the following pattern:

Ubuntu, linux *kernel_version_here*
Ubuntu, linux *kernel_version_here* (recovery mode)
Memory Test (memtest86+)
Memory Test (memtest86+, serial console mode)
Windows OS

Here's a sample of how it looks like on my desktop, Linux Mint as it were:

Now note that the default entry is "0", which points to the first option in the list above. That is to say your linux distro in normal mode is "0", your linux distro in recovery mode is "1" and so on. Counting from 0, Windows is then option 4 as listed above. Now as a sample, let's edit it so it boots to the Windows OS by default:

1. Open a terminal and type in "sudo gedit /etc/default/grub" (without the quotes). Type in your root password when asked:

2. Edit the entry GRUB_DEFAULT=0, replacing zero with the option you want to boot by default. In our sample way above, Windows is number 4:

3. Save the file and close it.

4. To update /boot/grub/grub.cfg with the new settings, go back to the terminal and enter the command “sudo update-grub” (without the quotes). Type in your root password if asked:

5. Reboot to test.

There you have it. Now if you'd want to go further and tweak the heck out of Grub2, you can go to the following links for very detailed instructions:

Ubuntu Grub2 Community Documentation - https://help.ubuntu.com/community/Grub2
Ubuntu Forums Grub2 Tweaks Thread - http://ubuntuforums.org/showthread.php?t=1287602
Ubuntu Forums Grub2 5 Common Tasks - http://ubuntuforums.org/showthread.php?t=1302743


Copyright © 2011 Tech Throes | Splashy Free Blogger Templates with Background Images, Trucks