Modify the startup time generation of grub in ubuntu
- 2021-07-09 09:38:35
- OfStack
The starting time of online query modification of grub is basically modification/etc/default/grub
# Comment out GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT=0
# Modify GRUB_TIMEOUT = 0
GRUB_TIMEOUT = 0
Then run update-grub Regeneration/boot/grub/grub. cfg. However, this doesn't work, and you still have to wait 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 an lvm partition, the timeout time is 30 seconds; The timeout time is 30 seconds if it is started in EFI mode. Priority EFI > LVM.
Look again at the /etc/grub. d/00_header script that generated this configuration
...
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 set with the value GRUB_RECORDFAIL_TIMEOUT.
So just add or modify GRUB_RECORDFAIL_TIMEOUT at/boot/grub/grub.cfg
GRUB_RECORDFAIL_TIMEOUT=0
Then run sudo update-grub Regeneration/boot/grub/grub. cfg.