Home Linux troubleshooting [Solved] Error rpmdb damaged header in Fedora, RHEL

[Solved] Error rpmdb damaged header in Fedora, RHEL

By sk
Published: Updated: 3.1K views

Today I tried to update all packages with sudo dnf --refresh upgrade command in my Fedora 35 desktop. During the package update, I encountered with this issue - error: rpmdb: damaged header #5904 retrieved -- skipping.

I kept getting this error a lot. I couldn't update the Fedora system. After a couple web searches, I found that the RPM database is corrupted for some reason.

If you ever stuck into a situation like mine, you can easily solve the "rpmdb damaged header" error by rebuilding the RPM database as shown in the following steps.

Fix error: rpmdb: damaged header in Fedora

Backup corrupted RPM database, just in case:

$ mv /var/lib/rpm/__db* /var/lib/rpm/old/

Next, delete the RPM database using command:

$ sudo rm -f /var/lib/rpm/__db*

Next, reset the SELinux security context for /var/lib/rpm/ directory to its default values using restorecon command:

$ sudo restorecon -Rv /var/lib/rpm

Finally, rebuild the RPM database to fix rpmdb damaged header error in Fedora, RHEL and its clones like CentOS, AlmaLinux and Rocky Linux:

$ sudo rpmdb --rebuilddb
Solve error rpmdb damaged header in Fedora
Solve error rpmdb damaged header in Fedora

You will not see any output in the terminal. If you want to see what's going on in the background, use -v flag.

$ sudo rpmdb --rebuilddb -v

And then update/upgrade Fedora system as usual.

$ sudo dnf update --refresh

Now, I can able to update the system without any issues.

Copr repo for fedy owned by kwizart             921  B/s | 3.3 kB     00:03    
Copr repo for Signal-Desktop owned by luminoso  8.7 kB/s | 3.3 kB     00:00    
Copr repo for PyCharm owned by phracek          567  B/s | 3.3 kB     00:05    
Fedora 35 - x86_64                              5.1 kB/s | 5.3 kB     00:01    
Fedora 35 openh264 (From Cisco) - x86_64        2.0 kB/s | 989  B     00:00    
Fedora Modular 35 - x86_64                       17 kB/s | 5.2 kB     00:00    
Fedora 35 - x86_64 - Updates                     13 kB/s | 4.4 kB     00:00    
Fedora 35 - x86_64 - Updates                    210 kB/s | 1.7 MB     00:08    
Fedora Modular 35 - x86_64 - Updates             26 kB/s | 6.6 kB     00:00    
google-chrome                                   4.8 kB/s | 1.3 kB     00:00    
RPM Fusion for Fedora 35 - Free                 4.4 kB/s | 6.2 kB     00:01    
RPM Fusion for Fedora 35 - Free - Updates       6.2 kB/s | 5.8 kB     00:00    
RPM Fusion for Fedora 35 - Nonfree              7.1 kB/s | 6.7 kB     00:00    
RPM Fusion for Fedora 35 - Nonfree - NVIDIA Dri 6.8 kB/s | 6.4 kB     00:00    
RPM Fusion for Fedora 35 - Nonfree - Steam      6.5 kB/s | 6.1 kB     00:00    
RPM Fusion for Fedora 35 - Nonfree - Updates    6.6 kB/s | 6.2 kB     00:00    
Dependencies resolved.
================================================================================
 Package                     Arch       Version               Repository   Size
================================================================================
Upgrading:
 cmake-filesystem            x86_64     3.22.0-4.fc35         updates      18 k
 cpp                         x86_64     11.2.1-7.fc35         updates      10 M
 gcc                         x86_64     11.2.1-7.fc35         updates      31 M
 gcc-gdb-plugin              x86_64     11.2.1-7.fc35         updates     147 k
 glibc                       x86_64     2.34-10.fc35          updates     2.0 M
[...]
 python3-pikepdf             x86_64     4.1.0-1.fc35          updates     500 k
 virt-viewer                 x86_64     11.0-1.fc35           updates     324 k
 xxhash-libs                 x86_64     0.8.1-1.fc35          updates      40 k
 zram-generator              x86_64     1.1.1-3.fc35          updates     397 k
 zram-generator-defaults     noarch     1.1.1-3.fc35          updates     9.6 k

Transaction Summary
================================================================================
Upgrade  49 Packages

Total download size: 134 M
Is this ok [y/N]: y

Hope this helps.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More