Fedora31 grub2 how to hide or display boot menu

fu.k the pinyin input!!!

1. how to hide

swith to super user

[yeqiang@localhost ~]$ sudo su
[sudo] password for yeqiang: 
[root@localhost yeqiang]# 

set GRUB_TIMEOUT=0 in etc/default/grub

[root@localhost yeqiang]# vim /etc/default/grub 

full content like this:

GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
~                        

then remake grub.cfg file

[root@localhost grub2]# grub2-mkconfig -o grub.cfg
Generating grub configuration file ...
Found Windows 7 on /dev/sdb1
done
[root@localhost grub2]# 

reboot the machine, you will find that system will boot first OS with out display grub boot menu.

 

2. how to restore grub boot menu

set GRUB_TIMEOUT=5 in etc/default/grub

GRUB_TIMEOUT=05
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
~                        

then remake grub.cfg file

[root@localhost grub2]# grub2-mkconfig -o grub.cfg
Generating grub configuration file ...
Found Windows 7 on /dev/sdb1
done
[root@localhost grub2]# 

finally reboot

system will display grub boot menu on reboot

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章