CentOS 8.4 から RockyLinux 8.4への移行

ついに、RockyLinux がGAとなったので、VMware環境で移行を試してみた。

環境

$ cat /etc/redhat-release
CentOS Linux release 8.4.2105

※VMware ESXi 7.0 上の仮想マシン
 ファームウェア:EFI(推奨)
 セキュアブート:有効

移行手順

以下に移行スクリプトがある。
GitHub - rocky-linux/rocky-tools


移行スクリプトを入手

# wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh

実行権を与えて実行

# chmod +x migrate2rocky.sh
# bash migrate2rocky.sh -r

EFI Secure Boot is enabled but Rocky Linux doesn't provide a signed shim yet. Disable EFI Secure Boot and reboot.

An error occurred while we were attempting to convert your system to Rocky Linux. Your system may be unstable. Script will now exit to prevent possible damage.

 A log of this installation can be found at /var/log/migrate2rocky.log

エラーが出た。
意訳すると、「EFIセキュアブートが有効になっているが、Rocky Linuxはまだsigned shimを提供していないので無効化して」とのこと。

表示されているが、/var/log/migrate2rocky.log には、上記と同じメッセージが記録されている。

なお、-r オプションを忘れると、上記のEFIの問題とは関係なく、Usageが表示される。

# bash migrate2rocky.sh
Usage: migrate2rocky.sh [OPTIONS]

Options:
-h Display this help
-r Convert to rocky
-V Verify switch
   !! USE WITH CAUTION !!


仮想マシンを停止してから、
仮想マシン→設定の編集→仮想マシンオプション→起動オプション にて、「セキュアブート」を有効→無効へ変更する。(画像の真ん中あたりのチェックを外す)


なお、ここで勢い余ってEFI(推奨)→BIOS へ変更すると、
 「ファームウェアを変更すると、インストールされているゲスト OS を
  起動できなくなる場合があります。」
とVMwareで警告されるが、そのまま続行するとOSが起動しなくなるので注意。
(EFIに戻せば、起動するように戻った)


セキュアブートを無効化した後、仮想マシンを起動して、再び移行スクリプトを実行。

# bash migrate2rocky.sh -r
Preparing to migrate CentOS Linux 8 to Rocky Linux 8.

Determining repository names for CentOS Linux 8.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8


Found the following repositories which map from CentOS Linux 8 to Rocky Linux 8:
CentOS Linux 8  Rocky Linux 8
appstream       appstream
baseos          baseos
extras          extras

Getting system package names for CentOS Linux 8Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8
.Failed to set locale, defaulting to C.UTF-8


Found the following system packages which map from CentOS Linux 8 to Rocky Linux 8:
CentOS Linux 8        Rocky Linux 8
centos-backgrounds    rocky-backgrounds
centos-gpg-keys       rocky-gpg-keys
centos-logos          rocky-logos
centos-indexhtml      rocky-indexhtml
centos-linux-release  rocky-release
centos-logos-httpd    rocky-logos-httpd
centos-linux-repos    rocky-repos

Getting list of installed system packages.

We will replace the following CentOS Linux 8 packages with their Rocky Linux 8 equivalents
Packages to be Removed  Packages to be Installed
centos-gpg-keys         rocky-gpg-keys
centos-linux-release    rocky-release
centos-linux-repos      rocky-repos

Getting a list of enabled modules for the system repositories.

In addition to the above the following system packages will be removed:
centos-linux-release
centos-linux-release
Failed to set locale, defaulting to C.UTF-8

Excluding modules:
libselinux-python:2.8

Found the following modules to re-enable at completion:

