ubuntu中修改grub的启动时间生成
时间:2021-02-25 10:40:14|栏目:Linux|点击: 次
网上查询修改grub的启动时间基本上是修改 /etc/default/grub
#注释掉GRUB_HIDDEN_TIMEOUT=0 #GRUB_HIDDEN_TIMEOUT=0 #修改GRUB_TIMEOUT = 0 GRUB_TIMEOUT = 0
然后运行update-grub重新生成/boot/grub/grub.cfg.然而这并不管用,依旧要等待30秒
查看/boot/grub/grub.cfg
### BEGIN /etc/grub.d/00_header ###
...
function recordfail {
set recordfail=1
# GRUB lacks write support for lvm, so recordfail support is disabled.
}
...
if [ "${recordfail}" = 1 ] ; then
set timeout=30
...
if [ $grub_platform = efi ]; then
set timeout=30
...
### END /etc/grub.d/00_header ###
从上面的配置可以看到,如果是lvm分区,则超时时间为30秒;如果是EFI方式启动的超时时间为30秒.优先级EFI > LVM.
再看下生成这段配置的/etc/grub.d/00_header脚本
...
cat << EOF
if [ "\${recordfail}" = 1 ] ; then
set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
else
EOF
...
if [ "$recordfail_broken" = 1 ]; then
cat << EOF
if [ \$grub_platform = efi ]; then
set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
if [ x\$feature_timeout_style = xy ] ; then
set timeout_style=menu
fi
...
可以看到这超时30秒是通过GRUB_RECORDFAIL_TIMEOUT这个值设置的.
所以只需要在 /boot/grub/grub.cfg 加上或修改 GRUB_RECORDFAIL_TIMEOUT
GRUB_RECORDFAIL_TIMEOUT=0
然后运行sudo update-grub重新生成/boot/grub/grub.cfg即可.
上一篇:Linux环境下的高级隐藏技术
栏 目:Linux
下一篇:浅谈linux下的串口通讯开发
本文标题:ubuntu中修改grub的启动时间生成
本文地址:http://www.codeinn.net/misctech/69956.html






