CentOS の yum で再起動が必要なパッケージを除外する

スポンサーリンク
スポンサーリンク

CentOS の yum で、再起動が必要なパッケージを除外する方法です。

CentOS のパッケージアップデートで再起動が必要かチェックする方法で、パッケージアップデートで再起動が必要かチェックするコマンド needs-restarting を紹介しました。

この needs-restarting は、再起動が必要かのチェックは、ソースコード によると、更新パッケージ名に次を含むものが含まれるかをチェックしています。

‘kernel’, ‘kernel-rt’, ‘glibc’, ‘linux-firmware’, ‘systemd’,’udev’, ‘openssl-libs’, ‘gnutls’, ‘dbus’

これらのパッケージ名は、Red Hat の次の記事(要RedHatアカウント)を元にしているようです。

Which packages require a system reboot after the update? – Red Hat Customer Portal

そこで、yum で除外パッケージを指定する excludeオプションで、これらのパッケージを指定することで、再起動が必要なパッケージを除外できます。
次のように指定します。

yum --exclude="kernel* kernel-rt* glibc* linux-firmware* systemd* udev* openssl-libs* gnutls* dbus*" update

ただし、除外パッケージを指定していると、それに依存するパッケージの更新がある場合、エラーになります。

以下の例では、systemd-libs に依存している libgudevパッケージが更新できません。

エラー: パッケージ: libgudev1-219-78.el7_9.2.x86_64 (updates)
             要求: systemd-libs = 219-78.el7_9.2
            インストール: systemd-libs-219-73.el7_8.9.i686 (@updates)
                systemd-libs = 219-73.el7_8.9

以下の例では、openssl-libs に依存している opensslパッケージが更新できません。

# yum --exclude="exclude=kernel* kernel-rt* glibc* linux-firmware* systemd* udev* openssl-libs* gnutls* dbus*" update
Last metadata expiration check: 1:45:45 ago on Sun 13 Dec 2020 11:33:42 AM JST.
Error:
 Problem 1: package openssl-1:1.1.1g-11.el8.x86_64 requires openssl-libs(x86-64) = 1:1.1.1g-11.el8, but none of the providers can be installed
  - cannot install the best update candidate for package openssl-1:1.1.1c-15.el8.x86_64
  - package openssl-libs-1:1.1.1g-11.el8.x86_64 is filtered out by exclude filtering
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

このような場合は、通常通り excelude を指定せずに yum を実行したほうがいいですね。

コメント

タイトルとURLをコピーしました