6

I tried all the methods that comes in google search for "hide the grub menu on computer start", but still no luck, I guess things work differently on Ubuntu 15.04 ?

this is my grub

 # 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=0
 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
 GRUB_CMDLINE_LINUX_DEFAULT="libahci.ignore_sss=1 vesafb.invalid=1 quite nopat drm.debug=0xe"
 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"
 GRUB_GFXPAYLOAD_LINUX=text

grub.cfg file:

 #
 # DO NOT EDIT THIS FILE
 #
 # It is automatically generated by grub-mkconfig using templates
 # from /etc/grub.d and settings from /etc/default/grub
 #

 ### BEGIN /etc/grub.d/00_header ###
 if [ -s $prefix/grubenv ]; then
 set have_grubenv=true
 load_env
 fi
 if [ "${next_entry}" ] ; then
 set default="${next_entry}"
 set next_entry=
 save_env next_entry
 set boot_once=true
 else
 set default="0"
 fi

 if [ x"${feature_menuentry_id}" = xy ]; then
 menuentry_id_option="--id"
 else
 menuentry_id_option=""
 fi

 export menuentry_id_option

 if [ "${prev_saved_entry}" ]; then
 set saved_entry="${prev_saved_entry}"
 save_env saved_entry
 set prev_saved_entry=
 save_env prev_saved_entry
 set boot_once=true
 fi

 function savedefault {
 if [ -z "${boot_once}" ]; then
 saved_entry="${chosen}"
 save_env saved_entry
 fi
 }
 function recordfail {
 set recordfail=1
 if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
 }
 function load_video {
 if [ x$feature_all_video_module = xy ]; then
 insmod all_video
 else
 insmod efi_gop
 insmod efi_uga
 insmod ieee1275_fb
 insmod vbe
 insmod vga
 insmod video_bochs
 insmod video_cirrus
 fi
 }

 if [ x$feature_default_font_path = xy ] ; then
 font=unicode
 else
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt2'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 3b12612a-44e7-448e-b6a1-692930065384
 else
 search --no-floppy --fs-uuid --set=root 3b12612a-44e7-448e-b6a1-692930065384
 fi
 font="/usr/share/grub/unicode.pf2"
 fi

 if loadfont $font ; then
 set gfxmode=auto
 load_video
 insmod gfxterm
 set locale_dir=$prefix/locale
 set lang=en_US
 insmod gettext
 fi
 terminal_output gfxterm
 if [ "${recordfail}" = 1 ] ; then
 set timeout=-1
 else
 if [ x$feature_timeout_style = xy ] ; then
 set timeout_style=hidden
 set timeout=0
 # Fallback hidden-timeout code in case the timeout_style feature is
 # unavailable.
 elif sleep --interruptible 0 ; then
 set timeout=0
 fi
 fi
 ### END /etc/grub.d/00_header ###

 ### BEGIN /etc/grub.d/05_debian_theme ###
 set menu_color_normal=white/black
 set menu_color_highlight=black/light-gray
 if background_color 44,0,30,0; then
 clear
 fi
 ### END /etc/grub.d/05_debian_theme ###

 ### BEGIN /etc/grub.d/10_linux ###
 function gfxmode {
 set gfxpayload="${1}"
 if [ "${1}" = "keep" ]; then
 set vt_handoff=vt.handoff=7
 else
 set vt_handoff=
 fi
 }
 set linux_gfx_mode=text
 export linux_gfx_mode
 menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3b12612a-44e7-448e-b6a1-692930065384' {
 recordfail
 gfxmode $linux_gfx_mode
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt2'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 3b12612a-44e7-448e-b6a1-692930065384
 else
 search --no-floppy --fs-uuid --set=root 3b12612a-44e7-448e-b6a1-692930065384
 fi
 linux /boot/vmlinuz-3.19.0-15-generic root=UUID=3b12612a-44e7-448e-b6a1-692930065384 ro nopat plymouth:debug=1 vesafb.invalid=1 quite=1 libahci.ignore_sss=1
 initrd /boot/initrd.img-3.19.0-15-generic
 }
 submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-3b12612a-44e7-448e-b6a1-692930065384' {
 menuentry 'Ubuntu, with Linux 3.19.0-15-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-15-generic-advanced-3b12612a-44e7-448e-b6a1-692930065384' {
 recordfail
 gfxmode $linux_gfx_mode
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt2'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 3b12612a-44e7-448e-b6a1-692930065384
 else
 search --no-floppy --fs-uuid --set=root 3b12612a-44e7-448e-b6a1-692930065384
 fi
 echo 'Loading Linux 3.19.0-15-generic ...'
 linux /boot/vmlinuz-3.19.0-15-generic root=UUID=3b12612a-44e7-448e-b6a1-692930065384 ro nopat plymouth:debug=1 vesafb.invalid=1 quite=1 libahci.ignore_sss=1
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-3.19.0-15-generic
 }
 menuentry 'Ubuntu, with Linux 3.19.0-15-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-15-generic-init-upstart-3b12612a-44e7-448e-b6a1-692930065384' {
 recordfail
 gfxmode $linux_gfx_mode
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt2'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 3b12612a-44e7-448e-b6a1-692930065384
 else
 search --no-floppy --fs-uuid --set=root 3b12612a-44e7-448e-b6a1-692930065384
 fi
 echo 'Loading Linux 3.19.0-15-generic ...'
 linux /boot/vmlinuz-3.19.0-15-generic root=UUID=3b12612a-44e7-448e-b6a1-692930065384 ro nopat plymouth:debug=1 vesafb.invalid=1 quite=1 libahci.ignore_sss=1 init=/sbin/upstart
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-3.19.0-15-generic
 }
 menuentry 'Ubuntu, with Linux 3.19.0-15-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-15-generic-recovery-3b12612a-44e7-448e-b6a1-692930065384' {
 recordfail
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt2'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 3b12612a-44e7-448e-b6a1-692930065384
 else
 search --no-floppy --fs-uuid --set=root 3b12612a-44e7-448e-b6a1-692930065384
 fi
 echo 'Loading Linux 3.19.0-15-generic ...'
 linux /boot/vmlinuz-3.19.0-15-generic root=UUID=3b12612a-44e7-448e-b6a1-692930065384 ro recovery nomodeset
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-3.19.0-15-generic
 }
 }

 ### END /etc/grub.d/10_linux ###

 ### BEGIN /etc/grub.d/20_linux_xen ###

 ### END /etc/grub.d/20_linux_xen ###

 ### BEGIN /etc/grub.d/25_custom ###

 menuentry "Windows UEFI bootmgfw.efi" {
 search --fs-uuid --no-floppy --set=root 8D03-9A18
 chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
 }

 menuentry "EFI/ubuntu/MokManager.efi" {
 search --fs-uuid --no-floppy --set=root 8D03-9A18
 chainloader (${root})/EFI/ubuntu/MokManager.efi
 }
 ### END /etc/grub.d/25_custom ###

 ### BEGIN /etc/grub.d/30_os-prober ###
 menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-8D03-9A18' {
 insmod part_gpt
 insmod fat
 set root='hd0,gpt1'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 8D03-9A18
 else
 search --no-floppy --fs-uuid --set=root 8D03-9A18
 fi
 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
 }
 menuentry 'Antergos Linux (2015.04-ISO-Rolling) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-b61cdeef-aa4b-464e-a0ec-fcc2417926f4' {
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt7'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7 b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 else
 search --no-floppy --fs-uuid --set=root b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 fi
 linux /boot/vmlinuz-linux root=UUID=b61cdeef-aa4b-464e-a0ec-fcc2417926f4 rw resume=UUID=f41d0df1-3da5-443c-9346-d66e03164c6a quiet
 initrd /boot/initramfs-linux.img
 }
 submenu 'Advanced options for Antergos Linux (2015.04-ISO-Rolling) (on /dev/sda7)' $menuentry_id_option 'osprober-gnulinux-advanced-b61cdeef-aa4b-464e-a0ec-fcc2417926f4' {
 menuentry 'Antergos Linux (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--b61cdeef-aa4b-464e-a0ec-fcc2417926f4' {
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt7'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7 b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 else
 search --no-floppy --fs-uuid --set=root b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 fi
 linux /boot/vmlinuz-linux root=UUID=b61cdeef-aa4b-464e-a0ec-fcc2417926f4 rw resume=UUID=f41d0df1-3da5-443c-9346-d66e03164c6a quiet
 initrd /boot/initramfs-linux.img
 }
 menuentry 'Antergos Linux - Fallback (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--b61cdeef-aa4b-464e-a0ec-fcc2417926f4' {
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt7'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7 b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 else
 search --no-floppy --fs-uuid --set=root b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 fi
 linux /boot/vmlinuz-linux root=UUID=b61cdeef-aa4b-464e-a0ec-fcc2417926f4 rw resume=UUID=f41d0df1-3da5-443c-9346-d66e03164c6a quiet
 initrd /boot/initramfs-linux-fallback.img
 }
 menuentry 'Antergos Linux (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--b61cdeef-aa4b-464e-a0ec-fcc2417926f4' {
 insmod part_gpt
 insmod xfs
 set root='hd0,gpt7'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7 b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 else
 search --no-floppy --fs-uuid --set=root b61cdeef-aa4b-464e-a0ec-fcc2417926f4
 fi
 linux /boot/vmlinuz-linux root=UUID=b61cdeef-aa4b-464e-a0ec-fcc2417926f4 rw resume=UUID=f41d0df1-3da5-443c-9346-d66e03164c6a quiet
 initrd /boot/initramfs-linux-fallback.img
 }
 }

 set timeout_style=menu
 if [ "${timeout}" = 0 ]; then
 set timeout=10
 fi
 ### END /etc/grub.d/30_os-prober ###

 ### BEGIN /etc/grub.d/30_uefi-firmware ###
 menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
 fwsetup
 }
 ### END /etc/grub.d/30_uefi-firmware ###

 ### BEGIN /etc/grub.d/40_custom ###
 # This file provides an easy way to add custom menu entries. Simply type the
 # menu entries you want to add after this comment. Be careful not to change
 # the 'exec tail' line above.
 ### END /etc/grub.d/40_custom ###

 ### BEGIN /etc/grub.d/41_custom ###
 if [ -f ${config_directory}/custom.cfg ]; then
 source ${config_directory}/custom.cfg
 elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
 source $prefix/custom.cfg;
 fi
 ### END /etc/grub.d/41_custom ###

