LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rpm -qa does not display output (https://www.linuxquestions.org/questions/linux-server-73/rpm-qa-does-not-display-output-4175498775/)

deepak_message 03-19-2014 02:56 PM

rpm -qa does not display output
 
Hi,

I have redhat 5.3. and I aunable to run rpm -qa command even rpm related commands also.
I tried to run below commands but no luck...

rpm --rebuilddb

cd /var/lib/rpm
rpm --rebuilddb
rpm --initdb

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


please help to make this run..

rknichols 03-19-2014 03:10 PM

What is actually in the /var/lib/rpm/ directory? The "--rebuilddb" operation just rebuilds the database index files from the data files in that directory. If you do not have the (rather large) "Packages", "Basenames", etc., files there, you do not have the material to rebuild the database.

deepak_message 03-19-2014 03:37 PM

[root@abc rpm]# pwd
/var/lib/rpm
[root@abc rpm]# ls -l
total 126744
-rw-r--r-- 1 root root 5435392 Feb 9 21:21 Basenames
-rw-r--r-- 1 root root 12288 Dec 24 21:05 Conflictname
-rw-r--r-- 1 root root 0 Mar 20 00:19 __db.000
-rw-r----- 1 root root 24576 Mar 20 00:36 __db.001
-rw-r----- 1 root root 1318912 Mar 20 00:36 __db.002
-rw-r----- 1 root root 450560 Mar 20 00:36 __db.003
-rw-r--r-- 1 root root 2420736 Feb 9 21:21 Dirnames
-rw-r--r-- 1 root root 5328896 Feb 9 21:21 Filemd5s
-rw-r--r-- 1 root root 24576 Feb 9 21:21 Group
-rw-r--r-- 1 root root 24576 Feb 9 21:21 Installtid
-rw-r--r-- 1 root root 45056 Feb 9 21:21 Name
-rw-r--r-- 1 root root 38993920 Mar 20 00:21 Packages
-rw-r--r-- 1 root root 38993920 Feb 9 21:21 Packages-BAKUP
-rw-r--r-- 1 root root 38993920 Mar 20 00:10 Packages_old
-rw-r--r-- 1 root root 323584 Feb 9 21:21 Providename
-rw-r--r-- 1 root root 102400 Feb 9 21:21 Provideversion
-rw-r--r-- 1 root root 12288 Jul 24 2009 Pubkeys
-rw-r--r-- 1 root root 380928 Feb 9 21:21 Requirename
-rw-r--r-- 1 root root 188416 Feb 9 21:21 Requireversion
-rw-r--r-- 1 root root 81920 Feb 9 21:21 Sha1header
-rw-r--r-- 1 root root 40960 Feb 9 21:21 Sigmd5
-rw-r--r-- 1 root root 12288 Dec 24 21:03 Triggername

Now I getting error... while running rpm -qa command ...
rpmdb: /var/lib/rpm/Packages: unexpected file type or format
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm

rknichols 03-19-2014 06:01 PM

I'm guessing that the Packages-BAKUP and Packages_old files might be from you trying the RpmRecovery procedure on the rpm.org wiki. If not, have you been through that procedure?

BTW, /dev/urandom should be mode 666, though I doubt that is causing the problem.
Scratch that. It's mode 666 on my RHEL clone systems, but the manpage for urandom says it should be 644.

John VV 03-19-2014 07:56 PM

well with 5.3 being 7 versions out of date
the normal
Code:

su -
yum clean all
rpm --rebuilddb
yum update

is out of the question

once you run "--rebuilddb" the old database is removed
you need "yum update" to update what is in the installed DB and the rpm db

rknichols 03-19-2014 09:57 PM

Quote:

Originally Posted by John VV (Post 5137781)
once you run "--rebuilddb" the old database is removed
you need "yum update" to update what is in the installed DB and the rpm db

Nothing could be farther from the truth!

The "__db.*" files that are removed are just the rpm db lock information files for managing transaction locks on the database. It is all the other files in that directory that are the actual Berkeley DB files.

"yum update" is for updating packages, and will not work if the database of installed packages is broken.


All times are GMT -5. The time now is 04:38 AM.