SIer だけど技術やりたいブログ

Rocky9 で kernel-debuginfo がインストールできない

linux

起きたこと

Rocky9 で kernel-debuginfo をインストールしようとしたが、次のエラーが発生した。

$ sudo debuginfo-install kernel
Rocky Linux 9 - BaseOS                                                                       18 kB/s | 4.1 kB     00:00
Rocky Linux 9 - AppStream                                                                    27 kB/s | 4.5 kB     00:00
Could not find debuginfo package for the following installed packages: kernel-5.14.0-284.18.1.el9_2.x86_64
Could not find debugsource package for the following installed packages: kernel-5.14.0-284.18.1.el9_2.x86_64
Dependencies resolved.
Nothing to do.
Complete!

現時点の最新のカーネルバージョンなので Rocky のリポジトリにも debuginfo が存在するはず。

$ uname -a
Linux ip-172-31-88-78.ec2.internal 5.14.0-284.18.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 22 17:36:46 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

リポジトリを確認すると、debug 系が無効になってた。

$ yum repolist all
repo id                        repo name                                                                            status
appstream                      Rocky Linux 9 - AppStream                                                            enabled
appstream-debug                Rocky Linux 9 - AppStream - Debug                                                    disabled
appstream-source               Rocky Linux 9 - AppStream - Source                                                   disabled
baseos                         Rocky Linux 9 - BaseOS                                                               enabled
baseos-debug                   Rocky Linux 9 - BaseOS - Debug                                                       disabled
baseos-source                  Rocky Linux 9 - BaseOS - Source                                                      disabled
crb                            Rocky Linux 9 - CRB                                                                  disabled
crb-debug                      Rocky Linux 9 - CRB - Debug                                                          disabled
crb-source                     Rocky Linux 9 - CRB - Source                                                         disabled
devel                          Rocky Linux 9 - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED               disabled
devel-debug                    Rocky Linux 9 - Devel Debug WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED         disabled
devel-source                   Rocky Linux 9 - Devel Source WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED        disabled
extras                         Rocky Linux 9 - Extras                                                               enabled
extras-debug                   Rocky Linux 9 - Extras Debug                                                         disabled
extras-source                  Rocky Linux 9 - Extras Source                                                        disabled

あれ debuginfo-install って debug 系リポジトリを有効にしてくれるんじゃなかったっけと思いながらも baseos-debug を有効にしたが、それでもインストールできない。

$ sudo yum-config-manager --set-enabled baseos-debug

$ sudo debuginfo-install kernel
Last metadata expiration check: 0:03:40 ago on Tue Jul 18 11:54:20 2023.
Could not find debuginfo package for the following installed packages: kernel-5.14.0-284.11.1.el9_2.x86_64
Could not find debugsource package for the following installed packages: kernel-5.14.0-284.11.1.el9_2.x86_64
Dependencies resolved.
Nothing to do.
Complete!

解決方法

baseos-debug のほかに、devel リポジトリも有効にすると、kernel-debuginfo がインストールできる。

$ sudo yum-config-manager --set-enabled baseos-debug,devel

$ sudo debuginfo-install kernel
Rocky Linux 9 - BaseOS                                                                       36 kB/s | 4.1 kB     00:00
Rocky Linux 9 - BaseOS - Debug                                                               17 kB/s | 2.9 kB     00:00
Rocky Linux 9 - AppStream                                                                    13 kB/s | 4.5 kB     00:00
Rocky Linux 9 - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED                       27 kB/s | 3.4 kB     00:00
Could not find debugsource package for the following installed packages: kernel-5.14.0-284.18.1.el9_2.x86_64
Dependencies resolved.
============================================================================================================================
 Package                                   Architecture      Version                          Repository               Size
============================================================================================================================
Installing:
 kernel-debuginfo                          x86_64            5.14.0-284.18.1.el9_2            baseos-debug            572 M
Installing dependencies:
 kernel-debuginfo-common-x86_64            x86_64            5.14.0-284.18.1.el9_2            devel                    70 M

Transaction Summary
============================================================================================================================
Install  2 Packages

Total download size: 642 M
Installed size: 2.8 G
Is this ok [y/N]: y
Downloading Packages:
...

原因を調べる

baseos-debug 有効化したときの yum コマンドで詳細を見てみると、 nothing provides kernel-debuginfo-common-x86_64 が見つからず、エラーが発生していた。

$ sudo yum install -y kernel-debuginfo
Rocky Linux 9 - BaseOS                                                                       23 kB/s | 4.1 kB     00:00
Rocky Linux 9 - BaseOS - Debug                                                               12 kB/s | 2.9 kB     00:00
Rocky Linux 9 - AppStream                                                                    25 kB/s | 4.5 kB     00:00
Rocky Linux 9 - AppStream - Debug                                                           4.6 MB/s | 3.8 MB     00:00
Error:
 Problem: conflicting requests
  - nothing provides kernel-debuginfo-common-x86_64 = 5.14.0-284.18.1.el9_2 needed by kernel-debuginfo-5.14.0-284.18.1.el9_2.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

