The generation of startup time for modifying grub in Ubuntu

Time:2021-4-7

The starting time of online query and modification grub is basically to modify / etc / default / grub

#Comment grub out_ HIDDEN_ TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT=0
#Modify grub_ TIMEOUT = 0 
GRUB_TIMEOUT = 0

Then run update grub to regenerate / boot / grub/ grub.cfg But it doesn’t work. It’s still 30 seconds

View / 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 ###

As can be seen from the above configuration, if it is LVM partition, the timeout is 30 seconds; if it is EFI mode, the timeout is 30 seconds. Priority EFI > LVM

Let’s take a look at / etc / grub.d/00 that generated this configuration_ Header script


...
  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
...

You can see that the timeout of 30 seconds is through grub_ RECORDFAIL_ The value of timeout is set

So you just need to use / boot / grub/ grub.cfg Add or modify grub_ RECORDFAIL_ TIMEOUT


GRUB_RECORDFAIL_TIMEOUT=0

Then run sudo update grub to regenerate / boot / grub/ grub.cfg That’s fine

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.