The command "rpm -qa" returns no content

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5

Issue

  • rpm -qa returns no data.
  • I tried to install software but it would not execute. I noticed that the rpm -qa returns no data.
  • Running yum commands results in an error "no dbpath has been set."  Running commands to do RPM database clean-up (rm -f /var/lib/rpm/__db*; yum --rebuilddb) has no effect.

Resolution

For Scenario 1:
Run the following commands as root:

# rm /dev/urandom
# mknod -m 644 /dev/urandom c 1 9

For Scenario 2:
The rpm database is empty. We would suggest you should backup all files and reinstall the system.

Diagnostic Steps

Scenario 1

  • Check permissions for the device /dev/urandom. If it is changed and need to be reset.

Scenario 2

  • Check RPM database file: /var/lib/rpm/Packages
  • From the rpm database, there is NO rpm package informatoin stored..
$ db_dump Packages
VERSION=3
format=bytevalue
type=hash
db_pagesize=4096
HEADER=END
DATA=END

If a rpm database with records, example outputs will be printed as follows:

$ db_dump Packages
VERSION=3
format=bytevalue
type=hash
db_pagesize=4096
HEADER=END
 00000000
 9f030000
 08000000
 000000430000174c0000003f00000007000016680000001000000064000000080000000000000001000003e8000000060000000200000001000003e9000000060000000a00000001000003ea000000060000000e00000001000003eb000000040000001c000000010
00003ec000000090000002000000001000003ed000000090000005c00000001000003ee000000040000017400000001000003ef000000060000017800000001000003f1000000040000019000000001000003f2000000060000019400000001000003f300000006000
001a300000001000003f600000006000001b100000001000003f700000006000001bf00000001000003f800000009000001f300000001000003fd000000060000020b00000001000003fe0000000600000211000000010000040400000004000002180000000100000
406000000030000021c0000000100000409000000030000021e000000010000040a0000000400000220000000010000040b0000000800000224000000010000040c0000000800000245000000010000040d0000000400000248000000010000040f000000080000024
c000000010000041000000008000002510000000100000414000000060000025600000001000...
...

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