Tag Archives: rpm

RPM query output formatting (print your arch!)

By default, rpm doesn’t print a package’s arch when you query it with rpm -q. On a x86_64 system, you’ll see something like that:

[root@earth ~]# rpm -q libselinux
libselinux-1.33.4-5.el5
libselinux-1.33.4-5.el5

not very usefult, is it ?

To make rpm print the arch, well it’s easy, just use the –qf (–queryformat) option, with the ARCH tag:

rpm -qa --qf "%{NAME} %{ARCH}\n"

To know all the printable tags:

rpm --querytags

For example, this will give you something similar to rpm -q, but with the arch at the end of the line:

rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE} %{ARCH}\n"
[root@earth ~]# rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE} %{ARCH}\n" libselinux 
libselinux-1.33.4-5.el5 x86_64
libselinux-1.33.4-5.el5 i386

rpmdb: Lock table is out of available object entries

source: Racker Hacker

rpm hangs after printing this error : “rpmdb: Lock table is out of available object entries”.

First, kill (-9) all hanged rpm processes. Then remove the corrupted databases, and rebuild them.

rm /var/lib/rpm/__db.*
rpm --rebuilddb

Tip: if this happens on a server, check that yum-updatesd is not running. yum-updatesd can be the source of such errors. yum-updatesd is evil. I don’t think that yum-updatesd is useful on a server anyway.
chkconfig yum-updatesd off
service yum-updatesd stop