Editing GRUB 2
1.0 IntroductionGRUB 2 is the new standard boot loader on most Linux systems. It replaces the original GRUB boot loader, and is now driven by a vastly different system of configuration. This article will define GRUB and GRUB2, and then discuss two common tasks that are common for most Linux admins/users. Finally, the author's conclusions will be presented.
It is important to note that this article specifies several filesystem locations for GRUB 2 (and other) configurations, past and present. The filesystem locations specified within are representative of those typically found in versions of Ubuntu.
2.1 GRUBGRUB (GRand Unified Bootloader) is a customizable boot loader that comes as the default on many flavors of the Linux operating system. It is run at boot-time, and allows the user to select an operating system to load.
2.2 GRUB 2GRUB 2 refers to any version of GRUB specified as version 1.98 or later. GRUB 2 offers significant changes and improvements over its predecessor, requiring re-training for many Linux administrators.
3.0 Removing old Kernels from the Boot ListThe legacy version GRUB required editing of the /boot/grub/menu.lst file. This is no longer the case, as GRUB 2 is driven by the /boot/grub/grub.cfg file (note that the actual location may vary by Linux distribution). A difference between the two, is that the new grub.cfg file is auto-generated by the "update-grub" command, and therefore is not meant to be edited directly.
However, this makes several tasks much simpler than in GRUB [legacy]. And the task of removing old kernels from the boot list is definitely one of those. In the past, you would edit the menu.lst file directly, and remove the old kernels. Now, GRUB 2 displays all Linux kernels that are present in the /boot directory. To remove those kernels from the list, you can either delete or move them to a different directory. Once you do, don't forget to trigger an update of the grub.cfg file with the following command:
Honestly, I think it's a good idea to keep the last 3 or 4 kernel updates around. I have had times where I have had to "roll back" the kernel to a specific version. Storing them in another location is not a bad idea. However, if you've got kernel versions that you haven't used in a year or so, deleting them won't hurt anything.
4.0 Changing the Boot Loader Splash BackgroundEvery Linux enthusiast appreciates the opportunity to customize their install, and GRUB 2 does not disappoint. However, it is not as straight-forward as it was in legacy GRUB (in my opinion). But GRUB 2 does offer a much higher degree of customization options. To fully-utilize these options, you will need to insall the GRUB 2 splash image package:
The newly-available splash images can be viewed by looking in the /usr/share/images/grub/ directory. To alter GRUB's splash background, start by changing to your /boot/grub.d directory and list the contents:
As you can see, the GRUB 2 configuration is made-up of several files, and you can even add your own later (if you need to). To alter the splash screen, we will need to edit the 05_debian_theme file. Open it up with the following command:
Once inside the 05_debian_theme file, look for the line that reads "WALLPAPER". Here, you can specify the name of your preferred image from the /urs/share/images/grub directory. Note that you can also create your own splash images for use with GRUB 2. See the official GRUB 2 - Community Ubuntu Documentation for more information.
Right below is where you can also specify the text colors for GRUB 2. There are 16 colors available: Black, Blue, Brown, Cyan, Dark-Gray, Green, Light-Cyan, Light-Blue, Light-Green, Light-Gray, Light-Magenta, Light-Red, Magenta, Red, White, and Yellow. The text and highlight colors can be specified in the format of text-color/background-color, as-in:
Note that specifying a background color of "/black" indicates that it is transparent. Once you have completed selecting your background image and GRUB 2 text colors, be sure to force an update of GRUB 2:
This article was intended to provide a quick overview for two common GRUB configuration questions. It is in no way a replacement for the official GRUB 2 documentation, which can be found here.
When comparing GRUB to GRUB 2 in terms of boot loader configuration, it is a significant paradigm shift. While GRUB 2 does add another level of complexity to personalizing certain aspects of your boot loader, overall it is a positive experience and a much cleaner way of doing things than with legacy GRUB.
Contributors to the Ubuntu documentation wiki (2009), Ubuntu Documentation: GRUB 2, retrieved from: http://help.ubuntu.com/community/Grub2
The reference material on this page is made available under the Creative Commons Attribution-ShareAlike 3.0 License.