what to do on ubuntu 15.04 to boot straight away without showing boot menu?
few more details: I did ran sudo update-grub after making changes to grub file. My BIOS is UEFI

UPDATE: I triple boot Ubuntu (default, since I use it 90% of time), arch linux, windows( for games occasionally). so I select Ubuntu most of the time i want to boot directly to it, but occasionally if i want to boot to other OS, i would like to "press shift key and see the grub and select the desired OS", thats why I want to hide grub

UPDATE2: when i set grub timeout to 0 it becomes 10sec on boot, dont know why...

Alex Jones
  • 7,982
  • 9
  • 55
  • 94
  • you said you have UEFI. Did you try disabling safe boot there ? – Sergiy Kolodyazhnyy May 06 '15 at 19:02
  • @Serg You mean secure boot? I already have disabled it. – Alex Jones May 06 '15 at 19:10
  • i don't know what is going on. Let me ask you @edwardtorvalds these questions, 1-why do you want to hide the grub menu? 2-What are you gona do when you want to choose another OS? 3-If it happened and the grub menu is gone How are you going to bring it back when needed? 4-what will be the default OS chosen if the grub is gone? – Black Block May 09 '15 at 03:39
  • @BlackBlock I triple boot Ubuntu (default, since I use it 90% of time), arch linux, windows( for games occasionally). so I select Ubuntu most of the time i want to boot directly to it, but occasionally if i want to boot to other OS, i would like to "press shift key and see the grub and select the desired OS", thats why I want to hide grub – Alex Jones May 09 '15 at 04:00

