We have an unusable rpmdb and wanted to know what packages were installed
Environment
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
Issue
We have an unusable rpmdb
and wanted to know what packages were installed. Is there a way to do so?
Resolution
There are data left after installation using yum
in /var/lib/yum/yumdb/
.
Those can be parsed to provide at least partial (e.g. in case that rpm
was used directly for package management instead of yum
) or in some cases even complete list of installed packages:
# find /var/lib/yum/yumdb/ -mindepth 2 -maxdepth 2 | sed 's/^[^-]*-\(.*\)-/\1./' | sort > yumdb_packages.txt
Diagnostic Steps
Each use of rpm
oryum
results in the following message:
error: rpmdb: BDB3037 /var/lib/rpm/Packages: file size not a multiple of the pagesize
error: cannot open Packages index using db5 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
Also rpmdb_verify
gives errors:
# /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages
rpmdb_verify: BDB3037 /var/lib/rpm/Packages: file size not a multiple of the pagesize
rpmdb_verify: BDB0536 Page 383: bad page number 98048
...
rpmdb_verify: BDB0536 Page 35920: bad page number 9195520
rpmdb_verify: /var/lib/rpm/Packages: BDB0090 DB_VERIFY_BAD: Database verification failed
BDB5105 Verification of /var/lib/rpm/Packages failed.
And so does rpmdb_dump
:
# /usr/lib/rpm/rpmdb_dump /var/lib/rpm/Packages
rpmdb_dump: BDB3037 /var/lib/rpm/Packages: file size not a multiple of the pagesize
rpmdb_dump: BDB5115 open: /var/lib/rpm/Packages: Invalid argument
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments