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.

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
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

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.
Related reading
- 原文作者:春江暮客
- 原文链接:https://www.bobobk.com/en/305.html
- 版权声明:本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。