2023年11月24日发(作者:)
ubuntu显示或者隐藏grub选择菜单
ubuntu显示或者隐藏grub选择菜单
ubuntu 12.04。
在安装windows后安装的ubuntu双系统,在启动时候都会
固定先显示grub选择菜单,可以选择不同版本的ubuntu的
kernel来启动
但是对于单纯的ubuntu系统,在启动后却不会显示相应的
菜单来让选择。
参照网络上搜索的资料,可以有以下方式来显示grub菜单
(同理相信看完也了解如何隐藏了撒???):
1. 启动时候一直按住shift键
以前的Ubuntu版本,启动grub的时候,有一个grub loading,
press ESC to get the menu的提示,所以按ESC就可以看到grub
界面
现在的Ubuntu没有了,现在的做法是,启动的时候按住shift
键,就可以看到grub界面了。 (接下来就修改启动参数,加入
single,然后按ctrl+x启动,就能看到一个ncurse的界面,选择
drop to root prompt,就可以得到一个root的terminal然后就可
以重新设置root口令了)
2. 修改grub文件来完成
gedit /etc/default/grub
修改如下:
GRUB_HIDDEN___=0
#GRUB_HIDDEN____QUIET=true
GRUB___=0
update-grub
下面展开说明:
首先修改 /etc/default/文件,参考以下config文件
注释掉GRUB_HIDDEN___=0
# If you change this file, run 'update-grub' afterwards to
update
# /boot/grub/.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB___=0
#GRUB_HIDDEN___=0
GRUB_HIDDEN____QUIET=true
GRUB___=10
GRUB___UTOR=`lsb_release -i -s 2null || echo Debian`
GRUB____LINUX___=“quiet splash"
GRUB____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="0__-__,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB___L=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___=640x480
# Uncomment if you don't want GRUB to pass
"root=UUID=__" parameter to Linux
#GRUB____LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu
entries
#GRUB______Y="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
然后执行"sudo update-grub"。这样以后在中会多
出以下代码
### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
菜单将会被隐藏,除非在此行开头加上一个 # 符号。(#
GRUB_HIDDEN___=0)。
GRUB 2 第一次执行时将会寻找其他操作系统。若没有其他
操作系统被检测到,菜单将会配置为隐藏。若辨认出其他操作系
统,菜单将会显示。
若是大于 0 的整数,系统将会依此配置的秒数暂停,但不会
显示菜单。 0 则菜单不会显示,也不会有延迟。
使用者可以在启动时按住 SHIFT 键不放以强制显示菜单。
启动过程中,系统将会检查 SHIFT 键状态。若无法辨识按键
状态,会有一个短时间的延迟让使用者可通过按下 ESC 键来显
示菜单。
_HIDDEN____QUIET=true
true 不显示倒计时。屏幕将会是空白的。
false 在 GRUB_HIDDEN___ 中配置的时间,空白屏幕上会有
一个倒数计时器。
___=10
此命令将顺从 GRUB_HIDDEN___ 配置,除非
GRUB_HIDDEN___ 被注释掉(#)。若 GRUB_HIDDEN___ 启用,则
当菜单显示时,GRUB___ 将会只执行一次。 配置此值为 -1 将会
导致菜单一直显示,直到用户选择。
GRUB 2 菜单默认为隐藏,除非其他操作系统被系统检测到。
若没有其他操作系统,此行将会被注释掉,除非使用者修改它。为
了在每次启动时显示菜单,去掉此行的注释并使用 1 或更大的
值。
发布评论