问题:
dnf使用率很高,接近100%
解决:
top命令查看dnf使用率很高,接近100%
根据pid查看进程信息,ps -ef | grep PID,发现是执行了命令dnf makecache导致的
直接杀掉次进程,kill -9 PID或者killall dnf
问题:
测试yum使用情况或者dnf使用情况
发现yum和dnf相关的命令使用后,就卡住了,ctrl + c和ctrl + d都无反应
解决:
再次登录,ps -ef | grep yum和ps -ef |grep dnf 查看相关进程然后kill掉
检查 /var/log/dnf.log 和 /var/log/yum.log 看看有什么报错
查看dnf日志如下
2024-09-29T14:58:05Z INFO --- logging initialized ---
2024-09-29T14:58:05Z DDEBUG timer: config: 15 ms
2024-09-29T14:58:05Z DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
2024-09-29T14:58:05Z DEBUG DNF version: 4.2.15
2024-09-29T14:58:05Z DDEBUG Command: dnf makecache --timer
2024-09-29T14:58:05Z DDEBUG Installroot: /
2024-09-29T14:58:05Z DDEBUG Releasever: 10
2024-09-29T14:58:05Z DEBUG cachedir: /var/cache/dnf
2024-09-29T14:58:05Z DDEBUG Base command: makecache
2024-09-29T14:58:05Z DDEBUG Extra commands: ['makecache', '--timer']
2024-09-29T14:58:05Z DEBUG Making cache files for all metadata files.
2024-09-29T14:58:06Z DEBUG ks10-adv-os: has expired and will be refreshed.
2024-09-29T14:58:06Z DEBUG ks10-adv-updates: has expired and will be refreshed.
2024-09-29T14:58:06Z DEBUG reviving: 'ks10-adv-os' can be revived - repomd matches.
2024-09-29T14:58:06Z DEBUG ks10-adv-os: using metadata from Sun 29 Sep 2024 04:02:27 PM CST.
2024-09-29T14:58:06Z DEBUG reviving: 'ks10-adv-updates' can be revived - repomd matches.
2024-09-29T14:58:06Z DEBUG ks10-adv-updates: using metadata from Sun 29 Sep 2024 04:03:25 PM CST.
2024-09-29T14:58:06Z DEBUG os-release: falling back to basic User-Agent: distro Kylin Linux Advanced Server not whitelisted
2024-09-29T14:58:06Z DEBUG No module defaults found
2024-09-29T14:58:06Z DDEBUG timer: sack setup: 149 ms
2024-09-29T14:58:06Z DEBUG Completion plugin: Generating completion cache...
2024-09-29T14:58:06Z INFO Metadata cache created.
2024-09-29T14:58:06Z DDEBUG Cleaning up.
没看出来很明显的报错,但是涉及到dnf和yum都无法使用,他们管理的rpm包需要确认一下
cd /var/lib/rpm/
发现下面存在__db.00这种类似的文件,直接清除并重建
# 清除原rpmdb文件:
rm -rf __db.*
# 重建rpm数据库:
rpm --rebuilddb
# 清除yum缓存:
yum -y clean all
# 重建缓存:
dnf makecache
# 或者
yum makecache
问题解决