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

发布了170 篇原创文章 · 获赞 43 · 访问量 38万+

猜你喜欢

转载自blog.csdn.net/hknaruto/article/details/105166561