Linux 记一次yum history undo回退
- 1.故障现象:
通过ssh连接始终报密码错,修改密码故障依旧。
- 2.故障起因:
同事安装监控软件时,在centos6上误用centos7版本的源安装了libtirpc。
- 3.系统版本:
该服务器是非生产环境nfs备份。
操作系统版本:
[root@backup-server-nfs backup]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@backup-server-nfs backup]# uname -a
Linux backup-server-nfs 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
- 4.查看安装清单
用yum history list
[root@backup-server-nfs Packages]# yum history list
Loaded plugins: fastestmirror, security
ID | Login user | Date and time | Action(s) | Altered
6 | root <root> | 2019-01-07 06:27 | Update | 8 #< 5 | root <root> | 2018-11-22 02:30 | Install | 11 > 4 | root <root> | 2018-11-22 02:10 | Install | 1 3 | root <root> | 2018-11-22 02:07 | Install | 1 2 | root <root> | 2018-11-22 01:58 | Install | 3 1 | System <unset> | 2018-11-21 07:14 | Install | 511
history list
这里可以看到,我们应该回退到6这个时间点,误操作升级了8个包
- 5.开始修复
先执行yum clean all和yum makecache fast 重新验证下centos6的源
[root@backup-server-nfs Packages]# yum clean all
Loaded plugins: fastestmirror, security
Repository centos6 is listed more than once in the configuration
Cleaning repos: centos6
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@backup-server-nfs Packages]# yum makecache fast
Loaded plugins: fastestmirror, security
Repository centos6 is listed more than once in the configuration
Determining fastest mirrors
centos6 | 4.0 kB 00:00
centos6/group_gz | 219 kB 00:00
centos6/filelists_db | 6.2 MB 00:00
centos6/primary_db | 4.6 MB 00:00
centos6/other_db | 2.8 MB 00:00
Metadata Cache Created
- 6.开始undo
执行命令yum history undo 6
[root@backup-server-nfs Packages]# yum history undo 6
Loaded plugins: fastestmirror, security
Repository centos6 is listed more than once in the configuration
Undoing transaction 6, from Mon Jan 7 06:27:15 2019
Updated bash-4.1.2-33.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Update 4.2.46-20.el7_2.x86_64 @centos6
Updated filesystem-2.4.30-3.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Loading mirror speeds from cached hostfile
Update 3.2-21.el7.x86_64 ?
Updated glibc-2.12-1.166.el6.i686 @anaconda-CentOS-201508042137.x86_64/6.7
Updated glibc-2.12-1.166.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Update 2.17-157.el7.i686 @centos6
Update 2.17-157.el7.x86_64 @centos6
Updated glibc-common-2.12-1.166.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Update 2.17-157.el7.x86_64 @centos6
Updated glibc-devel-2.12-1.166.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Update 2.17-157.el7.x86_64 @centos6
Updated glibc-headers-2.12-1.166.el6.x86_64 @anaconda-CentOS-201508042137.x86_64/6.7
Update 2.17-157.el7.x86_64 @centos6
Updated libtirpc-0.2.1-10.el6.x86_64 @centos6
Update 0.2.4-0.8.el7.x86_64 @centos6
Only Upgrade available on package: filesystem-2.4.30-3.el6.x86_64
Resolving Dependencies
–> Running transaction check
—> Package bash.x86_64 0:4.1.2-33.el6 will be a downgrade
—> Package bash.x86_64 0:4.2.46-20.el7_2 will be erased
—> Package glibc.i686 0:2.12-1.166.el6 will be a downgrade
—> Package glibc.x86_64 0:2.12-1.166.el6 will be a downgrade
—> Package glibc.i686 0:2.17-157.el7 will be erased
—> Package glibc.x86_64 0:2.17-157.el7 will be erased
—> Package glibc-common.x86_64 0:2.12-1.166.el6 will be a downgrade
—> Package glibc-common.x86_64 0:2.17-157.el7 will be erased
—> Package glibc-devel.x86_64 0:2.12-1.166.el6 will be a downgrade
—> Package glibc-devel.x86_64 0:2.17-157.el7 will be erased
—> Package glibc-headers.x86_64 0:2.12-1.166.el6 will be a downgrade
—> Package glibc-headers.x86_64 0:2.17-157.el7 will be erased
—> Package libtirpc.x86_64 0:0.2.1-10.el6 will be a downgrade
—> Package libtirpc.x86_64 0:0.2.4-0.8.el7 will be erased
–> Finished Dependency ResolutionDependencies Resolved
======================================================================================================================================================================
Package Arch Version Repository Size=======================================================================================================================================================================
Downgrading:
bash x86_64 4.1.2-33.el6 centos6 907 k
glibc i686 2.12-1.166.el6 centos6 4.3 M
glibc x86_64 2.12-1.166.el6 centos6 3.8 M
glibc-common x86_64 2.12-1.166.el6 centos6 14 M
glibc-devel x86_64 2.12-1.166.el6 centos6 985 k
glibc-headers x86_64 2.12-1.166.el6 centos6 614 k
libtirpc x86_64 0.2.1-10.el6 centos6 79 kTransaction Summary
=======================================================================================================================================================================
Downgrade 7 Package(s)Total download size: 25 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): bash-4.1.2-33.el6.x86_64.rpm | 907 kB 00:00
(2/7): glibc-common-2.12-1.166.el6.x86_64.rpm | 14 MB 00:00
(3/7): glibc-2.12-1.166.el6.x86_64.rpm | 3.8 MB 00:00
(4/7): libtirpc-0.2.1-10.el6.x86_64.rpm | 79 kB 00:00
(5/7): glibc-2.12-1.166.el6.i686.rpm | 4.3 MB 00:00
(6/7): glibc-headers-2.12-1.166.el6.x86_64.rpm | 614 kB 00:00
(7/7): glibc-devel-2.12-1.166.el6.x86_64.rpm | 985 kB 00:00
Total 66 MB/s | 25 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : glibc-2.12-1.166.el6.x86_64 1/14
Installing : bash-4.1.2-33.el6.x86_64 2/14
Installing : glibc-common-2.12-1.166.el6.x86_64 3/14
Installing : glibc-headers-2.12-1.166.el6.x86_64 4/14
Installing : glibc-devel-2.12-1.166.el6.x86_64 5/14
Installing : libtirpc-0.2.1-10.el6.x86_64 6/14
Installing : glibc-2.12-1.166.el6.i686 7/14
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
warning: /etc/rpc created as /etc/rpc.rpmnew
Cleanup : glibc-devel-2.17-157.el7.x86_64 8/14
Cleanup : glibc-headers-2.17-157.el7.x86_64 9/14
Cleanup : glibc-2.17-157.el7 10/14
Cleanup : libtirpc-0.2.4-0.8.el7.x86_64 11/14
Cleanup : bash-4.2.46-20.el7_2.x86_64 12/14
Cleanup : glibc-common-2.17-157.el7.x86_64 13/14
Cleanup : glibc-2.17-157.el7 14/14
Verifying : bash-4.1.2-33.el6.x86_64 1/14
Verifying : glibc-common-2.12-1.166.el6.x86_64 2/14
Verifying : glibc-2.12-1.166.el6.x86_64 3/14
Verifying : libtirpc-0.2.1-10.el6.x86_64 4/14
Verifying : glibc-2.12-1.166.el6.i686 5/14
Verifying : glibc-headers-2.12-1.166.el6.x86_64 6/14
Verifying : glibc-devel-2.12-1.166.el6.x86_64 7/14
Verifying : glibc-devel-2.17-157.el7.x86_64 8/14
Verifying : glibc-2.17-157.el7.i686 9/14
Verifying : bash-4.2.46-20.el7_2.x86_64 10/14
Verifying : glibc-2.17-157.el7.x86_64 11/14
Verifying : glibc-common-2.17-157.el7.x86_64 12/14
Verifying : glibc-headers-2.17-157.el7.x86_64 13/14
Verifying : libtirpc-0.2.4-0.8.el7.x86_64 14/14Removed:
bash.x86_64 0:4.2.46-20.el7_2 glibc.i686 0:2.17-157.el7 glibc.x86_64 0:2.17-157.el7 glibc-common.x86_64 0:2.17-157.el7 glibc-devel.x86_64 0:2.17-157.el7
glibc-headers.x86_64 0:2.17-157.el7 libtirpc.x86_64 0:0.2.4-0.8.el7Installed:
bash.x86_64 0:4.1.2-33.el6 glibc.i686 0:2.12-1.166.el6 glibc.x86_64 0:2.12-1.166.el6 glibc-common.x86_64 0:2.12-1.166.el6
glibc-devel.x86_64 0:2.12-1.166.el6 glibc-headers.x86_64 0:2.12-1.166.el6 libtirpc.x86_64 0:0.2.1-10.el6Complete!
- 7.完成
到这里回退完成了。重试了下ssh也恢复了正常。