- Manage the Boot Kernel for Oracle Linux 8
- Introduction
- Background
- Objectives
- What Do You Need?
- (Hands-on Lab) Connect to the Compute Instance
- Check available kernels
- Check the current default kernel
- Change the default kernel
- Change kernel command line boot parameters
- Video Demonstrations
- Additional Information
- More Learning Resources
- ChapterВ 4В Upgrading an Oracle Linux System
- 4.1В Conditions for Performing an In-Place Upgrade
- 4.2В Performing an In-Place Upgrade
- Установка нового ядра UEK на Oracle Linux 7.6 и активация I/O Scheduler mq-deadline или kyber
Manage the Boot Kernel for Oracle Linux 8
Introduction
This tutorial describes how to set the default kernel of an Oracle Linux system from the command line. This tutorial is targeted at Oracle Linux 8 users, but the grubby command is also available on Oracle Linux 6 and Oracle Linux 7.
Background
By default, Oracle Linux systems are configured to boot the most recent kernel version first. In most cases, changing the default kernel is unnecessary.
However, the default kernel might not be the correct version to use in certain scenarios, such as the following:
- The current kernel version might be incompatible with a particular hardware you are using.
- Cases involving Unbreakable Enterprise Kernel (UEK) releases on the system
- UEK releases are typically based on kernel versions that are newer than the Red Hat Compatible Kernel (RHCK) version on which an Oracle Linux release is based. Thus, the new UEK version becomes the default kernel, which is not the same as the Oracle Linux kernel.
- If a UEK beta or technical preview release is installed on the system, the UEK kernel needs to be demoted to ensure that the kernel is used only if intentionally and manually selected as the boot kernel by an administrator.
- A UEK kernel might need to be promoted because a specific software depends on it.
These examples and other similar cases would necessitate that you switch between kernel types.
In previous releases, setting the default kernel was performed by configuring the GRUB boot loader or by using other alternative commands. Now, however, you should preferrably use the grubby command to control and manage all of your boot requirements. This tool offers the benefit of being scriptable and can abstract bootloader configuration from the user.
Objectives
In this lab, you’ll learn how to:
- determine the current loaded kernel
- determine the default kernel
- determine which kernel versions are available on the system
- how to use grubby to manage kernels
What Do You Need?
- Any Oracle Linux system that has the grubby package installed
(Hands-on Lab) Connect to the Compute Instance
Note: This step is specific to the Oracle provided free lab environment.
The Desktop environment will display before the instance(s) are ready. Deployment of this environment can take two to five minutes, depending on the number of resources and provisioning steps needed.
First, to access the lab compute instance(s), connect to the Oracle Cloud Console and copy the compute instance Public IP address.
- Sign in to Oracle Cloud Console, and select your Compartment.
- Click Instances.
Copy the Public IP to a temporary location (such as a text file) on your computer.
To copy, highlight the IP address with the mouse and press Ctrl+C.
Connect to the instance.
Where is the IP address copied from the Oracle Cloud Console.
Accept the ECDSA key fingerprint by typing yes at the prompt.
If the connection fails with the Permission denied (publickey,gssapi-keyex,gssapi-with-mic) message, wait a bit longer for the provisioning process to complete and try making the ssh connection again.
Check available kernels
Several methods are available for checking which kernels are available on a system.
Using the rpm command
Note that the command output also includes other kernel related packages and can therefore be confusing.
Listing the kernels in the /boot directory
The command produces an accurate list of kernels available on the system. However, due to the way kernels are named, the kernel version that the system currently uses is not easily identifiable.
Using the grubby command on specific kernels or using the ALL option:
The command provides fuller information about the boot configuration associated with each kernel in the system’s /boot directory. The details are based on the GRUB title configuration.
In general, kernels are named to include the upstream version number and the distribution build numbering. The kernel names on Oracle Linux also include indications of whether or not they are standard RHCK or whether they are UEK based. Additionally, the names also identify their system architecture. For example, the el8 suffix would indicate an RHCK, while el8uek would indicate a UEK.
Check the current default kernel
To check which kernel is already configured as the current default kernel to use at boot, run:
To check which kernel is currently running on a system, run:
If the default kernel and the currently running kernel are not identical, the underlying reasons might be one of the following:
- A newer kernel is installed, but the system has not been rebooted.
- During a system reboot, an alternative kernel was manually selected to be the operative kernel.
- The default kernel was manually updated but the system has not been rebooted after the update.
Change the default kernel
To switch to a different default kernel, run the following command. Make sure to specify the full path to the designated default kernel.
The change takes effect immediately and persists across system reboots.
The grubby command has additional boot arguments for configuring kernel and boot operations. Refer to the documentation for more information.
Change kernel command line boot parameters
Use the —update-kernel option to update a kenel entry in combination with —args to add new arguments or —remove-arguments to remove existing arguments. Multiple arguments can be specified for each option in a quoted space-separated list. You can add and remove arguments in the same operation.
To update a specific kernel, provide the —update-kernel option with the full path to the kernel that you wish to update. To update all kernel entries to use a specific kernel boot argument, you can set —update-kernel=ALL .
For the purpose of this tutorial you can update all kernel entries to change the loglevel and LANG arguments:
Use the grubby info=ALL command to check that the change is implemented across kernels:
Video Demonstrations
An introductory video that provides an overview of the kernel and underlying system architecture and which demonstrates switching kernel using the grubby command is provided at https://www.youtube.com/watch?v=a0zXGhzPRp8.
A more advanced video demonstration and tutorial is provided at https://www.youtube.com/watch?v=0dv87RFGcKI if you need more information on working with GRUB2 on Oracle Linux 8.
Note that this tutorial does not describe use of the grubby command and explains the underlying components that grubby interacts with. For most kernel management requirements on Oracle Linux, the grubby tool is sufficient.
Additional Information
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Manage the Boot Kernel for Oracle Linux 8
Copyright © 2021, Oracle and/or its affiliates.
Источник
ChapterВ 4В Upgrading an Oracle Linux System
Typically, you upgrade an Oracle Linux system by performing a fresh installation. However, starting with Oracle Linux 7, there is support for in-place upgrades. This chapter describes the conditions and method for performing an in-place upgrade.
4.1В Conditions for Performing an In-Place Upgrade
In-place upgrades are supported for systems that run Oracle Linux 6 Update 5 or later only . The following conditions must also be met:
The system to be upgraded must meet the minimum installation requirements for Oracle Linux 7, see Section 1.1, “System Requirements”.
The Oracle Linux 6 system has been completely updated from the ol6_x86_64_latest channel or the ol6_latest repository.
Either the Unbreakable Enterprise Kernel Release 3 (UEK R3) or the Unbreakable Enterprise Kernel Release 4 (UEK R4) release must be installed on the system and it must be the default boot kernel. Upgrading from Unbreakable Enterprise Kernel Release 2 is not supported.
The Oracle Linux 6 system must have been installed with the Minimal set of software.
No Oracle product stack is present on the system.
If the RHCK is installed, it is upgraded as part of the process, but it must not be set as the default boot kernel.
If the system to be upgraded contains valuable data, make a backup or snapshot of the system so that you can recover it to its previous state if the upgrade fails.
Before you upgrade, check the release notes for any known issues with upgrades. See Oracle В® Linux 7 Documentation and Unbreakable Enterprise Kernel Documentation libraries.
To perform an in-place upgrade you must install some additional packages and their dependencies. The system should have access to the Unbreakable Linux Network (ULN), Oracle Linux yum server, or a local yum server.
4.2В Performing an In-Place Upgrade
If the system is registered with ULN, make sure that it is subscribed to the ol6_x86_64_latest and ol6_x86_64_addons channels.
If the system is using the Oracle Linux yum server or a local mirror, make sure that the ol6_latest and ol6_addons repositories are enabled.
Use the yum update command to update the system to the latest Oracle Linux 6 release.
Install the latest versions of the following required packages:
If the system is registered with ULN, delete the system from ULN and disable yum plugins.
You can only delete a system if it is registered to your user name on ULN.
Log in to https://linux.oracle.com with your ULN user name and password.
On the Systems tab, click the link for the system in the list of registered machines.
On the System Details page, click Delete .
When prompted to confirm the deletion, click OK .
On the system, edit the yum configuration file /etc/yum.conf file and disable yum plugins by setting plugins=0 .
Run the preupg command to perform an upgrade assessment:
Examine the upgrade assessment results file /root/preupgrade/result.html .
If the assessment reports any fail , needs_action , or needs_inspection issues, read the remediation instructions for these issues and perform any required actions before proceeding with the upgrade.
You might also need to perform some actions after performing the upgrade.
You can run the preupg command as often as you like to check the system’s readiness for upgrading. A backup of each assessment is stored in the /root/preupgrade-results directory. You might want to back up this directory before performing the upgrade.
The /root/preupgrade directory (and its contents) must be present for the upgrade to proceed.
Run the redhat-upgrade-tool-cli command to perform the upgrade.
For example, to upgrade using an Oracle Linux 7 installation ISO, you might use the following command:
Substitute OL7_ISO with the path to the installation ISO. Alternately, use the —device option to point to a burned media copy of the installation ISO. For example:
Substitute /dev/cdrom with the device where the installation media is accessible.
If you wish to use a network-based resource to perform the upgrade, you can use the —network option in conjunction with the —instrepo to specify the URL where the ISO contents are located. For example:
Substitute OL7_repo_url with the URL where the installation media is accessible. Note that an installation repository must contain a .treeinfo file that provides metadata for the installation. Currently, you cannot use the standard yum repositories exposed on the Oracle Linux yum server directly. If you wish to install from a network resource, you can copy the contents of an installation ISO to a locally hosted web server.
The —cleanup-post option ensures that there are no Oracle Linux 6 packages remaining on the system after the upgrade. If you do not use this option, check the system after the upgrade and manually remove any Oracle Linux 6 packages, for example, by using the yum remove `rpm -qa | grep el6` .
For more information, use the —help option with the redhat-upgrade-tool-cli command.
If you require use of a proxy server to access a network resource where your installation repository is located, set the appropriate command line variables before running the command. For example:
Reboot the system to start the upgrade.
After the reboot, the upgrade tool installs the required packages, reconfigures the system, and then reboots. Depending on the number of packages, this may take some time.
After the upgrade completes, perform any post-upgrade actions identified by the upgrade assessment.
If the system was previously registered with ULN, check that yum plugins are enabled and re-register the system with ULN.
On the system, edit the yum configuration file /etc/yum.conf file and enable yum plugins by setting plugins=1 .
Run the uln_register command.
Alternatively, if you use the GNOME graphical user desktop, select Applications , System Tools , and then ULN Registration .
When prompted, enter your ULN user name, password, and customer support identifier (CSI).
Copyright В© 2014, 2020, Oracle and/or its affiliates. Legal Notices
Источник
Установка нового ядра UEK на Oracle Linux 7.6 и активация I/O Scheduler mq-deadline или kyber
В последних версиях ядра Linux была проделана большая работа по решению проблемы работы дисковой подсистемы с новыми, быстрым блочным устройствам. С выходом Linux ядра версии 4.12 у пользователей появилась возможность использовать несколько новых планировщиков (I/O scheduler) для блочных устройств. Эти планировщики основаны на новом способе передачи запросов — multiqueue block layer (blk-mq).
В этой статье я не буду рассматривать особенности работы новых планировщиков, я лишь расскажу как их включить на Oracle Linux 7.6 с ядром UEK (Unbreakable Enterprise Kernel).
Исходные данные: ОС Oracle Linux 7.6 с ядром 3.10;
Задача: Установить ядра UEK и активация i/o планировщика mq-deadline или kyber
В блоге компании Selectel достаточно хорошо описаны новые планировщики, так что рекомендую всем ознакомиться с из статьей.
Так же на habr.ru недавно вышла статья «Последние изменения в IO-стеке Linux с точки зрения DBA», в ней тоже много полезной информации по IO-стеку в Linux и в частности про blk-mq.
Т.к. у нас установлено ядро 3.10, то новые планировщики нам недоступны. Нам необходимо более свежее Linux ядро, а именно 4.12 или новее. В расширенной сборке ядра Linux от Oracle — UEK (Unbreakable Enterprise Kernel) используется ядро версии 4.14, что вполне нас устроит.
1. Обновление Linux ядра до версии UEK
Проверим включен ли нужный нам репозитарий:
Нужный нам репозитарий ol7_UEKR5 включен.
Смотрим ограничение на одновременную установку нескольких ядер:
3 ядра нам может быть маловато, меняем на 10:
Смотрим наличие ядра UEK:
Установка ядра UEK:
Проверим наличие нового ядра
Проверим наличие в ядре включенной опции CONFIG_BLK_WBT_MQ:
Теперь поменяем I/O Scheduler, для этого в файле /etc/default/grub в параметр GRUB_CMDLINE_LINUX добавим:
Например у меня строка GRUB_CMDLINE_LINUX стала такой:
У Вас она будет другой, не копируйте мою! Но примерный вид опций Вы поняли какой.
Запишем изменения в загрузчик:
Теперь перезагрузим сервер:
При загрузке в GRUB у нас появится новое ядро, сервер должен загрузиться.
Проверим версию ядра:
Проверим наличие новых I/O Scheduler для диска /dev/sda:
Отлично! По-умолчанию активирован планировщик mq-deadline.
Теперь скорректируем некоторые параметры работы mq-deadline для SSD диска /dev/sda
ВНИМАНИЕ! Перед созданием файла /etc/udev/rules.d/60-schedulers.rules с опциями планировщика Вам нужно убедиться, что в каталоге /etc/udev/rules.d нет уже созданного ранее файла для других планировщиков, иначе в зависимости от последовательности применения файлов у Вас может быть не тот результат который Вы ожидаете. Так же Вам нужно убедиться, что Вы не задавали ранее тип планировщика через файл /etc/default/grub, где в строке GRUB_CMDLINE_LINUX можно указать опцию elevator=XXXXX
Обратите внимание, что в первой строке мы меняем 2 атрибута — /sys/block/sda/queue/rotational и /sys/block/sda/queue/scheduler
Изменение параметров строками ниже (queue/iosched/fifo_batch и т.д.) приведено в качестве примера, не копируйте мои значения если Вы не знаете их назначение.
Описание всех опций и их назначение для Deadline можно прочитать в официальной документации.
Для включения mq-deadline для всех постоянных SSD-дисков нужно поменять первую строку в /etc/udev/rules.d/60-schedulers.rules на
Если Вы хотите выбрать планировщик kyber для всех постоянных SSD-дисков, то выполните:
Описание всех опций и их назначение для Kyber можно прочитать в официальной документации.
После внесения изменений не забываем выполнить пару команд udevadm и проверить активацию выбранного планировщика для диска(ов):
На этом все, до скорых встреч. Если у Вас возникли вопросы или Вы хотите чтобы я помог Вам, то Вы всегда можете связаться со мной разными доступными способами.
Источник