确认
确认
pgrep -a -f 'dnf|yum' | grep -v grep # 是否有包任务在跑
systemctl status dnf-makecache.timer --no-pager 2>/dev/null | head
# 报错一般给出 'Waiting for process with pid N':
ps -p <N> -o pid,cmd,etime处置
处置
# 在途任务:等待完成;自动任务可临时停止
systemctl stop dnf-makecache.timer 2>/dev/null
# 确认无活跃进程后,按报错提示定位对应锁文件(版本间路径有差异)
find /var/cache/dnf /var/lib/dnf -name '*.pid' -o -name '*.lock' 2>/dev/null清锁等于绕过保护:必须完确认没有包管理进程,误清可能损伤 rpm 数据库。