translated

This commit is contained in:
onionstalgia 2023-08-30 22:22:13 +08:00
parent a323dcc7f5
commit 8ccaf64f3f
2 changed files with 173 additions and 173 deletions

View File

@ -1,173 +0,0 @@
[#]: subject: "How to Change the default kernel in RHEL 8 and 9"
[#]: via: "https://www.2daygeek.com/changing-default-kernel-rhel-8-rhel-9/"
[#]: author: "Rasool Cool https://www.2daygeek.com/author/rasool/"
[#]: collector: "lujun9972"
[#]: translator: "onionstalgia"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Change the default kernel in RHEL 8 and 9
======
Usually a Linux system boots with the latest installed kernel, which is set by default. It keeps maximum 3 recent versions of Linux Kernel boot entries.
Lets say youve done the yum update, and a new kernel is installed as part of this update. This prevents the application from starting as this kernel is incompatible with the application.
To temporarily fix this problem, you should continue to boot the system into an older kernel.
In this article, well show you how to set old kernel version as default on RHEL 8 and RHEL 9 systems using grubby utility.
* [**How to Upgrade from RHEL 7 to RHEL 8**][1]
### What is grubby
grubby is a command line tool used for updating and displaying information about the boot loaders configuration files across multiple architectures.
### Checking currently booted kernel
You can check booted/loaded kernel using **uname command** as shown below.
```
uname -r
4.18.0-477.13.1.el8_8.x86_64
```
### Listing the Default Kernel
To verify the default kernel version using grubby, run:
```
grubby --default-kernel
/boot/vmlinuz-4.18.0-477.13.1.el8_8.x86_64
```
To obtain the index number of the current default kernel, run:
```
grubby --default-index
0
```
### Checking installed kernels
To check list of installed kernels, run:
Lets explain the below output. The latest kernel installed will have the **entry-index** of **`0`** , the next **older kernel** version will get **`1`** , second older kernel version will get **`2`** , and the **rescue kernel** will get an entry-index of **`3`**.
```
grubby --info=ALL | egrep -i 'index|title'
index=0
title="Red Hat Enterprise Linux (4.18.0-477.13.1.el8_8.x86_64) 8.8 (Ootpa)"
index=1
title="Red Hat Enterprise Linux (4.18.0-425.19.2.el8_7.x86_64) 8.7 (Ootpa)"
index=2
title="Red Hat Enterprise Linux (4.18.0-425.13.1.el8_7.x86_64) 8.7 (Ootpa)"
index=3
title="Red Hat Enterprise Linux (0-rescue-13iu76884ec5490puc67j8789s249b0c) 8.2 (Ootpa)"
```
### Changing default kernel Boot entry
This can be done in two ways either using **`'kernel filename'`** or **`'kernel entry-index'`**. We will be going to set **index=1 (4.18.0-425.19.2.el8_7.x86_64)** as default kernel due to application dependency.
```
Syntax:
grubby --set-default [kernel-filename]
```
```
grubby --set-default /boot/vmlinuz-4.18.0-425.19.2.el8_7.x86_64
OR
grubby --set-default vmlinuz-4.18.0-425.19.2.el8_7.x86_64
```
To change the default kernel boot entry using kernel entry-index:
```
Syntax:
grubby --set-default-index=[kernel-entry-index]
```
```
grubby --set-default-index=1
```
### Rebooting the system
Reboot the system to check whether the old kernel is persistent or not.
```
reboot
or
init 6
```
### Verifying the Changes
Lets check if the kernel added in the previous step has taken effect or not. Yes, it booted with older kernel **`'N-1'`** as expected.
```
uname -r
4.18.0-425.19.2.el8_7.x86_64
grubby --default-kernel
/boot/vmlinuz-4.18.0-425.19.2.el8_7.x86_64
```
To check detailed information of all kernel, run:
```
grubby --info=ALL
```
![][2]
##### Wrapping Up
In this tutorial, weve shown you how to set old kernel version as default on RHEL 8 and RHEL 9 systems using grubby utility.
If you have any questions or feedback, feel free to comment below.
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/changing-default-kernel-rhel-8-rhel-9/
作者:[Rasool Cool][a]
选题:[lujun9972][b]
译者:[onionstalgia](https://github.com/onionstalgia)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/rasool/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/upgrading-from-rhel-7-to-rhel-8/
[2]: https://www.2daygeek.com/wp-content/uploads/2023/06/changing-default-kernel-rhel-8-rhel-9-1024x494.jpg

View File

@ -0,0 +1,173 @@
[#]: subject: "How to Change the default kernel in RHEL 8 and 9"
[#]: via: "https://www.2daygeek.com/changing-default-kernel-rhel-8-rhel-9/"
[#]: author: "Rasool Cool https://www.2daygeek.com/author/rasool/"
[#]: collector: "lujun9972"
[#]: translator: "onionstalgia"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
如何更改 RHEL 8 和 9 的默认内核
======
通常 Linux 系统会默认引导系统进入最新安装的内核,并保留最新的 3 个 Linux 内核引导条目。
假设你已经执行了 yum update并且新的内核作为更新的一部分已经安装了。这时由于这个新内核与应用程序不兼容它会阻止应用程序启动。
想要暂时解决这个问题,你应该还是引导系统进入旧内核。
在本文中,我们将向您展示如何使用 grubby 工具将旧的内核版本设置为 RHEL 8 和 RHEL 9 系统上的默认版本。
* [**如何从 RHEL 7 升级到 RHEL 8**][1]
### grubby 是什么
grubby 是一个命令行工具,用于在多个架构上更新和显示引导加载配置文件的信息。
### 检查当前引导的内核
你可以使用如下的 ``uname`` 命令来检查当前引导/加载的内核。
```
uname -r
4.18.0-477.13.1.el8_8.x86_64
```
### 列出默认内核
使用 grubby 验证默认内核版本,运行以下命令:
```
grubby --default-kernel
/boot/vmlinuz-4.18.0-477.13.1.el8_8.x86_64
```
要获取当前默认内核的索引号,请运行以下命令:
```
grubby --default-index
0
```
### 检查已安装的内核
要检查已安装的内核的列表,请运行以下命令:
我们来解释以下的输出信息。最新安装的内核的**条目索引**为**`0`**,接下来的 **较旧的内核** 版本将会是 **`1`**,第二个更旧的内核版本将会是**`2`**,而**救援内核** 的条目索引将会是 **`3`**。
```
grubby --info=ALL | egrep -i 'index|title'
index=0
title="Red Hat Enterprise Linux (4.18.0-477.13.1.el8_8.x86_64) 8.8 (Ootpa)"
index=1
title="Red Hat Enterprise Linux (4.18.0-425.19.2.el8_7.x86_64) 8.7 (Ootpa)"
index=2
title="Red Hat Enterprise Linux (4.18.0-425.13.1.el8_7.x86_64) 8.7 (Ootpa)"
index=3
title="Red Hat Enterprise Linux (0-rescue-13iu76884ec5490puc67j8789s249b0c) 8.2 (Ootpa)"
```
### 更改默认内核引导条目
我们可以用两种方式,使用 **`'内核文件名'`**,或者使用 **`'内核条目索引'`**。我们设置“ ** index =1 (4.18.0-425.19.2.el8_7.x86_64)** ”为默认内核,以此满足应用程序的依赖关系。
```
语法:
grubby --set-default [kernel-filename]
```
```
grubby --set-default /boot/vmlinuz-4.18.0-425.19.2.el8_7.x86_64
或者
grubby --set-default vmlinuz-4.18.0-425.19.2.el8_7.x86_64
```
使用内核条目索引更改默认的内核引导:
```
语法:
grubby --set-default-index=[kernel-entry-index]
```
```
grubby --set-default-index=1
```
### 重启系统
重启系统,检查旧内核是否持久更改。
```
reboot
或者
init 6
```
### 验证更改
让我们检查一下在上一步中添加的内核是否生效了。好了,按我们的预期使用了较旧的内核 **`'N-1'`** 进行引导了。
```
uname -r
4.18.0-425.19.2.el8_7.x86_64
grubby --default-kernel
/boot/vmlinuz-4.18.0-425.19.2.el8_7.x86_64
```
要检查所有内核的详细信息,请运行以下命令:
```
grubby --info=ALL
```
![][2]
##### 总结
在本教程中,我们展示了如何使用 grubby 工具在 RHEL 8 和 RHEL 9 系统上将旧版本内核设置为默认。
如果有任何问题或反馈,欢迎在下方发表评论。
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/changing-default-kernel-rhel-8-rhel-9/
作者:[Rasool Cool][a]
选题:[lujun9972][b]
译者:[onionstalgia](https://github.com/onionstalgia)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/rasool/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/upgrading-from-rhel-7-to-rhel-8/
[2]: https://www.2daygeek.com/wp-content/uploads/2023/06/changing-default-kernel-rhel-8-rhel-9-1024x494.jpg