Nel post precedente, abbiamo visto come aggiornare il sistema CentOS 8 / RHEL 8 per avere gli ultimi aggiornamenti sul tuo sistema. Raramente, gli aggiornamenti possono danneggiare il sistema o l'applicazione in esecuzione su di esso.
In questo caso, potrebbe essere necessario ripristinare la versione precedente dei pacchetti aggiornati.
In questo post, vedremo i passaggi per ripristinare le patch del sistema operativo su CentOS 8 / RHEL 8.
Cronologia degli aggiornamenti
Il comando yum history elencherà tutte le attività che hai svolto con il comando yum, inclusa la patch del sistema operativo.
yum history
Dall'output sopra, puoi vedere
ID 4 :Patch del sistema operativo (riga di comando:aggiornamento) come ha (I) nstal e (U) pdate azioni di 55 pacchetti.
ID 3 :Aggiornamento del kernel (riga di comando:update -y kernel) (I) nstal azione di 3 pacchetti
Puoi anche scoprire quali pacchetti sono stati aggiornati durante l'ID cronologia 4 o 3 con il comando seguente.
Sto controllando le informazioni dell'ID cronologia 3.
yum history info 3
Risultato:
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
Allo stesso modo, puoi vedere le informazioni di altri ID.
Ripristina aggiornamenti
Dopo aver identificato l'ID di patch del sistema operativo e l'ID di aggiornamento del kernel (facoltativo poiché la maggior parte delle volte il kernel aggiornato viene installato insieme all'applicazione di patch del sistema operativo), vai avanti per ripristinare l'aggiornamento uno per uno.
Kernel
Questo passaggio non è applicabile se il kernel è stato installato insieme alle patch del sistema operativo (yum update).
Usa l'annullamento della cronologia di yum con 3 per ripristinare le attività (rimuovere gli aggiornamenti del kernel).
yum history undo 3
Risultato:
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!
Pacchetti
Usa l'annullamento della cronologia di yum con 4 per ripristinare le attività (ripristinare gli aggiornamenti del sistema operativo).
yum history undo 4
Risultato:
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!
Riavvia il sistema.
reboot
Verifica
Kernel
Molto che il sistema sia avviato con il vecchio kernel usando il comando seguente.
uname -a
Risultato:
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
Pacchetti
Confronta la versione del pacchetto e assicurati che venga eseguito il downgrade dei pacchetti con rpm -qa
Conclusione
È tutto. Spero che questo post ti abbia aiutato a ripristinare le patch del sistema operativo su CentOS 8 / RHEL 8. Condividi il tuo feedback nella sezione commenti.