74

I stopped dual booting and I don't want to have to choose the OS any more. I want to boot into Ubuntu 12.04 directly without seeing the GRUB menu.

How can I achieve that?

8
  • If you stopped dual booting, probably you have stopped using the other OS. Why cant you remove the other OS so that ubuntu can boot normally.
    – karthick87
    Mar 8, 2012 at 8:37
  • Duplicate of (either) askubuntu.com/questions/124074/… or askubuntu.com/questions/52963/…
    – david6
    Jun 13, 2012 at 7:57
  • if any of these answers "answered" your question please accept one of them :)
    – blade19899
    Jul 11, 2012 at 16:04
  • @david6: I don't see how either of those are duplicates of this question. I think this is about hiding the grub menu during the timeout.
    – oKtosiTe
    Sep 20, 2012 at 9:36
  • Sorry, the second link was supposed to be: askubuntu.com/questions/66070/… This includes how to: Hide the Grub2 menu, and use the default menu option
    – david6
    Sep 20, 2012 at 9:49

22 Answers 22

45

You can just change grub settings.

type in terminal

sudo -H gedit /etc/default/grub

you need to change this

Change GRUB_HIDDEN_TIMEOUT_QUIET=false to

GRUB_HIDDEN_TIMEOUT_QUIET=true

Save the file and exit

Type sudo update-grub

If you don't get the result you want, see this bug.

5
  • 9
    it is currently changed to True but I still see the grub menu... Mar 9, 2012 at 4:56
  • Im on 12.04 and i tried this but it already said "true" and it still shows up. The only other OS's I have are the failsafe and Memtest - that's it. I've already deleted my Windows Partition and updated grub and the menu still shows. Mar 9, 2012 at 5:11
  • @AlexPoulos look at this link
    – hingev
    Mar 9, 2012 at 14:41
  • 2
    Worked for me by changing the timeout to 0 and then make it quiet. Thanks Mar 14, 2014 at 7:58
  • 2
    Please note that this answer was written in 2012 and does not apply to newer Ubuntu versions unfortunately.
    – Flimm
    Oct 28, 2020 at 11:56
38

I solved this problem by disabling the OS Prober. I did that because in /boot/grub/grub.cfg in the part generated by the template /etc/grub.d/30_os-prober, there was an override of "timeout" to 10 and "style" to menu.

Edit /etc/default/grub and add this line:

GRUB_DISABLE_OS_PROBER=true

Hope you find this useful!

BTW, my full /etc/default/grub is:

GRUB_DEFAULT=0
GRUB_TIMEOUT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DISTRIBUTOR= [...]
GRUB_DISABLE_OS_PROBER=true
GRUB_RECORDFAIL_TIMEOUT=0

Happy coding

6
  • 2
    that worked for me, but it made dissapear al the other boot options but the default one...
    – opensas
    Dec 4, 2014 at 2:01
  • 1
    @opensas If the selection menu isn't displayed, how do you even know what boot options "appear" on it? If you want to disable the menu, why would you want non-default boot options? Feb 23, 2016 at 21:48
  • if you leave out the 'GRUB_TIMEOUT_STYLE=hidden' part, then the countdown is visible, but nothing else, unless you interrupt it. That allows you to get to the menu and change boot settings, even while making it much less obvious. Oct 4, 2016 at 5:45
  • If one wants to be able see the boot menu after holding Shift key, GRUB_TIMEOUT must be set to greater then zero (say, GRUB_TIMEOUT=5). Otherwise, other boot options (say, Windows) can not be activated if needed. Jan 2, 2017 at 21:11
  • On Ubuntu 18.04 LTS, GRUB_RECORDFAIL_TIMEOUT=0 is the only change to /etc/default/grub that eliminates the 30 second timeout (and the GRUB bootloader menu altogether), which seems to be a bug: bugs.launchpad.net/ubuntu/+source/grub2/+bug/1814403/comments/4 . Also, sudo update-grub must be executed for the edits to take effect, which is not mentioned in the Answer. Note that setting this value to 0 is not advised (see above-cited link) unless the machine is a development VM or similar. Oct 10, 2019 at 13:46
12