8 Answers8

8

In /etc/default/grub set:

GRUB_HIDDEN_TIMEOUT="1"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
#GRUB_TIMEOUT="1"

That will allow you to have a very short time interval of 1 second to still press Shift while booting to get the advanced menu, while not running into the 10-second problem in

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

in /boot/grub/grub.cfg.

(Meaning, "0" is allowed, but just gets set to "10" in a deeper level of the config to protect users from themselves)

Fabby
  • 34,259
1

I have solved the "grub not hiding at boot" problem in Ubuntu 18.04 LTS only by installing the Boot Repair software.

Before that, I have tried plenty of suggestions found on google by typing: "how to hide grub in Ubuntu 18.04 at boot".


Note: To install the mentioned software, first add the PPA in terminal:

$ sudo add-apt-repository ppa:yannubuntu/boot-repair

$ sudo apt update

Then, install Boot Repair software:

$ sudo apt install boot-repair

Once installed and opened (by typing: "$ boot-repair"), the "Recommended repair (repairs most frequent problems)" button made the grub hide at boot for my case.

Source: https://linuxconfig.org/ubuntu-boot-repair

1

Did you try to replace

...
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
...

with

...
GRUB_TIMEOUT_STYLE='hidden'
...

?

According to the docu (`info -f grub -n 'Simple configuration') the first is deprecated and one should use the ''less confusing'' style option.

aba
  • 311
  • 3
  • 6
0

I just dealt with this and found that setting

GRUB_TIMEOUT_STYLE=countdown

or

GRUB_TIMEOUT_STYLE=hidden

in /etc/defaults/grub caused a countdown to be displayed our a blank screen to be displayed for the duration of the timeout.

See the following link for more information

0

Edit the config file.

gksudo gedit /etc/default/grub

When the file opens, remove “#” before “GRUB_HIDDEN_TIMEOUT=0″ and set “GRUB_HIDDEN_TIMEOUT_QUIET=true”. So it looks like:

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

Save the file and apply the changes by running below command:

sudo update-grub

For your case i assume you haven't do update-grub

Maythux
  • 84,289
0

Open /etc/default/grub in your favorite text editor (I'm using nano here):

sudo nano /etc/default/grub

Find the line that says:

GRUB_TIMEOUT=<some number here, eg: 10>

and change it to:

GRUB_TIMEOUT=1

This will show the menu, but for just a second and after that it will boot the default entry. If it is set to 0, still you will see it for 10 seconds as a security measure. So put 1 there.

Save and exit. Run sudo update-grub

Another suggestion: Add the following line in your /etc/default/grub file:

GRUB_DISABLE_OS_PROBER="true"

After the line:

GRUB_CMDLINE_LINUX=”"

Note This will deactivate os-prober (so other OSs will not be listed)

If you want other OSs to be shown, remove the line GRUB_DISABLE_OS_PROBER="true" from /etc/default/grub (if you followed the above suggestion and added the line) and put the following code in /etc/grub.d/00_header:

### BEGIN Hidden Menu Test ###
cat << EOF
if [ ${timeout} != -1 ]; then
if sleep --verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
set timeout=${GRUB_HIDDEN_TIMEOUT}
fi
fi
EOF
### END Hidden Menu Test ###

Save and exit. Run sudo update-grub

You can now plug-in different values as you like in GRUB_HIDDEN_TIMEOUT in /etc/default/grub to set the time for which you want the menu to be hidden. This 'fix' is discussed in more detail here.

Ron
  • 20,638
  • alright this worked, but arch linux and windows are not listed in grub, sometimes i may want to boot into these two but now i cant. – Alex Jones May 06 '15 at 18:58
  • Yeah, that's the downside. I've updated by answer to include a 'fix' and its reference link. Try it. – Ron May 06 '15 at 19:42
  • it already had some code in it already, do i have to put at the end? – Alex Jones May 06 '15 at 23:22
  • yes, I suppose so, although I have not tried this. Seems to be some bug in some grub versions. – Ron May 07 '15 at 03:44
  • I tried your method, but unluckily i am getting to see grub with time out of 10sec, even if GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_TIMEOUT=0 – Alex Jones May 09 '15 at 20:30
0

Have you tried this solution (works for me from 13.10 to 15.04)?

GRUB_HIDDEN_TIMEOUT=0.0
GRUB_TIMEOUT=0.0

Perhaps you've tried it, but rather to ask.

aleskva
  • 1,647
  • 3
  • 13
  • 22
0

You can try running a few commands after changing GRUB_TIMEOUT (at grub defaults file) to 0:

sudo update-initramfs -u
sudo update-grub
sudo update-grub2
Eduardo Cola
  • 5,817