ubuntu shows or hides the grub selection menu

Keywords: Ubuntu sudo Linux Windows

ubuntu 12.04.

The ubuntu dual system installed after installing windows always shows the grub selection menu at startup time. You can select different versions of ubuntu kernel s to start

However, for a simple ubuntu system, the corresponding menu is not displayed for selection after boot-up.

Referring to the information searched on the web, you can display the grub menu in the following ways (you can also trust to know how to hide the sprinkler after reading it??):

  1. Keep the shift key pressed at startup
    Previous Ubuntu versions, when you started grub, had a prompt for grub loading, press ESC to get the menu, so press ESC to see the grub interface
    Now that Ubuntu is gone, it is now possible to see the grub interface by holding down the shift key at startup.
    (Next, modify the startup parameters, add single, then press ctrl+x to start, you will see an ncurse interface, select drop to root prompt, you will get a root terminal and you can reset the root password)

  2. Modify the grub file to complete

1.sudo gedit /etc/default/grub
//Modify as follows:
GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0

2.sudo update-grub

Expand the instructions below:

Modify the / etc/default/grub.cfg file first, and comment out GRUB_HIDDEN_TIMEOUT=0 by referring to the following config file

# 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_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10 
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"

Then execute "sudo update-grub".This adds the following code to grub.cfg in the future

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=-1
    else
      set timeout=0
    fi 
  else
    if sleep --interruptible 3 ; then
      set timeout=0
    fi 
  fi 
fi
### END /etc/grub.d/30_os-prober ###

Finally, a brief description of some of the parameters below

1.GRUB_HIDDEN_TIMEOUT=0
                This configuration will affect menu display.Setting this option will hide the menu and display the guide screen during this time.
                Menus will be hidden unless a # symbol is added at the beginning of the line.(# GRUB_HIDDEN_TIMEOUT=0).
                GRUB 2 will look for other operating systems the first time it executes.If no other operating system is detected, the menu will be configured to be hidden.If other operating systems are identified, the menu will be displayed.
                If it is an integer greater than 0, the system will pause for the number of seconds it is configured for, but the menu will not be displayed.
                0 menus will not be displayed and there will be no delay.
                The user can hold down the SHIFT key at startup to force the menu to display.
                During startup, the system checks the SHIFT key status.If the key state cannot be identified, there will be a short delay for the user to display the menu by pressing the ESC key.

2.GRUB_HIDDEN_TIMEOUT_QUIET=true
                 true does not display a countdown.The screen will be blank.
                 The time false configures in GRUB_HIDDEN_TIMEOUT, and there is a countdown timer on the blank screen.

3.GRUB_TIMEOUT=10
                  This command will obey the GRUB_HIDDEN_TIMEOUT configuration unless GRUB_HIDDEN_TIMEOUT is commented out (#).If GRUB_HIDDEN_TIMEOUT is enabled, GRUB_TIMEOUT will only execute once when the menu is displayed.
                  Configuring this value to -1 will cause the menu to be displayed until the user chooses it.
                  The GRUB 2 menu is hidden by default unless other operating systems are detected by the system.If there is no other operating system, this line will be commented out unless the user modifies it.To display the menu at each startup, uncomment this line and use a value of 1 or greater.

Ref:
http://www.cnblogs.com/super119/archive/2011/03/11/1981596.html
http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=375600
http://wiki.ubuntu-tw.org/?title=GRUB_2_Chinese Guide

Posted by sgoku01 on Sun, 21 Jul 2019 18:23:08 -0700