全リポジトリを有効にして kernel-debuginfo-common を検索すると、devel リポジトリに存在することが分かった。

$ yum search --enablerepo="*" kernel-debuginfo-common
Rocky Linux 9 - BaseOS - Debug                                                              1.9 MB/s | 854 kB     00:00
Rocky Linux 9 - BaseOS - Source                                                             1.4 MB/s | 242 kB     00:00
Rocky Linux 9 - AppStream - Debug                                                            10 MB/s | 3.8 MB     00:00
Rocky Linux 9 - AppStream - Source                                                          817 kB/s | 933 kB     00:01
Rocky Linux 9 - CRB                                                                         1.1 MB/s | 2.2 MB     00:01
Rocky Linux 9 - CRB - Debug                                                                 2.5 MB/s | 487 kB     00:00
Rocky Linux 9 - CRB - Source                                                                468 kB/s | 423 kB     00:00
Rocky Linux 9 - High Availability                                                           476 kB/s | 245 kB     00:00
Rocky Linux 9 - High Availability - Debug                                                    46 kB/s |  19 kB     00:00
Rocky Linux 9 - High Availability - Source                                                   34 kB/s |  10 kB     00:00
Rocky Linux 9 - Resilient Storage                                                           452 kB/s | 251 kB     00:00
Rocky Linux 9 - Resilient Storage - Debug                                                    54 kB/s |  22 kB     00:00
Rocky Linux 9 - Resilient Storage - Source                                                   87 kB/s |  12 kB     00:00
Rocky Linux 9 - NFV                                                                         4.6 MB/s | 987 kB     00:00
Rocky Linux 9 - NFV Debug                                                                   347 kB/s | 158 kB     00:00
Rocky Linux 9 - NFV Source                                                                   30 kB/s | 4.3 kB     00:00
Rocky Linux 9 - Realtime                                                                    4.0 MB/s | 974 kB     00:00
Rocky Linux 9 - Realtime Debug                                                              871 kB/s | 158 kB     00:00
Rocky Linux 9 - Realtime Source                                                              35 kB/s | 4.3 kB     00:00
Rocky Linux 9 - SAP                                                                          29 kB/s | 8.4 kB     00:00
Rocky Linux 9 - SAP Debug                                                                    26 kB/s | 5.9 kB     00:00
Rocky Linux 9 - SAP Source                                                                  6.8 kB/s | 4.5 kB     00:00
Rocky Linux 9 - SAPHANA                                                                      82 kB/s |  12 kB     00:00
Rocky Linux 9 - SAPHANA Debug                                                               8.8 kB/s | 5.3 kB     00:00
Rocky Linux 9 - SAPHANA Source                                                              8.2 kB/s | 4.4 kB     00:00
Rocky Linux 9 - Devel Source WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED               5.6 MB/s | 1.3 MB     00:00
Rocky Linux 9 - Extras Debug                                                                1.2 kB/s | 174  B     00:00
Rocky Linux 9 - Extras Source                                                                55 kB/s | 9.3 kB     00:00
Rocky Linux 9 - Plus                                                                         12 kB/s | 4.5 kB     00:00
Rocky Linux 9 - Plus - Debug                                                                 25 kB/s | 3.5 kB     00:00
Rocky Linux 9 - Plus - Source                                                                15 kB/s | 2.4 kB     00:00
========================================== Name Matched: kernel-debuginfo-common ===========================================
kernel-debuginfo-common-x86_64.x86_64 : Kernel source files used by kernel-debuginfo packages


$ yum info --enablerepo="*" kernel-debuginfo-common-x86_64.x86_64
Last metadata expiration check: 0:00:26 ago on Tue Jul 18 12:09:06 2023.
Available Packages
Name         : kernel-debuginfo-common-x86_64
Version      : 5.14.0
Release      : 284.18.1.el9_2
Architecture : x86_64
Size         : 70 M
Source       : kernel-5.14.0-284.18.1.el9_2.src.rpm
Repository   : devel
Summary      : Kernel source files used by kernel-debuginfo packages
URL          : https://www.kernel.org/
License      : GPLv2 and Redistributable, no modification permitted
Description  : This package is required by kernel-debuginfo subpackages.
             : It provides the kernel source files common to all builds.

ということで、baseos-debug のほかに、devel リポジトリも有効にする必要があった。

ちなみに RHEL は kernel-debuginfo-common は rhel-9-for-x86_64-baseos-beta-debug-rpms リポジトリにある(Rocky でいう baseos-debug っぽい)が、Rocky では devel にあるらしい。そのうち変わりそうな感じのコメントがフォーラムに上がってた。

Rocky 9.1 (Blue Onyx) - Missing kernel-debuginfo-common-x86_64