Skip to content

Instantly share code, notes, and snippets.

@latusikl
Last active March 9, 2024 00:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save latusikl/a4368f0695c77bad31571b8f91ff6e66 to your computer and use it in GitHub Desktop.
Save latusikl/a4368f0695c77bad31571b8f91ff6e66 to your computer and use it in GitHub Desktop.
How to hide GRUB menu while dual booting?

Hide GRUB menu while dual booting

This solution was tested on Ubuntu 18.04 LTS.

You can still open GRUB menu by pressing shift key while booting. Otherwise it will automatically open choosen system.


To do that you need to make changes in file /etc/default/grub. However after updating GRUB settings the changes won't be visible due to one of scripts which is used to generate final file. That's why you need to make additonal changes. I recomend to backup files in case something went wrong.

Here are the steps you need to do:

  1. Edit grub file:
sudo nano /etc/default/grub

You need to edit these two parameters:

GRUB_TIMEOUT_STYLE=hidden GRUB_TIMEOUT=0

You can choose default system in parameter: GRUB_DEFAULT=0 Where the bolded number corresponds to options sequence in GRUB menu.

  1. You have to edit script 30_os-prober which overwrite these changes while dual booting. The scripts used along with /etc/default/grub while doing update-grub can be found at /etc/grub.d.
sudo nano /etc/grub.d/30_os-prober

Around line 30 in this file in function: adjust_timeout () {
if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then\

You need to comment these line by adding # at the beginning.

#set timeout_style=
#if [ "${timeout}" = 0 ]; then
#set timeout=10
#fi

  1. After doing that you need to generate new grub.cfg file.
sudo update-grub
  1. You can check if these line are commented by checking new generated file grub.cfd
cat /boot/grub/grub.cfg
  1. Now you can reboot your computer and check if changes work.
@rostislaved
Copy link

"You can still open GRUB menu by pressing shift key while booting."
Does this work for you? Not for me by some reason (continuously pressing left shift)

@latusikl
Copy link
Author

Hi,
Unfortunately, currently, I do not have a PC with Linux available, so I cannot check if it still works. As far as I remember, for some PC (I guess the difference here was in BIOS/UEFI), it was the Esc button.
Please let me know if you find something to improve in the gist.

@d-saravanan
Copy link

Hi,
This worked fine with ubuntu os 20.04. I had a grub that showed ubuntu os and windows, not it default loads the ubuntu os

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment