Resolving RPM Transaction Locks and Duplicate Packages When Installing vsftpd on CentOS/RHEL
This guide walks through fixing yum/rpm failures during package installation (e.g., vsftpd) caused by unfinished transactions, duplicate packages, or a stuck RPM database lock.
Symptom
Attempting too install vsftpd fails with messages about unfinished transactions and duplicate packages:
$ sudo yum install vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-14.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================
Package Arch Version Repository Size
=================================================================================
Installing:
vsftpd x86_64 2.2.2-14.el6 CentOS.6.base.x86_64 152 k
Transaction Summary
=================================================================================
Install 1 Package(s)
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.2.2-14.el6.x86_64.rpm | 152 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
wget-1.12-5.el6_6.1.x86_64 is a duplicate with wget-1.12-1.8.el6.x86_64
Common causes:
- Mutliple versions of the same package installed (duplicate RPMs)
- A previous yum/rpm run left the data base locked
- Repository metadata issues
Step 1: Complete or clean up unfinished transactions
If yum hints at unfinished work, finish or clean it up.
# Install yum-utils if needed
sudo yum install -y yum-utils
# Try to finish pending transactions
sudo yum-complete-transaction
# Or clean them up explicitly
sudo yum-complete-transaction --cleanup-only
Check yum history if issues persist:
sudo yum history
sudo yum history info last
Step 2: Remove duplicate packages
Identify duplicates and remove the older variants.
# List duplicates
sudo package-cleanup --dupes
# Attempt automatic cleanup of duplicates
sudo package-cleanup --cleandupes
# Or handle a specific package manually (example for wget)
rpm -qa | grep '^wget-'
sudo yum remove wget-1.12-1.8.el6.x86_64
Step 3: Refresh or reset repositories (example: Atomic repo)
If you need to reset/augment repositories (as with Atomic), run the installer. You may use curl or wget:
# Using curl
curl -fsSLO https://www.atomicorp.com/installers/atomic
sudo sh ./atomic
Or:
wget http://www.atomicorp.com/installers/atomic
sudo sh ./atomic
If the instalelr hangs with a lock warning like below, continue to Step 4.
Installing the Atomic GPG keys: OK
Downloading atomic-release-1.0-21.el6.art.noarch.rpm: warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
Step 4: Resolve the RPM database lock
First, determine whether another process legitimately holds the lock.
# See which process has the lock
sudo fuser -v /var/lib/rpm/.rpm.lock
# Inspect and stop it if appropriate
ps -fp <PID>
sudo kill -TERM <PID>
# As a last resort
sudo kill -9 <PID>
If no process is using the lock (stale lock), remove it and rebuild the RPM database.
# Remove lock and Berkeley DB environment files (if present)
sudo rm -f /var/lib/rpm/.rpm.lock
sudo rm -f /var/lib/rpm/__db*
# Rebuild the RPM database
sudo rpm --rebuilddb
Step 5: Clean metadata and refresh package lists
sudo yum clean all
sudo yum makecache
sudo yum check-update
Step 6: Retry the installation
sudo yum install -y vsftpd
If you still encounter problems, verify the RPM database and run a basic health check:
sudo yum check
sudo rpm -Va