GNU/Linux >> Linux の 問題 >  >> Cent OS

CentOS 8 /RHEL8でOSのパッチを元に戻す方法

前回の投稿では、CentOS 8 / RHEL 8システムを更新して、システムに最新の更新を適用する方法を説明しました。まれに、更新によって、その上で実行されているシステムまたはアプリケーションが破損する場合があります。

この場合、更新されたパッケージを以前のバージョンに戻す必要がある場合があります。

この投稿では、CentOS 8 /RHEL8でOSのパッチを元に戻す手順を説明します。

更新履歴

yum historyコマンドは、OSパッチを含む、yumコマンドで実行したすべてのアクティビティを一覧表示します。

yum history

上記の出力から、次のことがわかります

ID 4 OSパッチ(コマンドライン:更新)(I) nstall および(U) 55個のパッケージのpdateアクション。

ID 3 カーネルの更新(コマンドライン:update -y kernel)(I) nstall3つのパッケージのアクション

以下のコマンドを使用して、履歴ID4または3の間にパッケージが更新されたものを確認することもできます。

履歴ID3の情報を確認しています。

yum history info 3

出力:

Transaction ID : 3
Begin time     : Wed 23 Oct 2019 04:50:02 AM EDT
Begin rpmdb    : 390:36e45bfafdb36c1b565f744db484c136e60d027c
End time       : Wed 23 Oct 2019 04:52:29 AM EDT (147 seconds)
End rpmdb      : 393:2dbf7c6498447e95a25b76af117b689bccd11b20
User           : root 
Return-Code    : Success
Releasever     : 8
Command Line   : update -y kernel
Packages Altered:
    Install kernel-4.18.0-80.11.2.el8_0.x86_64         @BaseOS
    Install kernel-core-4.18.0-80.11.2.el8_0.x86_64    @BaseOS
    Install kernel-modules-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
[root@centos8 ~]# yum history info 4
Transaction ID : 4
Begin time     : Wed 23 Oct 2019 04:57:30 AM EDT
Begin rpmdb    : 393:2dbf7c6498447e95a25b76af117b689bccd11b20
End time       : Wed 23 Oct 2019 05:02:37 AM EDT (5 minutes)
End rpmdb      : 394:2263176203aedb3134fb7478167919e2cb60450b
User           : root 
Return-Code    : Success
Releasever     : 8
Command Line   : update
Packages Altered:
    Install  grub2-tools-efi-1:2.02-66.el8_0.1.x86_64            @BaseOS
    Upgrade  bash-4.4.19-8.el8_0.x86_64                          @BaseOS
    Upgraded bash-4.4.19-7.el8.x86_64                            @@System
    Upgrade  bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64     @BaseOS
    Upgraded bind-export-libs-32:9.11.4-16.P2.el8.x86_64         @@System
    Upgrade  grub2-common-1:2.02-66.el8_0.1.noarch               @BaseOS
    Upgraded grub2-common-1:2.02-66.el8.noarch                   @@System

.     .     .
.     .     .

    Upgrade  sssd-nfs-idmap-2.0.0-43.el8_0.3.x86_64              @BaseOS
    Upgraded sssd-nfs-idmap-2.0.0-43.el8.x86_64                  @@System
    Upgrade  systemd-239-13.el8_0.5.x86_64                       @BaseOS
    Upgraded systemd-239-13.el8.x86_64                           @@System
    Upgrade  systemd-libs-239-13.el8_0.5.x86_64                  @BaseOS
    Upgraded systemd-libs-239-13.el8.x86_64                      @@System
    Upgrade  systemd-pam-239-13.el8_0.5.x86_64                   @BaseOS
    Upgraded systemd-pam-239-13.el8.x86_64                       @@System
    Upgrade  systemd-udev-239-13.el8_0.5.x86_64                  @BaseOS
    Upgraded systemd-udev-239-13.el8.x86_64                      @@System
    Upgrade  epel-release-8-6.el8.noarch                         @epel
    Upgraded epel-release-8-5.el8.noarch                         @@System
Scriptlet output:
   1 warning: /etc/shadow created as /etc/shadow.rpmnew

同様に、他のIDの情報を見ることができます。

更新を元に戻す