Running dnf update before we attempt the migration.
Last metadata expiration check: 1:53:41 ago on Fri Jul  2 08:23:50 2021.
Dependencies resolved.
Nothing to do.
Complete!
Failed to set locale, defaulting to C.UTF-8
Added rockyappstream repo from https://dl.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/
Added rockybaseos repo from https://dl.rockylinux.org/pub/rocky/8/BaseOS/x86_64/os/
rockyappstream                                  4.2 MB/s | 7.1 MB     00:01
rockybaseos                                     3.8 MB/s | 2.5 MB     00:00
Failed to set locale, defaulting to C.UTF-8
> > > ================================================================================
 Package                  Arch       Version              Repository       Size
================================================================================
Installing:
 rocky-gpg-keys           noarch     8.4-26.el8           rockybaseos      11 k
 rocky-release            noarch     8.4-26.el8           rockybaseos      19 k
 rocky-repos              noarch     8.4-26.el8           rockybaseos      12 k
Removing:
 centos-gpg-keys          noarch     1:8-2.el8            @anaconda       3.3 k
 centos-linux-release     noarch     8.4-1.2105.el8       @baseos          25 k
 centos-linux-repos       noarch     8-2.el8              @anaconda        26 k

Transaction Summary
================================================================================
Install  3 Packages
Remove   3 Packages

Total download size: 43 k
Downloading Packages:
(1/3): rocky-gpg-keys-8.4-26.el8.noarch.rpm     163 kB/s |  11 kB     00:00
(2/3): rocky-release-8.4-26.el8.noarch.rpm      242 kB/s |  19 kB     00:00
(3/3): rocky-repos-8.4-26.el8.noarch.rpm        149 kB/s |  12 kB     00:00
--------------------------------------------------------------------------------
Total                                           491 kB/s |  43 kB     00:00
warning: /var/cache/dnf/rockybaseos-56e41edc159a87c2/packages/rocky-gpg-keys-8.4-26.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 6d745a60: NOKEY
rockybaseos                                     1.6 MB/s | 1.6 kB     00:00
Importing GPG key 0x6D745A60:
 Userid     : "Release Engineering <[email protected]>"
 Fingerprint: 7051 C470 A929 F454 CEBE 37B7 15AF 5DAC 6D74 5A60
 From       : /tmp/tmp.PoBnAwBzcP/gpg/RPM-GPG-KEY-rockyofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: rocky-gpg-keys-8.4-26.el8.noarch                       1/1
  Installing       : rocky-gpg-keys-8.4-26.el8.noarch                       1/6
・・・省略
Complete!
Failed to set locale, defaulting to C.UTF-8
Generating grub configuration file ...
Adding boot menu entry for EFI firmware configuration
done
BootCurrent: 0003
BootOrder: 0004,0003,0000,0001,0002
Boot0000* EFI Virtual disk (0.0)
Boot0001* EFI VMware Virtual SATA CDROM Drive (0.0)
Boot0002* EFI Network
Boot0003* CentOS Linux
Boot0004* Rocky Linux

Done, please reboot your system.
A log of this installation can be found at /var/log/migrate2rocky.log

ログは、/var/log/migrate2rocky.log に保存される。

OSを再起動する

# reboot

OS起動時のカーネル選択画面にて、Rocky Linuxのものが選択されているか確認する。
見逃した場合、以下で確認

# grubby --info DEFAULT | grep title
title="Rocky Linux (4.18.0-305.3.1.el8_4.x86_64) 8.4 (Green Obsidian)"

OS情報のファイルが、AlmaLinuxに変わっているか確認

# cat /etc/redhat-release
Rocky Linux release 8.4 (Green Obsidian)

リポジトリもRocky Linuxになっている

# ls /etc/yum.repos.d/
Rocky-AppStream.repo  Rocky-Devel.repo   Rocky-HighAvailability.repo  
Rocky-Plus.repo        Rocky-RT.repo                Rocky-Sources.repo
Rocky-BaseOS.repo     Rocky-Extras.repo  Rocky-Media.repo             
Rocky-PowerTools.repo  Rocky-ResilientStorage.repo


CentOS→AlmaLinuxへの移行に関する記事はコチラ
shobon.hatenablog.com