记一次惊心动魄的CentOS系统升级经历

How to use yum history to roll back an update

1
2
3
4
5
# List all update histories
yum history

# Undo the specified transaction
yum history undo <transaction ID>

Fix ‘has missing requires of’

1
2
3
4
5
6
7
8
cp -a /var/lib/rpm /var/lib/rpm.bak
cp -a /var/lib/yum /var/lib/yum.bak

yum check \
| grep "has missing requires of" \
| awk '{print $1}' \
| sed -E "s/^[0-9]+://g" \
| while read p; do rpm -e --nodeps $p; done

Fix ‘is a duplicate with’

1
2
3
4
5
6
7
8
9
10
11
12
13
cp -a /var/lib/rpm /var/lib/rpm.bak
cp -a /var/lib/yum /var/lib/yum.bak

yum check \
| grep "is a duplicate with" \
| awk '{print $1}' \
| sed -E "s/^[0-9]+://g" \
| while read p; do rpm -e --justdb --nodeps $p; done
yum update

# If 'yum update' still get some duplicated packages, just running the following commands
## yum update | grep "is a duplicate with" | awk '{print $1}' | sed -E "s/^[0-9]+://g" | while read p; do rpm -e --justdb --nodeps $p; done
## yum update
文章作者: flytreeleft
文章链接: https://flytreeleft.github.io/a-horrible-os-upgrading-for-centos/
版权声明: 本博客所有文章除特别声明外,均采用 知识共享署名 4.0 国际许可协议 许可协议。转载请注明来自 flytreeleft's Blog