Most of us simply install our favorite distribution, accepting many/most of the defaults, including the boot loader setup, without a second thought. However, there has been a lot of time and effort spent on the bootloader over the years, GRUB taking the place of the venerable LILO. GRUB offers a lot of flexibility in controlling our system during boot, allowing us to have Linux along with (boo) Windows on a nicely partitioned system. Let’s talk about some of the options we have and how to make those changes.
Boot Me Up Scotty!
After our boot loader is installed during the distribution load, we have access to a menu during the boot process that will allow us to boot normally, boot another operating system or boot into some emergency recovery mode (and sometimes a memory test). These are all configured for us during installation automatically. See below for an example of what you may see after an installation and reboot:
As you can see, we have several choices to make during our system start up. This menu was generated from a clean installation with no other operating systems present, however, you could have Windows, OSX, other Linux distributions, Android, etc. installed and configured to boot with a simple choice.
Structure and Layout
Taking a look at the GRUB layout will reveal the following items that we need to know (incidentally, you will find a video course covering all of these items and GRUB in general at our sister site Linux Academy by Pinehead.tv):
- Old GRUB are still located under /boot/grub/, including the menu.lst file that was created during installation and displayed on initial boot
- /boot/grub/grub.cfg – the main configuration file that replaces menu.lst (this file cannot be edited by hand – in fact, don’t try, it will likely cause you more problems than you want)
- /etc/grub.d/ – this directory contains GRUB scripts, the building blocks from which the grub.cfg file is built (when the GRUB command is run, see below)
- /etc/default/grub – this file contains the GRUB menu settings that are read by the GRUB scripts and then used to create grub.cfg. This is where any menu customizations will need to be made.
What You Need To Know
With previous versions of GRUB, we could simply edit the old ‘menu.lst’ file directly and reboot the system. Provided we didn’t make any major mistakes, the new menu entry would show up and the system would boot the appropriate partition when chosen. Now, our configuration is effectively a shell script and looks something like this (in part):
So, what do we do to add a menu entry? We will cover that in part two of our article, or you can view the entire tutorial at our sister site Linux Academy by Pinehead.tv right now. In the meantime, leave me a comment below and let me know if there are any specific customizations you would like to see covered!