Yum gives error: “There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them”
Environment:
Red hat / CentOS 5-6-7
Issue
- While updating the system using yum it throws an error: “There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them”.
- yum update interrupted and yum-complete-transaction wants to remove 253 pkgs
- Running
yum-complete-transaction
renders the system inoperable after removing system critical packages
Resolution
- While updating the system using yum if it finds incomplete or aborted yum transactions on a system it displays the message “There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.”
If due to some reason the previous transaction was incomplete or aborted then on the next yum install or update command, it would give this message. The “yum-complete-transaction” command would help to complete the previous incomplete or aborted transactions.
On execution of “yum-complete-transaction” it gives the list of packages which will be installed and removed to complete the previous transaction. It asks for confirmation if you would like to continue. On entering ‘Y’ it will complete the transaction. Before continuing (i.e hitting ‘Y’) *it is important to verify the list of packages that will be installed or removed by “yum-complete-transaction” .
Note: At the time of writing, there is a bug with “yum-complete-transaction” where, depending on the list of packages to install or remove from the previous transaction, it might offer to remove almost all the packages on the system. It is important to review the Transaction Summary and package list before hitting ‘Y’ to continue. If you are experiencing this issue, please run the following:
# package-cleanup --dupes
# yum-complete-transaction --cleanup-only
# yum update yum yum-utils
# yum-complete-transaction (Note: At this point, it should not offer to remove so many packages. Please do check to make sure though.)
# yum clean all
# yum update
Example:
# yum-complete-transaction
Loaded plugins: rhnplugin
There are 1 outstanding transactions to complete. Finishing the most recent one
The remaining transaction had 3 elements left to run
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package dmidecode.i386 1:2.9-1.el5 set to be erased
--> Processing Dependency: dmidecode >= 2.7 for package: hal
---> Package dnsmasq.i386 0:2.45-1.el5_2.1 set to be erased
[..snip..]
--> Finished Dependency Resolution
==================================================================================================================
Package Arch Version Repository Size
==================================================================================================================
Removing:
dmidecode i386 1:2.9-1.el5 installed 148 k
dnsmasq i386 2.45-1.el5_2.1 installed 343 k
Removing for dependencies:
NetworkManager i386 1:0.7.0-9.el5 installed 3.3 M
NetworkManager-glib i386 1:0.7.0-9.el5 installed 154 k
Transaction Summary
==================================================================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 4 Package(s)
Is this ok [y/N]:
If you do not want to complete the previous transaction, then use the "--cleanup-only" option. This would clean up only transaction journal files and exit.
Example :
# yum-complete-transaction --cleanup-only
Loaded plugins: rhnplugin
Cleaning up unfinished transaction journals
Cleaning up 2009-10-06.15:46.06