sometimes a cigar is just a cigar
Header image

Grub2 Configurations

Posted by ALonon in Linux

Q: How to delete old version of kernels in grub2 menu ?

A: Delete them from /boot directory. Both initrd and vmlinuz files. Than run update-grub.

Q: How to hide recovery mode in grub2 menu ?

A: Change this line #GRUB_DISABLE_LINUX_RECOVERY=”true” as GRUB_DISABLE_LINUX_RECOVERY=”true” (delete command character.) in /etc/default/boot. Than run update-grub.

Q: How to disable memtest in grub2 menu ?

cd /etc/grub.d

sudo chmod -x 20_memtest86+

update grub

Some other changes in grub menu. In /etc/grub.d there are 6 executable files. These are

  • 00_header Sets initial appearance items such as the graphics mode, default selection, timeout, etc. These settings are normally imported from information from /etc/default/grub. Users normally do not need to make changes to this file.
  • 05_debian_theme The settings in this file set splash image, text colors, selection highlighting and themes. In the absence of a splash image, this file sets a monochromatic theme for the initial menu display. How to set font renderings and splash images are discussed in detail in the Splash Images and Themes section.
  • 10_hurd Locates Hurd kernels. Not currently used.
  • 10_linux Locates kernels on the root device for the operating system currently in use. It takes this information and establishes the names displayed on the menu for these kernels. Thanks to the code in 10_linux, it is not necessary (or even possible) to explicitly contruct the list of kernel names displayed on the menu. Note: If you don’t want all your old kernels to appear in the menu list, remove their files from /boot.
  • 20_memtest86+ Searches for /boot/memtest86+.bin and includes it as an option on the GRUB 2 boot menu. There is currently no line option to remove this entry from the menu. The display of memtest86+ can be inhibited by removing the executable bit from this file: sudo chmod -x /etc/grub.d/20_memtest86+ and then running sudo update-grub.
  • 30_os-prober This file uses os-prober, which searches for Linux and other operating systems. Results are placed in grub.cfg based on the scripts in this file. The file is divided into 4 sections, representing the types of operating systems handled by the scripts: Windows, Linux, OSX, and Hurd. Variables in this file determine the format of the displayed names in /boot/grub/grub.cfg and on the GRUB 2 menu. Users familiar with basic scripting can alter these variables to change the format of the displayed menu entries. Alternatively, the user can insert an entry into /etc/default/grub which disables this script. (See below)
  • 40_custom A template for adding custom menu entries which will be inserted into grub.cfg upon execution of the update-grub command. The contents of this file, below the “exec tail -n +3 $0” line and the default comments, are imported directly into /boot/grub/grub.cfg without any changes.

By setting executables bits of these file “0″,  you can disable function of file for grub menu. Forexample, if you want to disable memtest in grub2 menu, just set “0″ to executable bit of 20_memtest86. sudo chmod -x 20_memtest86+ than update-grub. To make it enable set “1″ sudo chmod +x 20_memtest86+ and update-grub.


You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>