I need to clean yum pending or unfinished transactions before our installer start to work, otherwise the yum update
or yum install
may fail. But where are these pending transactions from? Sometimes the machine is down or unexpected thing happens, the yum installation process failed.
Problem
you may see error like this:
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
Solution
According to the prompt, we need first install yum-utils
yum install -y yum-utils
yum-complete-transaction
is a program which finds incomplete or aborted yum transactions on a system and attempts to complete them. It looks at the transaction-all* and transaction-done* files which can normally be found in /var/lib/yum if a yum transaction aborted in the middle of execution.
If it finds more than one unfinished transaction it will attempt to complete the most recent one first. You can run it more than once to clean up all unfinished transactions.
Then just issue the following command to do a cleanup:
yum-complete-transaction --cleanup-only
You can also check how many pending transactions exist:
find /var/lib/yum -maxdepth 1 -type f -name 'transaction-all*' -not -name '*disabled' -printf . | wc -c
网友评论