LoginSignup
2
1

More than 3 years have passed since last update.

[OCI] Oracle Linux7 起動カーネルを変更してみた。

Last updated at Posted at 2019-02-07

Oracle LinuxはUnbreakable Enterprise Kernel (UEK) と Red Hat互換カーネルがあります。
Oracle Cloud Infrastructure (OCI)のOracle Linux7のOracle提供イメージでインスタンスを作成するとデフォルトではUEKで起動します。

この記事では起動Kernelの変更してみた手順を記載します。(Oracle提供イメージは Oracle-Linux-7.6-2019.01.17-0を使用)

カーネルのリストを表示する

[opc@host ~]$ sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2-efi.cfg
0 : Oracle Linux Server 7.6, with Linux 3.10.0-957.1.3.el7.x86_64
1 : Oracle Linux Server 7.6, with Unbreakable Enterprise Kernel 4.14.35-1844.1.3.el7uek.x86_64
2 : Oracle Linux Server (3.10.0-957.el7.x86_64 with Linux) 7.6
3 : Oracle Linux Server (0-rescue-5e232f837a42419b95b1e19a97b16a98 with Linux) 7.6

現在のデフォルトを調べる

[opc@host ~]$ sudo grub2-editenv list
saved_entry=1

利用したいカーネルをデフォルトに設定

sudo grub2-set-default X コマンドでデフォルトを設定します。例えば上記のリストから 3.10.0-957.1.3.el7.x86_64 を設定する場合は「X」を id となる「0」に変更して実行します。

[opc@host ~]$ sudo grub2-set-default 0

リストは0(ゼロ)から始まっていることに留意してください。

GRUB 2の起動メニューを生成

grub2-mkconfig コマンドでGRUB 2(GNU GRand Unified Bootloader 2)の起動メニューを生成し、dracut コマンドでinitramfs ファイルを生成します。

[opc@host ~]$ sudo grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-4.14.35-1844.1.3.el7uek.x86_64
Found initrd image: /boot/initramfs-4.14.35-1844.1.3.el7uek.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-5e232f837a42419b95b1e19a97b16a98
Found initrd image: /boot/initramfs-0-rescue-5e232f837a42419b95b1e19a97b16a98.img
done
[opc@host ~]$ sudo dracut --force
bash
modsign
nss-softokn
i18n
network
ifcfg
btrfs
crypt
dm
dmraid
kernel-modules
lvm
mdraid
qemu
qemu-net
iscsi
nfs
resume
rootfs-block
terminfo
udev-rules
virtfs
biosdevname
systemd
usrmount
-uptrack
base
fs-lib
microcode_ctl-fw_dir_override
shutdown
[opc@host ~]$

再起動して確認

再起動してログインし、指定したカーネルになっていることを確認

[opc@host ~]$ sudo reboot
[opc@host ~]$ sudo grub2-editenv list
saved_entry=0
[opc@host ~]$ uname -a
Linux host 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 1 00:13:43 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

おわりに

OCIでOracle LinuxのRed hat互換カーネルで起動させることができました。

後述

参考情報
- Oracle LinuxのデフォルトカーネルをスマートにUEKからRHCKに変更する
- OSカーネルの更新

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1