OSパッチIDとカーネルアップデートIDを特定したら(ほとんどの場合、アップデートされたカーネルはOSパッチとともにインストールされるため、オプションです)、アップデートを1つずつ元に戻してください。

カーネル

カーネルがOSパッチ(yum update)と一緒にインストールされた場合、この手順は適用されません。

yum history undoを3で使用して、アクティビティを元に戻します(カーネルの更新を削除します)。

yum history undo 3

出力:

Last metadata expiration check: 1:24:58 ago on Wed 23 Oct 2019 05:19:07 AM EDT.
Undoing transaction 3, from Wed 23 Oct 2019 04:50:02 AM EDT
    Install kernel-4.18.0-80.11.2.el8_0.x86_64         @BaseOS
    Install kernel-core-4.18.0-80.11.2.el8_0.x86_64    @BaseOS
    Install kernel-modules-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Dependencies resolved.
============================================================================================================================
 Package                        Arch                   Version                                Repository               Size
============================================================================================================================
Removing:
 kernel                         x86_64                 4.18.0-80.11.2.el8_0                   @BaseOS                   0
 kernel-core                    x86_64                 4.18.0-80.11.2.el8_0                   @BaseOS                  57 M
 kernel-modules                 x86_64                 4.18.0-80.11.2.el8_0                   @BaseOS                  19 M

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

Freed space: 76 M
Is this ok [y/N]: Y  << Press Y and Enter to revert Kernel
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                    1/1
  Erasing          : kernel-4.18.0-80.11.2.el8_0.x86_64                                                                 1/3
  Running scriptlet: kernel-4.18.0-80.11.2.el8_0.x86_64                                                                 1/3
  Erasing          : kernel-modules-4.18.0-80.11.2.el8_0.x86_64                                                         2/3
  Running scriptlet: kernel-modules-4.18.0-80.11.2.el8_0.x86_64                                                         2/3
  Running scriptlet: kernel-core-4.18.0-80.11.2.el8_0.x86_64                                                            3/3
  Erasing          : kernel-core-4.18.0-80.11.2.el8_0.x86_64                                                            3/3
  Running scriptlet: kernel-core-4.18.0-80.11.2.el8_0.x86_64                                                            3/3
  Verifying        : kernel-4.18.0-80.11.2.el8_0.x86_64                                                                 1/3
  Verifying        : kernel-core-4.18.0-80.11.2.el8_0.x86_64                                                            2/3
  Verifying        : kernel-modules-4.18.0-80.11.2.el8_0.x86_64                                                         3/3

Removed:
  kernel-4.18.0-80.11.2.el8_0.x86_64  kernel-core-4.18.0-80.11.2.el8_0.x86_64  kernel-modules-4.18.0-80.11.2.el8_0.x86_64

Complete!

パッケージ

yum history undoを4で使用して、アクティビティを元に戻します(OSアップデートを元に戻します)。

yum history undo 4

出力:

Last metadata expiration check: 1:38:10 ago on Wed 23 Oct 2019 05:19:07 AM EDT.
Undoing transaction 4, from Wed 23 Oct 2019 04:57:30 AM EDT
    Install  grub2-tools-efi-1:2.02-66.el8_0.1.x86_64            @BaseOS
    Upgrade  bash-4.4.19-8.el8_0.x86_64                          @BaseOS
    Upgraded bash-4.4.19-7.el8.x86_64                            @@System
    Upgrade  bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64     @BaseOS
    Upgraded bind-export-libs-32:9.11.4-16.P2.el8.x86_64         @@System
    Upgrade  grub2-common-1:2.02-66.el8_0.1.noarch               @BaseOS
    Upgraded grub2-common-1:2.02-66.el8.noarch                   @@System
    Upgrade  grub2-pc-1:2.02-66.el8_0.1.x86_64                   @BaseOS
    Upgraded grub2-pc-1:2.02-66.el8.x86_64                       @@System
    Upgrade  grub2-pc-modules-1:2.02-66.el8_0.1.noarch           @BaseOS

.     .     .
.     .     .

    Upgrade  epel-release-8-6.el8.noarch                         @epel
    Upgraded epel-release-8-5.el8.noarch                         @@System
