File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ grub2-set-default
2+ ===
3+
4+ 设置系统默认的启动内核
5+
6+ ## 语法
7+
8+ ``` shell
9+ Usage: grub2-set-default [OPTION] MENU_ENTRY
10+ Set the default boot menu entry for GRUB.
11+ This requires setting GRUB_DEFAULT=saved in /etc/default/grub.
12+
13+ -h, --help print this message and exit
14+ -v, --version print the version information and exit
15+ --boot-directory=DIR expect GRUB images under the directory DIR/grub2
16+ instead of the /boot/grub2 directory
17+
18+ MENU_ENTRY is a number, a menu item title or a menu item identifier.
19+
20+ Report bugs to
< [email protected] > .
21+
22+ ```
23+
24+ ## 实例
25+
26+ 查看可选的系统内核:
27+ ``` shell
28+ # awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
29+ CentOS Linux (5.4.219-1.el7.elrepo.x86_64) 7 (Core)
30+ CentOS Linux (3.10.0-1160.76.1.el7.x86_64) 7 (Core)
31+ CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
32+ CentOS Linux (0-rescue-3221d376917c458992a952d6327f2d6a) 7 (Core)
33+ ```
34+
35+ grub2-set-default后面的序号从0开始。所以,如果想设置第一个选项为默认启动内核,则可以使用下面的命令:
36+
37+ ``` shell
38+ # grub2-set-default 0
39+ ```
40+ 如果想使用CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)内核版本,则可以将0改为2
41+
42+ 重启系统
43+ ``` shell
44+ ~ ]# init 6
45+ ```
You can’t perform that action at this time.
0 commit comments