RHEL 7 から RHEL 8 へのインプレースアップグレードをやってみた

記事タイトルとURLをコピーする

みなさん、こんにちは。AWS CLI が好きなテクニカルサポート課の市野です。

あれよあれよという間に RHEL7 の メンテナンスサポート2の終了が1年を切りました。(期限は 2024年6月30日 まで)

ELS により Red Hat Enterprise Linux サポートを延長することも可能ですが、4年間、かつ一回きりの制約もあり、恒久的に引き伸ばしを行えるわけではないため、やはり、どこかのタイミングで対応が迫られることは必至です。

www.redhat.com

RHEL 7 では、AWS を含むパブリッククラウドでも、インプレースアップグレードが行えるようになっているため、挙動や手順の確認も含め、検証を行ってみました。

公式ドキュメントでの言及

access.redhat.com

上記ページより抜粋

  • パブリッククラウド: インプレースアップグレードは、Red Hat Update Infrastructure (RHUI) を使用して Amazon Web Services (AWS)、Microsoft Azure、Google Cloud Platform のオンデマンドインスタンスでサポートされます。インプレースアップグレードは、RHEL サブスクリプションに Red Hat Subscription Manager (RHSM) を使用するすべてのパブリッククラウドの Bring Your Own Subscription インスタンスでもサポートされます。

検証の実施

1. 現状のバージョンチェック

cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.7 (Maipo)

2. RHEL7.9 までバージョンアップ & バージョンチェック

yum update -y
〜中略〜
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)

3. RHUI リポジトリーの有効化と必要な RHUI パッケージのインストール

yum-config-manager --enable rhui-client-config-server-7
yum-config-manager --enable rhel-7-server-rhui-extras-rpms
yum -y install rh-amazon-rhui-client leapp-rhui-aws

4. Leapp ユーティリティーのインストール

yum install leapp-upgrade

5. アップグレード前の事前確認

leapp preupgrade --no-rhsm

〜中略〜
============================================================
                     UPGRADE INHIBITED                      
============================================================

Upgrade has been inhibited due to the following problems:
    1. Inhibitor: Leapp detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed.
    2. Inhibitor: Possible problems with remote login using root account
    3. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.

============================================================
                     UPGRADE INHIBITED                      
============================================================


Debug output written to /var/log/leapp/leapp-preupgrade.log

============================================================
                           REPORT                           
============================================================

A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt

============================================================
                       END OF REPORT                        
============================================================

Answerfile has been generated at /var/log/leapp/answerfile

6. /var/log/leapp/leapp-report.txt の確認

less /var/log/leapp/leapp-report.txt


Risk Factor: high (inhibitor)
Title: Leapp detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed.
Summary: Support for the following RHEL 7 device drivers has been removed in RHEL 8:
     - pata_acpi

Key: f08a07da902958defa4f5c2699fae9ec2eb67c5b
----------------------------------------
Risk Factor: high (inhibitor)
Title: Possible problems with remote login using root account
Summary: OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file, which will default in RHEL8 to "prohibit-password".
Remediation: [hint] If you depend on remote root logins using passwords, consider setting up a different user for remote administration or adding "PermitRootLogin yes" to sshd_config. If this change is ok for you, add explicit "PermitRootLogin prohibit-password" to your sshd_config to ignore this inhibitor
Key: 3d21e8cc9e1c09dc60429de7716165787e99515f
----------------------------------------
Risk Factor: high (inhibitor)
Title: Missing required answers in the answer file
Summary: One or more sections in answerfile are missing user choices: remove_pam_pkcs11_module_check.confirm
For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section remove_pam_pkcs11_module_check.confirm=True
Key: d35f6c6b1b1fa6924ef442e3670d90fa92f0d54b
----------------------------------------
〜以下略〜
6-1. 阻害要因への対処(1 項め)

RHEL 8 で削除されているデバイスドライバーへの対処

modprobe -r pata_acpi
6-2. 阻害要因への対処(2 項め)

PermitRootLogin が sshd_config に記載されていないことに対する指摘となります。
PermitRootLogin のコメントアウトを外し、yes とします。

vi /etc/ssh/sshd_config

- #PermitRootLogin yes
+ PermitRootLogin yes

systemctl restart sshd
6-3. 阻害要因への対処(3 項め)

/var/log/leapp/answerfile への回答がないことへの対処が必要です。
confirm = のコメントアウトを外し、True を追記します。

vi /var/log/leapp/answerfile

- # confirm =
+ confirm = True

7. アップグレード前の事前確認(再チェック)

UPGRADE INHIBITED が表示されなくなることを確認します。

leapp preupgrade --no-rhsm

〜中略〜
============================================================
                           REPORT                           
============================================================

A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt

============================================================
                       END OF REPORT                        
============================================================

Answerfile has been generated at /var/log/leapp/answerfile

8. アップグレードの実施

leapp upgrade --no-rhsm

〜中略〜
Transaction Summary
========================================================================================================================================
Install    223 Packages
Upgrade    257 Packages
Remove      72 Packages
Downgrade    7 Packages

Total size: 671 M
DNF will only download packages, install gpg keys, and check the transaction.
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
====> * add_upgrade_boot_entry
        Add new boot entry for Leapp provided initramfs.
A reboot is required to continue. Please reboot your system.


Debug output written to /var/log/leapp/leapp-upgrade.log

============================================================
                           REPORT
============================================================

A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt

============================================================
                       END OF REPORT
============================================================

Answerfile has been generated at /var/log/leapp/answerfile

9. 再起動の実施

手順では、ここで再起動が求められ、再起動をしてアップグレードを適用する必要があります。

しかしながら、ここで再起動をすると、起動時にカーネルパニックが発生する状況に遭遇しています。(検証を3回実施して、3回とも遭遇している状況です。)

一度、インスタンスを完全に停止して、その後起動することで正しく RHEL 8 系として起動に成功することは確認しています。
(なお、レスキューインスタンスを作成し、カーネルパニックを起こした状態の EBS ボリュームをマウントして確認してみた感じでは、カーネルのインストールはされているが、initramfs img が正しく生成されていない状況に陥っているように見えています。)

9-1. 正しく起動した後にバージョンチェック
cat /etc/redhat-release
Red Hat Enterprise Linux release 8.8 (Ootpa)

まとめ

概ね公式ドキュメントで解説されている手順で、パブリッククラウドである AWS の EC2 インスタンスでも、RHEL7から RHEL8 へのインプレースアップグレードを行うことはできました。

しかし、インスタンスの停止→起動で正しく起動する状況と出来たとはいえ、leapp upgrade 実行後の再起動時にカーネルパニックが発生した状況がありましたので、実行計画を立案の際は、現用系のインスタンスのコピーを作成し入念なテストを行うなど、お使いの環境での試験の実施をいただく必要はあるかと思われました。

この記事が、どなたかのお役に立てば幸いです。

ではまた。

市野 和明 (記事一覧)

マネージドサービス部・テクニカルサポート課

お客様から寄せられたご質問や技術検証を通じて得られた気づきを投稿していきます。

情シスだった前職までの経験で、UI がコロコロ変わる AWS においては GUI で手順を残していると画面構成が変わってしまって後々まごつくことが多かった経験から、極力変わりにくい AWS CLI での記事が多めです。

X(Twitter):@kazzpapa3(AWS Community Builder)