Dependencies resolved.
============================================================================================================================
 Package                                 Arch                Version                             Repository            Size
============================================================================================================================
Removing:
 grub2-tools-efi                         x86_64              1:2.02-66.el8_0.1                   @BaseOS              1.9 M
Downgrading:
 bash                                    x86_64              4.4.19-7.el8                        BaseOS               1.5 M
 bind-export-libs                        x86_64              32:9.11.4-16.P2.el8                 BaseOS               1.1 M
 grub2-common                            noarch              1:2.02-66.el8                       BaseOS               880 k
 grub2-pc                                x86_64              1:2.02-66.el8                       BaseOS                35 k
 grub2-pc-modules                        noarch              1:2.02-66.el8                       BaseOS               899 k

.     .     .
.     .     .

 systemd                                 x86_64              239-13.el8                          BaseOS               3.4 M
 systemd-libs                            x86_64              239-13.el8                          BaseOS               550 k
 systemd-pam                             x86_64              239-13.el8                          BaseOS               221 k
 systemd-udev                            x86_64              239-13.el8                          BaseOS               1.3 M
 epel-release                            noarch              8-5.el8                             extras                22 k

Transaction Summary
============================================================================================================================
Remove      1 Package
Downgrade  50 Packages

Total download size: 46 M
Is this ok [y/N]: Y  << Press Y and Enter to Revert Updates
Downloading Packages:
(1/50): bash-4.4.19-7.el8.x86_64.rpm                                                        966 kB/s | 1.5 MB     00:01
(2/50): grub2-common-2.02-66.el8.noarch.rpm                                                 530 kB/s | 880 kB     00:01
(3/50): grub2-pc-2.02-66.el8.x86_64.rpm                                                     537 kB/s |  35 kB     00:00
(4/50): bind-export-libs-9.11.4-16.P2.el8.x86_64.rpm                                        640 kB/s | 1.1 MB     00:01
(5/50): grub2-tools-2.02-66.el8.x86_64.rpm                                                  3.7 MB/s | 1.9 MB     00:00
(6/50): grub2-pc-modules-2.02-66.el8.noarch.rpm                                             1.4 MB/s | 899 kB     00:00
(7/50): grub2-tools-minimal-2.02-66.el8.x86_64.rpm                                          2.0 MB/s | 196 kB     00:00

.     .     .
.     .     .

(46/50): systemd-pam-239-13.el8.x86_64.rpm                                                  1.6 MB/s | 221 kB     00:00
(47/50): selinux-policy-targeted-3.14.1-61.el8.noarch.rpm                                   3.7 MB/s |  15 MB     00:04
(48/50): python3-libs-3.6.8-1.el8.0.1.x86_64.rpm                                            1.6 MB/s | 7.9 MB     00:04
(49/50): systemd-udev-239-13.el8.x86_64.rpm                                                 1.7 MB/s | 1.3 MB     00:00
(50/50): epel-release-8-5.el8.noarch.rpm                                                     77 kB/s |  22 kB     00:00
----------------------------------------------------------------------------------------------------------------------------
Total                                                                                       4.1 MB/s |  46 MB     00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                    1/1
  Running scriptlet: bash-4.4.19-7.el8.x86_64                                                                           1/1
  Downgrading      : bash-4.4.19-7.el8.x86_64                                                                         1/101
  Running scriptlet: bash-4.4.19-7.el8.x86_64                                                                         1/101
  Downgrading      : platform-python-3.6.8-1.el8.0.1.x86_64                                                           2/101
  Running scriptlet: platform-python-3.6.8-1.el8.0.1.x86_64                                                           2/101
  Downgrading      : python3-libs-3.6.8-1.el8.0.1.x86_64                                                              3/101
  Downgrading      : grub2-common-1:2.02-66.el8.noarch                                                                4/101

.     .     .
.     .     .

  Verifying        : epel-release-8-5.el8.noarch                                                                     99/101
  Verifying        : epel-release-8-6.el8.noarch                                                                    100/101
  Verifying        : grub2-tools-efi-1:2.02-66.el8_0.1.x86_64                                                       101/101

