CentOS7 (SL7) OS デフォルトのカーネルを変更・指定する
1. 現在のデフォルトを調べる (grub2-boot, efi-boot 共通)
[root@host]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-1062.4.1.el7.x86_64) 7 (Core) [root@host]#
2.インストールされているカーネルのリストを表示する
grub2-boot の場合
[root@host]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (3.10.0-1062.4.1.el7.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-1062.1.2.el7.x86_64) 7 (Core) 2 : CentOS Linux (3.10.0-1062.1.1.el7.x86_64) 7 (Core) 3 : CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core) 4 : CentOS Linux (3.10.0-957.21.3.el7.x86_64) 7 (Core) 5 : CentOS Linux (0-rescue-0147aeec4ca94412b78f0954901a0d89) 7 (Core) 6 : CentOS Linux release 7.0.1406 (Core) (on /dev/sdb3) [root@host]#
efi-boot の場合
[root@host]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2-efi.cfg 0 : Scientific Linux (3.10.0-1062.4.1.el7.x86_64) 7.7 (Nitrogen) 1 : Scientific Linux (3.10.0-1062.1.2.el7.x86_64) 7.7 (Nitrogen) 2 : Scientific Linux (3.10.0-957.27.2.el7.x86_64) 7.6 (Nitrogen) 3 : Scientific Linux (0-rescue-98616bc5eae144c184174f8b6905d94a) 7.2 (Nitrogen) [root@host]#
3. 利用したいカーネルをデフォルトに設定する
grub2-boot の場合 例えば 3 : CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core) に変更する場合は
[root@host]# grub2-set-default 3 [root@host]# grub2-editenv list saved_entry=3
NOTE: カーネルのリストが0(ゼロ)から始まっている点に気をつけて下さい。
efi-boot の場合 例えば 2 : Scientific Linux (3.10.0-957.27.2.el7.x86_64) 7.6 (Nitrogen) に変更する場合は
[root@host]# grub2-set-default 2 [root@host]# grub2-editenv list saved_entry=2
NOTE: カーネルのリストが0(ゼロ)から始まっている点に気をつけて下さい。
4. リブート後、カーネルのリリース番号、バージョン情報を調べる
[root@host]# uname -r -v 3.10.0-957.27.2.el7.x86_64 #1 SMP Tue Jul 30 08:44:23 CDT 2019 [root@host]#