How to Remove Grub Timeout

From Linux Delta
Jump to: navigation, search

Overview[edit]

Grub will often pause for a number of seconds at the boot menu to allow for selection of options. If only one distro is installed and there is no need to access the boot options, the Grub timeout can be set to zero to allow for a faster boot.

NOTE: This will make the Grub menu almost inaccessible. Holding "Shift" on boot should allow access to the menu, but this is not well tested. If access to the Grub menu is needed after this, the changes may need to be reverted.

This guide was written for Ubuntu-based distributions of at least version 18.04. Other distros or older versions may have different commands, package names, and file locations.


Directions[edit]

  1. Create a script to modify the Grub config.
    sudo su -c 'install -o root -g root -m 755 <(cat <<'"'"'FILE'"'"'
    #!/bin/sh
    cat <<GTO
    set timeout_style=hidden
    set timeout=0
    if keystatus; then
    if keystatus --shift; then
        set timeout_style=menu
        set timeout=-1
    else
        set timeout_style=hidden
        set timeout=0
    fi
    fi
    GTO
    FILE
    ) /etc/grub.d/50_hidemenu'
  2. Disable the OS prober in the Grub config.
    echo 'GRUB_DISABLE_OS_PROBER=true' | sudo tee -a /etc/default/grub >/dev/null
  3. Apply the script and the changed settings.
    sudo update-grub
  4. On the next reboot, the Grub menu should be skipped with the first option being booted without delay.