Downgraded:
  bash-4.4.19-7.el8.x86_64                                 bind-export-libs-32:9.11.4-16.P2.el8.x86_64
  grub2-common-1:2.02-66.el8.noarch                        grub2-pc-1:2.02-66.el8.x86_64
  grub2-pc-modules-1:2.02-66.el8.noarch                    grub2-tools-1:2.02-66.el8.x86_64
  grub2-tools-extra-1:2.02-66.el8.x86_64                   grub2-tools-minimal-1:2.02-66.el8.x86_64
  initscripts-10.00.1-1.el8.x86_64                         iptables-1.8.2-9.el8.x86_64
  iptables-ebtables-1.8.2-9.el8.x86_64                     iptables-libs-1.8.2-9.el8.x86_64
  kernel-tools-4.18.0-80.el8.x86_64                        kernel-tools-libs-4.18.0-80.el8.x86_64
  kmod-25-11.el8.x86_64                                    kmod-libs-25-11.el8.x86_64
  kpartx-0.7.8-7.el8.x86_64                                libdnf-0.22.5-4.el8.x86_64
  libnfsidmap-1:2.3.3-14.el8.x86_64                        libsss_autofs-2.0.0-43.el8.x86_64
  libsss_certmap-2.0.0-43.el8.x86_64                       libsss_idmap-2.0.0-43.el8.x86_64
  libsss_nss_idmap-2.0.0-43.el8.x86_64                     libsss_sudo-2.0.0-43.el8.x86_64
  microcode_ctl-4:20180807a-2.el8.x86_64                   p11-kit-0.23.14-4.el8.x86_64
  p11-kit-trust-0.23.14-4.el8.x86_64                       platform-python-3.6.8-1.el8.0.1.x86_64
  python3-hawkey-0.22.5-4.el8.x86_64                       python3-libdnf-0.22.5-4.el8.x86_64
  python3-libs-3.6.8-1.el8.0.1.x86_64                      python3-perf-4.18.0-80.el8.x86_64
  python3-rpm-4.14.2-9.el8.x86_64                          rpm-4.14.2-9.el8.x86_64
  rpm-build-libs-4.14.2-9.el8.x86_64                       rpm-libs-4.14.2-9.el8.x86_64
  rpm-plugin-selinux-4.14.2-9.el8.x86_64                   rpm-plugin-systemd-inhibit-4.14.2-9.el8.x86_64
  selinux-policy-3.14.1-61.el8.noarch                      selinux-policy-targeted-3.14.1-61.el8.noarch
  setup-2.12.2-1.el8.noarch                                sssd-client-2.0.0-43.el8.x86_64
  sssd-common-2.0.0-43.el8.x86_64                          sssd-kcm-2.0.0-43.el8.x86_64
  sssd-nfs-idmap-2.0.0-43.el8.x86_64                       systemd-239-13.el8.x86_64
  systemd-libs-239-13.el8.x86_64                           systemd-pam-239-13.el8.x86_64
  systemd-udev-239-13.el8.x86_64                           epel-release-8-5.el8.noarch

Removed:
  grub2-tools-efi-1:2.02-66.el8_0.1.x86_64

Complete!

システムを再起動します。

reboot

確認

カーネル

以下のコマンドを使用して、システムが古いカーネルで起動されていることを確認してください。

uname -a

出力:

Linux centos8.itzgeek.local 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

パッケージ

パッケージのバージョンを比較し、rpm-qaでパッケージがダウングレードされていることを確認します。

結論

それで全部です。この投稿が、CentOS 8 /RHEL8のOSパッチを元に戻すのに役立つことを願っています。コメントセクションでフィードバックを共有してください。


Cent OS
  1. RHEL 8 /CentOS8にphpMyAdminをインストールする方法

  2. RHEL 8 /CentOS8にP7Zipをインストールする方法

  3. CentOS 6 / RHEL 6(x86_64)にVMwareWorkstation8をインストールする方法

  1. RHEL 8 /CentOS8にntfs-3gをインストールする方法

  2. PHP-mbstringをRHEL8/CentOS8にインストールする方法

  3. RHEL 8 /CentOS8にphantomjsをインストールする方法

  1. DropboxをRHEL8/CentOS8にインストールする方法

  2. RHEL 8 /CentOS8にコンパスをインストールする方法

  3. RHEL 8 /CentOS8にPuppetをインストールする方法