I tried all those tips they didnt work, ended up reducing the timeout time to zero as follows:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
3
  • run sudo update-grub after changing the values
    – niksmac
    May 27, 2014 at 14:34
  • Same for me. I ran "update-grub" - didn't work. Jan 20, 2016 at 10:51
  • 1
    This is what my /etc/default/grub but I still get a 10 second countdown with the grub menu showing.
    – zorkerz
    Mar 12, 2016 at 14:52
10

You need to edit the file at /etc/default/grub to prevent showing the grub menu.

By default, the entries in that files look like this.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
  • Remove the # mark from second line, and
  • Change the line GRUB_HIDDEN_TIMEOUT_QUIET=false to GRUB_HIDDEN_TIMEOUT_QUIET=true.

After changes, the required portion of the file will look like this


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=""
  • Then run sudo update-grub command in the terminal, and reboot to see the result.
5
  • 3
    I had this configuration but still the grub menu appears.
    – user25165
    Aug 9, 2013 at 7:51
  • 1
    With this setting update-grub returns, 'Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported' and I still get a 10 second countdown while showing the grub menu. Setting GRUB_TIMEOUT to 0 returns the same results also.
    – zorkerz
    Mar 12, 2016 at 14:55
  • @zorkerz which version of ubuntu are you using?
    – Anwar
    Mar 12, 2016 at 17:11
  • Xenial Xerus but had the same behavior on 15.10
    – zorkerz
    Mar 13, 2016 at 17:39
  • Note that this answer was written in 2012 and is out of date.
    – Flimm
    Oct 28, 2020 at 11:58
7

I had the same problem and none of the tips here worked! The only way was to change /boot/grub/grub.cfg manualy. At some point of this file he makes the timeout goes to 10! So, just comment those lines

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

But, you can never do update-grub again, otherwise it will turn back to the same file, and timeout is going to 10 again! Save the file (in vi you will need to force it even if you are su!). Restart the computer and it will work just fine!

