春江暮客

春江暮客的个人学习分享网站

Yum Update Error 'rpmdb', Insufficient Space

2019-05-21 Miscellaneous
Yum Update Error 'rpmdb', Insufficient Space

1. Error: rpmdb open failed

If yum update -y returns Error: rpmdb open failed, the most common cause is a damaged RPM database or broken RPM database files.

The practical fix is to back up the current database files, rebuild the RPM database, clean the yum cache, and then test package operations again.

yum_error

This error occurs because the RPM database is corrupted. We can resolve this by rebuilding the database, after which it should return to normal. Here’s the code:

cd /var/lib/rpm/
for i in `ls | grep 'db.'`;do mv $i $i.bak;done
rpm --rebuilddb
yum clean all

If you want a safer workflow, create a directory backup first before moving all db.* files.

Verify the repair before updating

Before retrying yum update, it is worth checking whether basic RPM and yum commands work again:

rpm -qa | head
yum repolist

If both commands return normally, the RPM database is usually healthy enough to continue.


2. Insufficient Space Error After Rebuilding

space_error To fix this, you’ll need to free up space by deleting older kernel versions, then proceed with the update. Here’s the code:

yum list kernel # View installed kernels
package-cleanup --oldkernels --count=2 # Keep only 2 kernels

yum_success

To prevent this error from occurring again, add the following configuration to /etc/yum.conf: Set installonly_limit=2

Additional checks

If the server is still low on space, check these locations as well:

df -h
du -sh /var/cache/yum
du -sh /boot

In many cases, the real problem is old kernel files in /boot or cached package data that was never cleaned up.

Common issues

1. package-cleanup is not installed

Some systems require yum-utils first:

yum install -y yum-utils

2. The error remains after rebuilding rpmdb

That often means the problem is bigger than the database files themselves. Check disk usage and system logs in case the filesystem is damaged or the disk is already full.

3. Space is still insufficient after removing old kernels

Then you should also inspect logs, cache directories, and temporary files, especially on long-running servers.

友情链接

其它