How do we show or hide the GRUB boot menu at boot time in Ubuntu operating systems?

botond published 2022. 05. 23., h - 13:05 time

Content

 

Introductory

A GRUB a boot loader that starts the selected operating system when you start your computer. For Ubuntu Linux systems, the GRUB menu will only appear by default if you have more than one operating system installed on your computer, giving the user the option to select the system they want to boot. However, sometimes you may need to display the GRUB menu for an instance of Ubuntu. In this short description, we'll look at how to bring up the GRUB menu for a single Ubuntu system.

This example is Ubuntu 22.04 LTS (Jammy Jellyfish) installation I do, but even earlier versions of Ubuntu can use this method to bring up the boot menu.

 

 

Displays the GRUB menu occasionally

If you only need to display the GRUB menu occasionally, press and hold the following key to launch the GRUB menu when the machine starts:

  • BIOS / MBR on machines with the left SHIFT key
  • UEFI / GPT on machines with ESC key

Of course, this will only bring up the GNU GRUB menu once, and will be hidden again the next time you boot it. If you want to display the boot menu permanently, you need to set it up.

 

Permanent display of the GRUB menu

If you want to permanently display the GRUB boot menu, you need to configure it in the GRUB settings.

Setting up GRUB

Let's open it rootas a / Etc / default / grub file:

nano /etc/default/grub

Ubuntu 22.04 LTS (Jammy Jellyfish) Grub Settings

So by default, this file contains:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

 

 

Here we need to change two lines to the following:

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=45

A GRUB_TIMEOUT you can specify anything in seconds as a variable, the countdown will start if you do not reach the menu, in which case you will select the default option after the specified time.

If you have set the correct values, save the file.

Update GRUB

If you have modified the GRUB configuration file, update GRUB with update-grub also as root:

update-grub

Ubuntu 22.04 LTS (Jammy Jellyfish) Grub Update

Then restart the computer. This up to the reboot or the shutdown You can also do this with commands, but also with the restart function of the interface.

Restart the computer

If update-grub has run, restart your computer. Then, at boot time, the GRUB boot menu will appear with the timing we set:

The GRUB boot menu appears after completing the settings and restarting the computer

Shows the timer in the bottom row of the screen. If you reach with the arrow keys, the timer stops.

 

 

Conclusion

Displaying GRUB is a very simple setting on Ubuntu systems that can be reset to the "factory" default at any time, so you can remove it. If you have a problem with your computer, you can use this menu to find the recovery methods and start your computer with the previous kernel files on your computer.