1. grub
本页说明如何在 Debian 12 中减小 GRUB 的启动等待时间(timeout),以加快系统启动。修改前建议保留备份并确保你能在需要时进入恢复/高级菜单。
1.1. 快速步骤
编辑主配置文件
/etc/default/grub:
$ sudo vi /etc/default/grub
修改内容如下:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
-GRUB_TIMEOUT=5
+GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
解释:
GRUB_TIMEOUT:以秒为单位的等待时间,设置为1表示等待 1 秒后自动启动。设置为0表示立即启动(可能导致难以进入菜单),建议设置1或2做折中GRUB_TIMEOUT_STYLE:可选值menu(显示菜单)、hidden(默认隐藏菜单但仍等待超时)等。将其设为menu可以短暂显示菜单,hidden则更隐蔽
修改完成后,必须更新 grub 配置并使其生效:
$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-6.1.0-41-amd64
Found initrd image: /boot/initrd.img-6.1.0-41-amd64
Found linux image: /boot/vmlinuz-6.1.0-39-amd64
Found initrd image: /boot/initrd.img-6.1.0-39-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
然后重启检查效果:
$ sudo reboot
1.2. 额外提示与注意事项
若要临时从下次启动进入特定内核或菜单项,可使用 grub-reboot 或 grub-set-default:
$ sudo grub-reboot '1>2' # 示例:根据你的 grub 配置选择项