Rocky Linux 9 内核升级至 6.0
默认情况下 Rocky Linux 9.1 内核是
5.14
版本,目前最新版本的内核为6.0
,所以这里我们将对应内核升级至6.0
。
注:此升级方式不仅仅适用于 Rocky Linux 9,也适用于 Rocky Linux 8,以及所有 Red Hat 系 Linux 操作系统。
升级内核
确认现有内核版本,导入公钥,安装ELRepo,再升级对应内核。
# 查看当前内核版本
[root@localhost ~]# uname -r
5.14.0-162.6.1.el9_1.x86_64
# 载入公钥
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# 安装ELRepo
[root@localhost ~]# dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm
Last metadata expiration check: 2:15:48 ago on Tue Nov 29 16:11:08 2022.
elrepo-release-9.el9.elrepo.noarch.rpm 13 kB/s | 12 kB 00:00
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Installing:
elrepo-release noarch 9.1-1.el9.elrepo @commandline 12 k
Transaction Summary
============================================================================================================================================================================
Install 1 Package
Total size: 12 k
Installed size: 5.0 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : elrepo-release-9.1-1.el9.elrepo.noarch 1/1
Verifying : elrepo-release-9.1-1.el9.elrepo.noarch 1/1
Installed:
elrepo-release-9.1-1.el9.elrepo.noarch
Complete!
# 载入elrepo-kernel元数据
[root@localhost ~]# dnf --disablerepo=\* --enablerepo=elrepo-kernel repolist
repo id repo name
elrepo-kernel ELRepo.org Community Enterprise Linux Kernel Repository - el9
# 查看可用内核包
[root@localhost ~]# dnf --disablerepo=\* --enablerepo=elrepo-kernel list kernel*
ELRepo.org Community Enterprise Linux Kernel Repository - el9 354 kB/s | 1.0 MB 00:02
Last metadata expiration check: 0:00:01 ago on Tue Nov 29 18:28:07 2022.
Installed Packages
kernel.x86_64 5.14.0-70.30.1.el9_0 @baseos
kernel.x86_64 5.14.0-162.6.1.el9_1 @baseos
kernel-core.x86_64 5.14.0-70.30.1.el9_0 @baseos
kernel-core.x86_64 5.14.0-162.6.1.el9_1 @baseos
kernel-modules.x86_64 5.14.0-70.30.1.el9_0 @baseos
kernel-modules.x86_64 5.14.0-162.6.1.el9_1 @baseos
kernel-tools.x86_64 5.14.0-162.6.1.el9_1 @baseos
kernel-tools-libs.x86_64 5.14.0-162.6.1.el9_1 @baseos
Available Packages
kernel-ml.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-core.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-devel.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-devel-matched.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-doc.noarch 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-headers.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-modules.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-modules-extra.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-tools.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 6.0.10-1.el9.elrepo elrepo-kernel
# 安装最新版本的kernel
[root@localhost ~]# dnf --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-ml.x86_64
Last metadata expiration check: 0:00:36 ago on Tue Nov 29 18:28:07 2022.
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Installing:
kernel-ml x86_64 6.0.10-1.el9.elrepo elrepo-kernel 12 k
Installing dependencies:
kernel-ml-core x86_64 6.0.10-1.el9.elrepo elrepo-kernel 56 M
kernel-ml-modules x86_64 6.0.10-1.el9.elrepo elrepo-kernel 51 M
Transaction Summary
============================================================================================================================================================================
Install 3 Packages
Total download size: 107 M
Installed size: 148 M
Downloading Packages:
(1/3): kernel-ml-6.0.10-1.el9.elrepo.x86_64.rpm 22 kB/s | 12 kB 00:00
(2/3): kernel-ml-core-6.0.10-1.el9.elrepo.x86_64.rpm 407 kB/s | 56 MB 02:21
(3/3): kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64.rpm 161 kB/s | 51 MB 05:24
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 338 kB/s | 107 MB 05:25
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : kernel-ml-core-6.0.10-1.el9.elrepo.x86_64 1/3
Running scriptlet: kernel-ml-core-6.0.10-1.el9.elrepo.x86_64 1/3
Installing : kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64 2/3
Running scriptlet: kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64 2/3
Installing : kernel-ml-6.0.10-1.el9.elrepo.x86_64 3/3
Running scriptlet: kernel-ml-core-6.0.10-1.el9.elrepo.x86_64 3/3
Running scriptlet: kernel-ml-6.0.10-1.el9.elrepo.x86_64 3/3
Verifying : kernel-ml-6.0.10-1.el9.elrepo.x86_64 1/3
Verifying : kernel-ml-core-6.0.10-1.el9.elrepo.x86_64 2/3
Verifying : kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64 3/3
Installed:
kernel-ml-6.0.10-1.el9.elrepo.x86_64 kernel-ml-core-6.0.10-1.el9.elrepo.x86_64 kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64
Complete!
# 删除旧版本工具包
[root@localhost ~]# dnf remove kernel-tools-libs.x86_64 kernel-tools.x86_64
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Removing:
kernel-tools x86_64 5.14.0-162.6.1.el9_1 @baseos 769 k
kernel-tools-libs x86_64 5.14.0-162.6.1.el9_1 @baseos 30 k
Removing unused dependencies:
pciutils-libs x86_64 3.7.0-5.el9 @minimal 79 k
Transaction Summary
============================================================================================================================================================================
Remove 3 Packages
Freed space: 878 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : kernel-tools-5.14.0-162.6.1.el9_1.x86_64 1/3
Erasing : kernel-tools-libs-5.14.0-162.6.1.el9_1.x86_64 2/3
Running scriptlet: kernel-tools-libs-5.14.0-162.6.1.el9_1.x86_64 2/3
Erasing : pciutils-libs-3.7.0-5.el9.x86_64 3/3
Running scriptlet: pciutils-libs-3.7.0-5.el9.x86_64 3/3
Verifying : kernel-tools-5.14.0-162.6.1.el9_1.x86_64 1/3
Verifying : kernel-tools-libs-5.14.0-162.6.1.el9_1.x86_64 2/3
Verifying : pciutils-libs-3.7.0-5.el9.x86_64 3/3
Removed:
kernel-tools-5.14.0-162.6.1.el9_1.x86_64 kernel-tools-libs-5.14.0-162.6.1.el9_1.x86_64 pciutils-libs-3.7.0-5.el9.x86_64
Complete!
# 安装新版本内核工具包
[root@localhost ~]# dnf --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-ml-tools.x86_64
Last metadata expiration check: 0:08:00 ago on Tue Nov 29 18:28:07 2022.
Error:
Problem: cannot install the best candidate for the job
- nothing provides libpci.so.3()(64bit) needed by kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64
- nothing provides libpci.so.3(LIBPCI_3.0)(64bit) needed by kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64
- nothing provides libpci.so.3(LIBPCI_3.3)(64bit) needed by kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64
- nothing provides libpci.so.3(LIBPCI_3.5)(64bit) needed by kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
# 因为在卸载旧版本的内核工具包的时候,删除了pciutils-libs,造成安装新版本的内核工具包时报错,所以我们需要先安装pciutils-libs,再安装新版本的内核工具包。
[root@localhost ~]# dnf install pciutils-libs
ELRepo.org Community Enterprise Linux Repository - el9 51 kB/s | 117 kB 00:02
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Installing:
pciutils-libs x86_64 3.7.0-5.el9 baseos 41 k
Transaction Summary
============================================================================================================================================================================
Install 1 Package
Total download size: 41 k
Installed size: 79 k
Is this ok [y/N]: y
Downloading Packages:
pciutils-libs-3.7.0-5.el9.x86_64.rpm 120 kB/s | 41 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 117 kB/s | 41 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : pciutils-libs-3.7.0-5.el9.x86_64 1/1
Running scriptlet: pciutils-libs-3.7.0-5.el9.x86_64 1/1
Verifying : pciutils-libs-3.7.0-5.el9.x86_64 1/1
Installed:
pciutils-libs-3.7.0-5.el9.x86_64
Complete!
# 再安装新版本的内核工具包
[root@localhost ~]# dnf --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-ml-tools.x86_64
Last metadata expiration check: 0:09:51 ago on Tue Nov 29 18:28:07 2022.
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Installing:
kernel-ml-tools x86_64 6.0.10-1.el9.elrepo elrepo-kernel 248 k
Installing dependencies:
kernel-ml-tools-libs x86_64 6.0.10-1.el9.elrepo elrepo-kernel 22 k
Transaction Summary
============================================================================================================================================================================
Install 2 Packages
Total download size: 270 k
Installed size: 956 k
Downloading Packages:
(1/2): kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64.rpm 28 kB/s | 22 kB 00:00
(2/2): kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64.rpm 30 kB/s | 248 kB 00:08
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 31 kB/s | 270 kB 00:08
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64 1/2
Running scriptlet: kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64 1/2
Installing : kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64 2/2
Running scriptlet: kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64 2/2
Verifying : kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64 1/2
Verifying : kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64 2/2
Installed:
kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64 kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64
Complete!
设置内核启动顺序
设置默认启动顺序,通过grubby --info=ALL
命令获取目前所有启动项,然后通过grub2-set-default
命令设置或者通过grubby --set-default
设置对应启动项。
# 查看所有内核启动项
[root@localhost ~]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-5.14.0-70.30.1.el9_0.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-5.14.0-70.30.1.el9_0.x86_64.img"
title="Rocky Linux (5.14.0-70.30.1.el9_0.x86_64) 9.0 (Blue Onyx)"
id="0af0a3c0bc4946a6bb4cc8daa8c8a1f7-5.14.0-70.30.1.el9_0.x86_64"
index=1
kernel="/boot/vmlinuz-0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7.img"
title="Rocky Linux (0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7) 9.0 (Blue Onyx)"
id="0af0a3c0bc4946a6bb4cc8daa8c8a1f7-0-rescue"
index=2
kernel="/boot/vmlinuz-6.0.10-1.el9.elrepo.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-6.0.10-1.el9.elrepo.x86_64.img"
title="Rocky Linux (6.0.10-1.el9.elrepo.x86_64) 9.1 (Blue Onyx)"
id="bae8b9faf30f473196d3a871e300f4dc-6.0.10-1.el9.elrepo.x86_64"
index=3
kernel="/boot/vmlinuz-5.14.0-162.6.1.el9_1.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-5.14.0-162.6.1.el9_1.x86_64.img"
title="Rocky Linux (5.14.0-162.6.1.el9_1.x86_64) 9.1 (Blue Onyx)"
# 这里看到内核 6.0 索引为2,所以这里设置默认内核为2
[root@localhost ~]# grubby --set-default 2
The default is /boot/loader/entries/bae8b9faf30f473196d3a871e300f4dc-6.0.10-1.el9.elrepo.x86_64.conf with index 2 and kernel /boot/vmlinuz-6.0.10-1.el9.elrepo.x86_64
# 查看默认内核
[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-6.0.10-1.el9.elrepo.x86_64
# 重启服务器
[root@localhost ~]# reboot
# 查看启动内核为6.0
[root@localhost ~]# uname -r
6.0.10-1.el9.elrepo.x86_64
删除旧内核
在这里我们保留系统上安装的最后两个内核并删除多余的旧内核。木子已经明确定义了installonly_limit=2
使用--setopt
来覆盖/etc/dnf/dnf.conf
中的默认配置。如果您不指定installonly_limit
参数,那么默认情况下dnf remove
命令将采用/etc/dnf/dnf.conf
中的installonly_limit
值。
# 对应的limit值,可以修改配置文件
[root@localhost ~]# grep limit /etc/dnf/dnf.conf
installonly_limit=3
# 删除多余内核,只保留最后两个
[root@localhost ~]# dnf remove --oldinstallonly --setopt installonly_limit=2 kernel
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Removing:
kernel x86_64 5.14.0-70.30.1.el9_0 @baseos 0
kernel-core x86_64 5.14.0-70.30.1.el9_0 @baseos 73 M
kernel-modules x86_64 5.14.0-70.30.1.el9_0 @baseos 20 M
Transaction Summary
============================================================================================================================================================================
Remove 3 Packages
Freed space: 93 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : kernel-5.14.0-70.30.1.el9_0.x86_64 1/3
Running scriptlet: kernel-5.14.0-70.30.1.el9_0.x86_64 1/3
Erasing : kernel-modules-5.14.0-70.30.1.el9_0.x86_64 2/3
Running scriptlet: kernel-modules-5.14.0-70.30.1.el9_0.x86_64 2/3
Running scriptlet: kernel-core-5.14.0-70.30.1.el9_0.x86_64 3/3
Erasing : kernel-core-5.14.0-70.30.1.el9_0.x86_64 3/3
Running scriptlet: kernel-core-5.14.0-70.30.1.el9_0.x86_64 3/3
Verifying : kernel-5.14.0-70.30.1.el9_0.x86_64 1/3
Verifying : kernel-core-5.14.0-70.30.1.el9_0.x86_64 2/3
Verifying : kernel-modules-5.14.0-70.30.1.el9_0.x86_64 3/3
Removed:
kernel-5.14.0-70.30.1.el9_0.x86_64 kernel-core-5.14.0-70.30.1.el9_0.x86_64 kernel-modules-5.14.0-70.30.1.el9_0.x86_64
Complete!
# 这里我们看到还有两个内核,其中6.0是现在在用的,5.14.0-162是之前使用的
[root@localhost ~]# rpm -qa | grep kernel
kernel-core-5.14.0-162.6.1.el9_1.x86_64
kernel-modules-5.14.0-162.6.1.el9_1.x86_64
kernel-5.14.0-162.6.1.el9_1.x86_64
kernel-ml-core-6.0.10-1.el9.elrepo.x86_64
kernel-ml-modules-6.0.10-1.el9.elrepo.x86_64
kernel-ml-6.0.10-1.el9.elrepo.x86_64
kernel-ml-tools-libs-6.0.10-1.el9.elrepo.x86_64
kernel-ml-tools-6.0.10-1.el9.elrepo.x86_64
只保留现正使用的内核
正常情况下installonly_limit
参数是不允许设置值为1
的,那么如果我们只想保留目前正在使用的内核,删除其它所有多余的内核,怎么办了?
# 如果您只想保留当前活动内核,这样是不允许的。
[root@localhost ~]# dnf -y remove --oldinstallonly --setopt installonly_limit=1 kernel
Config error: Error parsing --setopt with key 'installonly_limit', value '1': value 1 is not allowed
# 删除内核5.14.0-162
[root@localhost ~]# dnf remove kernel-5.14.0-162.6.1.el9_1.x86_64 kernel-core-5.14.0-162.6.1.el9_1.x86_64 kernel-modules-5.14.0-162.6.1.el9_1.x86_64
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Removing:
kernel x86_64 5.14.0-162.6.1.el9_1 @baseos 0
kernel-core x86_64 5.14.0-162.6.1.el9_1 @baseos 84 M
kernel-modules x86_64 5.14.0-162.6.1.el9_1 @baseos 31 M
Transaction Summary
============================================================================================================================================================================
Remove 3 Packages
Freed space: 114 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : kernel-5.14.0-162.6.1.el9_1.x86_64 1/3
Running scriptlet: kernel-5.14.0-162.6.1.el9_1.x86_64 1/3
Erasing : kernel-modules-5.14.0-162.6.1.el9_1.x86_64 2/3
Running scriptlet: kernel-modules-5.14.0-162.6.1.el9_1.x86_64 2/3
Running scriptlet: kernel-core-5.14.0-162.6.1.el9_1.x86_64 3/3
Erasing : kernel-core-5.14.0-162.6.1.el9_1.x86_64 3/3
Running scriptlet: kernel-core-5.14.0-162.6.1.el9_1.x86_64 3/3
Verifying : kernel-5.14.0-162.6.1.el9_1.x86_64 1/3
Verifying : kernel-core-5.14.0-162.6.1.el9_1.x86_64 2/3
Verifying : kernel-modules-5.14.0-162.6.1.el9_1.x86_64 3/3
Removed:
kernel-5.14.0-162.6.1.el9_1.x86_64 kernel-core-5.14.0-162.6.1.el9_1.x86_64 kernel-modules-5.14.0-162.6.1.el9_1.x86_64
Complete!
# 查看目前所有启动配置
[root@localhost ~]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-5.14.0-70.30.1.el9_0.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-5.14.0-70.30.1.el9_0.x86_64.img"
title="Rocky Linux (5.14.0-70.30.1.el9_0.x86_64) 9.0 (Blue Onyx)"
id="0af0a3c0bc4946a6bb4cc8daa8c8a1f7-5.14.0-70.30.1.el9_0.x86_64"
index=1
kernel="/boot/vmlinuz-0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7.img"
title="Rocky Linux (0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7) 9.0 (Blue Onyx)"
id="0af0a3c0bc4946a6bb4cc8daa8c8a1f7-0-rescue"
index=2
kernel="/boot/vmlinuz-6.0.10-1.el9.elrepo.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-6.0.10-1.el9.elrepo.x86_64.img"
title="Rocky Linux (6.0.10-1.el9.elrepo.x86_64) 9.1 (Blue Onyx)"
id="bae8b9faf30f473196d3a871e300f4dc-6.0.10-1.el9.elrepo.x86_64"
index=3
kernel="/boot/vmlinuz-0-rescue-bae8b9faf30f473196d3a871e300f4dc"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-0-rescue-bae8b9faf30f473196d3a871e300f4dc.img"
title="Rocky Linux (0-rescue-bae8b9faf30f473196d3a871e300f4dc) 9.1 (Blue Onyx)"
id="bae8b9faf30f473196d3a871e300f4dc-0-rescue"
# 删除不需要的内核启动项
[root@localhost ~]# grubby --remove-kernel=/boot/vmlinuz-5.14.0-70.30.1.el9_0.x86_64
[root@localhost ~]# grubby --remove-kernel=/boot/vmlinuz-0-rescue-0af0a3c0bc4946a6bb4cc8daa8c8a1f7
# 这时候我们看到只保留了 6.0 相关内核启动项了
[root@localhost ~]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-6.0.10-1.el9.elrepo.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-6.0.10-1.el9.elrepo.x86_64.img"
title="Rocky Linux (6.0.10-1.el9.elrepo.x86_64) 9.1 (Blue Onyx)"
id="bae8b9faf30f473196d3a871e300f4dc-6.0.10-1.el9.elrepo.x86_64"
index=1
kernel="/boot/vmlinuz-0-rescue-bae8b9faf30f473196d3a871e300f4dc"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap ipv6.disable=1 selinux=0"
root="/dev/mapper/rl-root"
initrd="/boot/initramfs-0-rescue-bae8b9faf30f473196d3a871e300f4dc.img"
title="Rocky Linux (0-rescue-bae8b9faf30f473196d3a871e300f4dc) 9.1 (Blue Onyx)"
id="bae8b9faf30f473196d3a871e300f4dc-0-rescue"
本文是转载文章,版权归原作者所有。建议访问原文,转载本文请联系原作者。
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果