RCF*_*RCF 6 boot grub2 dual-boot 15.04
使用本站点上描述的所有解决方案,将 Grub 菜单等待时间设置为零不起作用。
我做了以下事情:
sudo cp /etc/default/grub /etc/default/grub.old
sudo gedit /etc/default/grub
Run Code Online (Sandbox Code Playgroud)
根据说明取消注释此行。
GRUB_HIDDEN_TIMEOUT="0"
Run Code Online (Sandbox Code Playgroud)
根据说明设置此行。
GRUB_TIMEOUT="0"
Run Code Online (Sandbox Code Playgroud)
/etc/default/grub现在看起来像这样:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT="0"
GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="0"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash profile"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Run Code Online (Sandbox Code Playgroud)
编辑了/etc/default/grub文件 -->
sudo update-grub
Run Code Online (Sandbox Code Playgroud)
重新启动后,Grub 等待时间仍设置为 10 秒。
只需进行一个简单的更改,我就可以将等待时间缩短到 1 秒。在/etc/default/grub 中编辑了这两行
#GRUB_HIDDEN_TIMEOUT="0"
GRUB_TIMEOUT="1"
Run Code Online (Sandbox Code Playgroud)
将第一个注释回默认值,并将 GRUB_TIMEOUT 设置为“1”。
后,
sudo update-grub
Run Code Online (Sandbox Code Playgroud)
此解决方案有效,但我的问题是:
当 GRUB-TIMEOUT 设置为“0”时,将 TIMEOUT 值重置为 10 秒的陷阱在哪里。
也许是grub.cfg中的“IF”测试之一??
这是一个错误。问题出在文件中/etc/grub.d/30_os-prober。
如此处所示,解决方法是添加文件/etc/grub.d/25_pre-os-prober和/etc/grub.d/35_post-os-prober.
这两个文件还必须标记为可执行文件才能工作。
添加这两个文件后,您对GRUB_TIMEOUTin变量的修改/etc/default/grub应该会按预期工作。
如果您不是双引导,另一种解决方法是卸载os-prober.
#! /bin/sh
# file: /etc/grub.d/25_pre-os-prober
set -e
# Save the $timeout and $timeout_style values set by /etc/grub.d/00_header
# before /etc/grub.d/30_os-prober messes them up.
cat << EOF
set timeout_bak=\${timeout}
set timeout_style_bak=\${timeout_style}
EOF
Run Code Online (Sandbox Code Playgroud)
#! /bin/sh
# file: /etc/grub.d/35_post-os-prober
set -e
# Reset $timeout and $timeout_style to their original values
# set by /etc/grub.d/00_header before /etc/grub.d/30_os-prober messed them up.
cat << EOF
set timeout=\${timeout_bak}
set timeout_style=\${timeout_style_bak}
EOF
Run Code Online (Sandbox Code Playgroud)
grub 中有一个覆盖,当超时为 0 秒时,将其替换为 10 秒。您可以简单地使用以下命令,而不是像其他答案建议的那样编辑 grub 脚本:
GRUB_HIDDEN_TIMEOUT="0.0"
GRUB_TIMEOUT="0.0"
Run Code Online (Sandbox Code Playgroud)
这会起作用,因为 grub 覆盖不会发现"0"等于"0.0"。
| 归档时间: |
|
| 查看次数: |
8739 次 |
| 最近记录: |