EDIT: (for clarity) I'm looking to change the appearance of the grub boot menu, by editing the configuration files (possibly but not necessarily grub.cfg).

So, any ubuntu user knows how filled up the boot menu gets after a few kernel upgrades. Back in the days of menu.lst, you could tweak the menu to hide unwanted options but still keep them available.

For instance, if your grub menu looked like this:


You could make options C and D invisible by inserting an empty option between B and C. This way, options C and D wouldn't be visible during boot up, but would become visible if you scrolled down to them in the boot menu.

Trying this same trick in grub.cfg led to no result whatsoever. So, I'm looking for a way to achieve this same result with the new grub menu, by editing the grub.cfg file. Other aesthetic tweaks are also welcome.


EDIT2: If hiding menu entries is not possible, I'd like a way to insert a separator between them, so the menu would look like this:



  • do you want to make all changes to grub.cfg ? if you're running update-grub to auto-generate it you probably want to edit the scripts under /etc/grub.d; see superuser.com/questions/102692/… for a brief overview. – quack quixote Feb 20 '10 at 19:05
  • @~quack: that helps a bit, and is pretty informative. I'm still hoping for a way to hide menu entries, or at least put a separator between them. – Malabarba Feb 20 '10 at 19:40
  • So, I guess just uninstalling the old kernels is not an option? – Bobby Aug 27 '10 at 8:21

First, understand how Ubuntu configures Grub2.

  • /boot/grub/grub.cfg is the Grub2 menu
  • the update-grub command auto-generates that file
  • ...by reading default settings from /etc/defaults/grub
  • ...and running shellscripts in /etc/grub.d

So, if you don't want to edit grub.cfg after each kernel update, you want to tweak the scripts in /etc/grub.d so your changes get applied anytime update-grub is run.

Second, to answer your first question directly, I'm not familiar with any means of making specific boot options invisible but still accessible through the Grub menu. There are a lot of little things about Grub1 that didn't get reimplemented in Grub2, and it wouldn't surprise me if this was one of them.

Instead, you could make all the menu entries invisible (until highlighted) by setting the menu font color to the same as the background color. In /etc/grub.d/05_debian_theme, change menu_color_normal so that the first color (font) matches the second color (background). Leave menu_color_highlight different, so the entry under the cursor shows up.

# example from a likely-tweaked Karmic /etc/grub.d/05_debian_theme
set menu_color_normal=white/black
set menu_color_highlight=black/white

# ...to this
set menu_color_normal=black/black
set menu_color_highlight=black/white

Getting a separator into the Grub menu.

In Grub1 you'd insert a new entry like this. As I recall, you needed the root declaration to make it a valid menu entry, otherwise Grub1 ignored it.

# separator
title  --------------------

I suspect Grub2 might be similar. A very basic menu entry looks like this in grub.cfg:

# basic example
menuentry "Memory test (memtest86)" {
        linux   /boot/memtest86+.bin

Since "anything" in the double-quotes gets displayed as the title, you could fake a separator with that. Like Grub1, Grub2 wants the linux keyword to treat it as a real menu entry, so be careful you don't accidentally select it.

# a separator!  no, really!
menuentry "....." {
        linux   /boot/memtest86+.bin

Unfortunately, "anything" doesn't mean anything; while I was testing this I tried a long string of dashes ("----------------") and it never worked. But it likes the short string of dots shown above, so you can use that.


Now, that's how to make one separator. To make a bunch, and to place them where you want them automatically, you need to add them into the scripts in /etc/grub.d.

For this example, let's put a simple separator between the various sections of grub.cfg. If you look at /etc/grub.d, you see the following scripts:

  • 00_header
  • 05_debian_theme
  • 10_linux - entries for Ubuntu kernels & recovery
  • 20_memtest86+ - entry for Memtest86+
  • 30_os-prober - entries for Windows & other Linux distros
  • 40_custom - nothing by default; special user entries can go here

We'll create a new script, separator, and place the following into it:

# create a separator menu entry
cat << EOF
menuentry "....." {
  linux /boot/memtest86+.bin

Now, move that script into place for the first separator, and link it into place for the others. The scripts are executed in order, so if you want the first one to come before 10_linux, name it 09_separator or something.

cd /etc/grub.d

# start the editor, paste in the script above, save, and exit
sudo nano separator

# set executable
sudo chmod +x separator

# rename into the first position
mv separator 09_separator

# link into remaining positions (can also use cp)
ln -s 09_separator 19_separator
ln -s 09_separator 29_separator
# not really necessary since 40_custom is empty by default
ln -s 09_separator 39_separator

If you have a specific entry set as default in /etc/default/grub, you might need to update it -- Grub2 starts counting menu entries at 0, and each of these "separators" is a valid entry, so they count too. If your previous default entry was 0, and you've added one separator before it, remember to change GRUB_DEFAULT to 1

Now run update-grub, and examine /boot/grub/grub.cfg -- you should see the separators in there. If you do, reboot and check 'em out.


If you want to place separators elsewhere, say, between different kernel versions, you'll need to edit 10_linux (or another script) directly, and find the appropriate place to add the separator. You can use the lines from the script above; include everything except the first #!/bin/sh line.

If you want something prettier, use Grub splash images or themes. I need to give you a raincheck on those topics, but check the resources below.


There are two big Grub2 guides on UbuntuForums that I've come to know and love:

GNU Grub 2 is another great resource. He's got a set of scripts for tweaking Karmic's Grub2 (full disclosure: I haven't tried them).

Grub Wiki's Theme Format page is a must for hacking on Grub2 themes.

  • Wow, thanks for the answer. Shame to see some features haven't made it to this version. I had already tried inserting a separator, it didn't work because I left it blank between the brackets. Everything above seems to be working. Thanks again. – Malabarba Feb 20 '10 at 23:11
  • @D Connors - yeah, there's been a couple of things i miss about Grub1, but overall i think Grub2's an improvement. it does have its own learning curve. i expect the devs have put more effort into Grub2's graphical abilities at the expense of the text menu, but maybe that'll change as the project develops. – quack quixote Feb 20 '10 at 23:38

Separator may be made of dashes if its first character is space. Also, it isn't necessary to use linux command for separator section, you may use any command like this:

menuentry " -----------------------------------------------------------" {
  echo "It is just a separator, select another item!"

Or even "true" to return silently:

menuentry " -----------------------------------------------------------" {

If you don't use the other kernels, you can just remove them using whichever package manager interface suits you. This automatically removes them from grub.cfg

  • I do rarely use them for troubleshooting, when I happen to screw up the current installation. Plus, the kernels were just an example, I also have 3 other bootable partitions that I would like to hide but still have them available. – Malabarba Feb 20 '10 at 21:11
  • (to avoid confusion. When I said "hide" I didn't mean "hide the partition", I only meant "hide the respetive OS entry from the boot menu") – Malabarba Feb 20 '10 at 21:13

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.