4
  • Interesting, why not if [ "${timeout}" = 10 ]; then set timeout=0 fi ? Or simply remove the if statement entirely and just leave set timeout=0?
    – Elder Geek
    Jun 25, 2014 at 3:22
  • This is put there from a template which can be disabled (the OS prober, as mentioned in Agustin's answer). You don't need to manually edit grub.cfg.
    – Neil Traft
    Nov 22, 2014 at 3:49
  • this worked for me in 14.04 May 27, 2016 at 23:56
  • -1. Any answer involving directly editing grub.cfg is just wrong. You must always reinstall grub when updating it, especially when upstream makes breaking changes, or you risk an unbootable system. Jun 26, 2023 at 13:28
4

I've found a simple solution to the problem.

  echo "
  set timeout_style=hidden
  set timeout=2" | sudo tee --append /etc/grub.d/40_custom 

And update grub. It will overwrite timeout settings in grub.cfg, so it doesn't matter what you have in /etc/default/grub. So I have hidden menu that can be invoked by shift for 2 sec.

1
  • This approach worked for me (grub 2.02~beta3-4ubuntu7 installed by Ubuntu 17.10) when none of the other solutions proposed on this page did (it's really bad luck that I tested this last :/). Thanks!
    – pchaigno
    Jul 16, 2018 at 8:33
3

if you want to remove a boot entry just type in:

sudo update-grub

If that doesn't work, install the startup manager, like so:

sudo apt-get install startupmanager


with startup-manager you can

  1. choose with entry to boot in,
  2. choose the resolution and, how long to wait before booting,
  3. you can also choose 0 for automatic booting the default boot-entry
5
  • burg but he is taking about grub Mar 8, 2012 at 8:38
  • sorry typo. it supposed to be sudo update-grub, i edited the answer
    – blade19899
    Mar 8, 2012 at 8:46
  • The only issue with this is that the version of Startup-manager I have doesn't show much options -Imgur Mar 9, 2012 at 4:50
  • 1
    Im on 12.04 and i tried this but it already said "true" and it still shows up. The only other OS's I have are the failsafe and Memtest - that's it. I've already deleted my Windows Partition and updated grub and the menu still shows Mar 9, 2012 at 5:11
  • next to "timeout in seconds" there is a box with the number 10 rename it to number 0
    – blade19899
    Mar 9, 2012 at 10:01
3

Add the following line to /etc/default/grub:

GRUB_FORCE_HIDDEN_MENU="true"
3

for all of you that have word splash in cmd line anything but hardcoding 0 for timeout won't work,,

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=""

Try removing word splash from second last line, update and reboot,, voila, no menu :)

hth, krex

3

Like Agustin, I found that my issue was with the OS Prober. Doing one step better than his solution, I found this gist that will let you have your OSes but still hide the menu. You just need to download those two files, put them into /etc/grub.d, and give them the same permissions as the other templates in that directory.

If you ever want to access your non-default OS, just hold down shift while booting up. That will show the menu.

2
  • that definitely seems like a bug to me. has anybody reported it???
    – opensas
    Dec 4, 2014 at 3:58
  • True... maybe I'll get around to it at some point. No idea if there's one already there.
    – Neil Traft
    Dec 7, 2014 at 10:01
3

Ideally, we could just put

GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0

into /etc/default/grub and be done with it. Unfortunately, at least on Manjaro, the file /etc/grub.d/30_os-prober overrides these settings. We could disable that file, but here's a better solution: create /etc/grub.d/99_quiet with these contents:

#!/bin/sh

cat <<EOF
set timeout_style=hidden
set timeout=0
EOF

(With this file, we don't even need to modify /etc/default/grub at all.) Make it executable and run sudo update-grub (or sudo grub-mkconfig -o /boot/grub/grub.cfg if on Arch).

Reboot and GRUB will not display the menu or introduce any delay during boot. But, you can still get the menu if you hold down Shift after the hardware has turned on but before GRUB has started.

To understand what is happening here we must understand how GRUB configuration works. There is a /boot/grub/grub.cfg file in a special DSL that is read by GRUB during boot. This can be written manually but it is preferred to generate it using update-grub (i.e. grub-mkconfig). That command uses /etc/default/grub and /etc/grub.d to generate the grub.cfg. The /etc/default/grub is sourced first, to set the configuration parameters for update-grub to generate the file. Then, each file in /etc/grub.d that is executable is executed, and its output is concatenated to the end of the grub.cfg.

For some docs, see here, but see also the actual shell scripts in /etc/grub.d and the resulting GRUB configuration /boot/grub/grub.cfg.

3
  • This did not work for me with Debian Bullseye (alpha). Feb 11, 2021 at 6:50
  • @MichaelHerrmann Unfortunately that doesn't surprise me, different distros may have different default config files with different behavior. I think you'll have to investigate more thoroughly using the info in the last two paragraphs of the answer. Maybe you can update it with a note for your distro! Feb 14, 2021 at 17:57
  • That worked for me on Ubuntu Mate 22.04, apart from the Shift part, even if I hold Shift just after boot grub doesn't appear (but TBH I don't bother much, I just wanted it to go away). THANKS!
    – babis21
    May 13, 2022 at 20:51
2

I've been seeing a lot of people saying that the suggested answers don't work for them. I tried several options and this one worked for me:

Edit /etc/grub.d/00_header, and find:

if [ "\${recordfail}" = 1 ]; then
  set timeout=-1

Change it to...

if [ "\${recordfail}" = 1 ]; then
  set timeout=10

And run update-grub.

2

this took me a while but it payed off it was a mix of my own digging and answers above first make sure your /etc/default/grub and /usr/grub/default/grub are the same. then run gksu gedit /etc/grub.d/30_os-prober near the top are the two lines we want but to find them search for styke and change that line to hidden then search for a timeout line it should be like if timeout = 0 set to 10 delete that part from the if to end of file make sure you delete the end of file or your screwed and your grub config should log something like this this is mine just for example:

sets default boot to windows 8.1 pro

GRUB_DEFAULT="Windows 8 (loader) (on /dev/sda1)"

sets a five second window to hit shift so i can boot into Ubuntu

GRUB_HIDDEN_TIMEOUT=5
GRUB_HIDDEN_TIMEOUT_QUIET=true

main fix for error just in case

GRUB_TIMEOUT=0

sets style to hidden

GRUB_TIMEOUT_STYLE=hidden

default Ubuntu stuff

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

For Ubuntu 20.04

Run the following command in terminal. It will create a custom configuration file for grub specifying the boot delay (setting timeout=0 removed the grub screen)

echo "set timeout_style=hidden
set timeout=0" | sudo tee boot/grub/custom.cfg

There is a nice explanation for this here.

1
  • 1
    This one worked for me, on Ubuntu 20.04. Aug 15, 2023 at 15:29
1
  • Configure grub via sudo nano /etc/default/grub
  • Type end of the file:
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=0
  • Save changes CTRL + S
  • Exit CTRL + X
  • Update grub menu sudo update-grub
1

As of ubuntu 22.10 i recommend this:

edit the file /etc/default/grub:

sudo nano /etc/default/grub

Make sure you have this lines:

GRUB_TIMEOUT=0
GRUB_RECORDFAIL_TIMEOUT=0

Save and exit run updater:

sudo update-grub
0

Attempt this at your own risk and only as a last resort!

I tried editing /etc/default/grub and running sudo update-grub with no results.

Ended up editing /boot/grub/grub.cfg by hand, specifically,

...
### END /etc/grub.d/00_header ###

set timeout=0
saved_entry="Ubuntu"
save_env saved_entry

### BEGIN /etc/grub.d/05_debian_theme ###
...
0

If setting GRUB_TIMEOUT= to zero in /etc/default/grub does not work, somewhere in /boot/grub/grub.cfg (the actual grub script) the timeout is getting changed. In the file which causes this, comment that line and run update-grub. This way GRUB_TIMEOUT= applies again and your change will persist resourcing grub.cfg.

How to:
Start off by by trial and error: search for set timeout in /boot/grub/grub.cfg and change the timeout, reboot (do not run update-grub) and check if that changed the grub menu. If not, undo last edit and move to the next.

After you found the miscreant line in grub.cfg you need to look where it came from. Look for the ### BEGIN & ### END (/boot/grub/grub.cfg is generated by update-grub and sources files in /etc/grub.d/). In the vicious file, eg. /etc/grub.d/00_header, comment the corresponding line that sets the timeout and run update-grub.
Now GRUB_TIMEOUT=0 will skip the menu

0

I have a dell XPS plus with Ubuntu 22.04. Bit similar to one of the answers above, none of the top answers worked for me. Following a thread here, I had to change the /etc/grub.d/00_header file. The logic always flows through the efi branch and any other changes in other files does not work. I had to change the timeout value from 30 to 0. Then do a sudo update-grub.

if [ \$grub_platform = efi ]; then
  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
  if [ x\$feature_timeout_style = xy ] ; then
    set timeout_style=menu
  fi
fi
0

I managed to work it here is my grub stuff

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT=0   
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -d -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
GRUB_DISABLE_OS_PROBER=true
GRUB_RECORDFAIL_TIMEOUT=0
GRUB_ENABLE_CRYPTODISK=y
0

Use this command to edit the file sudo -H gedit /etc/default/grub

In my case, my /etc/default/grub file was in this state

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

First of all, I added the line GRUB_HIDDEN_TIMEOUT_QUIET=true to the file. But it was hiding the grub menu but still was taking 10s to start. Then, I changed GRUB_TIMEOUT value to 0 and it worked now.

Finally, the file looks like this:

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

Don't forget to run this command sudo update-grub in the terminal every time you make a change and save it. Otherwise, your changes won't be applied.

-1
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=5
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR="lsb_release -i -s 2> /dev/null || echo Debian"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Set this if you hide grubmenu at boot! hidden-timeout has to be 0-10
# NOT recommend with dual-boot systems
# Type ESC/ENTER at boot to make grub-menu visible again! 
# in this case hidden-timeout has to be 3-10
GRUB_DISABLE_OS_PROBER=true

solves the problem! s.grub2 @ubuntuusers! ;-)

Also it's possible to make grub-menu visible again during booting!

IMPORTANT if you have a crash and want to boot an older (and stable) Kernel!

(Tested with Linux Mint 17.3 Rosa which is based on Ubuntu 14.04)

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .