5

How to change the header title and help message in GRUB menu?

My Grub version is 1.99-21ubuntu3 and I'm using Ubuntu 12.04 LTS.

enter image description here

  • You can try BURG. – Radu Rădeanu Oct 12 '13 at 15:13
  • @RaduRădeanu Thanks i know BURG i do want to edit GRUB – Maythux Oct 12 '13 at 15:20
  • 1
    Try Grub Customizer. – Mitch Oct 12 '13 at 17:40
  • @Mitch: Grub Customizer is not offering such capability – Maythux Oct 14 '13 at 11:18
7

You can try to edit the grub2 source code to modify those strings (Header,Footer etc).


NOTE: I recommend you to do this in a Virtual Machine or in a Test Machine to see is everything is OK. (In this example I'm running Ubuntu 12.04 with grub2 1.99-21ubuntu3.10).


1) Make sure you have enable the Source code repository.

  • Open the Ubuntu Software Center.
  • In the Menu Bar choose Edit -> Software Sources. Click to enable "Source code repository". Just in case I use the "Main Server" to Download.

enter image description here

Open a Terminal window Ctrl+Alt+T and type:

  • sudo apt-get update

2) In the Terminal type the following to install the necessary packages.

  • sudo apt-get install build-essential quilt

3) Install build dependencies.

  • sudo apt-get build-dep grub2

4) Create a folder to download the source code.

  • mkdir ~/Downloads/src

  • cd ~/Downloads/src

5) Download the source code & Export variables.

  • apt-get source grub2

  • export QUILT_PATCHES=debian/patches

  • export EDITOR=gedit

6) Create the patch and edit the source code.

  • cd grub2-1.99

  • quilt new 99_custom-header-footer.patch


Edit the main.c file

  • quilt edit grub-core/normal/main.c

enter image description here

As an example I changed the line 214

From:

  const char *msg = _("GNU GRUB  version %s");

To:

  const char *msg = _("My Custon Grub Title");

Edit the menu_text.c file

  • quilt edit grub-core/normal/menu_text.c

Edit the "Strings" (Pink Color) According to your needs.

enter image description here

Only as an example I changed the lines 159 & 160

From:

  const char *msg = _("Use the %C and %C keys to select which "
          "entry is highlighted.\n");

To:

      const char *msg = _("You can write a text message here according \
to your needs...\n");

And the lines 187 to 189

From:

(_("Press enter to boot the selected OS, "
   "\'e\' to edit the commands before booting "
   "or \'c\' for a command-line.\n"),

To:

        (_("You can put a message here... to press \
a key to boot the OS.\nOr a Help text... etc."),

7) Build the deb packages.

  • quilt refresh
  • fakeroot dpkg-buildpackage

NOTE: This may take awhile.

8) Install the deb packages.

  • cd ..

  • sudo dpkg -i grub-pc*.deb grub2-common*.deb

9) Finally you can Restart your machine to see the changes.

Before:

enter image description here

After:

enter image description here

Hope this helps.

  • thanks im going to try it then il reply you and mark answer if done – Maythux Oct 19 '13 at 6:56
  • How to replace the old grub with the new? – Maythux Oct 19 '13 at 7:36
  • @maythux when you compile, create the deb package & then install with dpkg -i... this new grub should replace the old grub, just restart you machine. – Roman Raguet Oct 19 '13 at 9:12
  • Great man :) you deserve – Maythux Oct 19 '13 at 16:01
0

you can use a .\locales\en.mo file to change the menu heading. One example is here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.