— things that just don't seem to fit in any one category. RPM is no exception. This chapter covers those aspects of RPM that can only be called "miscellania"…
The following options are not normally used on a day to day basis. However, some of them can be quite important when the need arises. One such option is --rebuilddb.
you'll see this message:
free list corrupt (42)- contact rpm-list@redhat.com
|
Once this happens, you'll find there's very little that you can do, RPM-wise. However, before you fire off an e-mail to the RPM mailing list, you might try the --rebuilddb option. The format of the command is simple:
rpm --rebuilddb
|
The command produces no output, either. After a few minutes, it completes with nary a peep. Here's an example of --rebuilddb being used on an RPM database that wasn't corrupt. First, let's look at the files that comprise the database:
# cd /var/lib/rpm
# ls
10:35 nameindex.rpm
-rw-r--r-- 1 root root 2342536 Oct 17 10:35 packages.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 providesindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 requiredby.rpm
#
|
Then, we issue the command:
# rpm --rebuilddb
#
|
After a few minutes, the command completes, and we take a look at the files again:
# ls
20:50 nameindex.rpm
-rw-r--r-- 1 root root 2339080 Oct 17 20:50 packages.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 providesindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 requiredby.rpm
#
|
You'll note that packages.rpm decreased in size. This is due to a side-effect of the --rebuilddb— While it is going through the database, it is getting rid of unused portions of the database. Our example was performed on a newly installed system where only one or two packages had been upgraded, so the reduction in size was small. For a system that has been through a complete upgrade, the difference would be more dramatic.
rebuilds. However, when an RPM-based system has undergone a major upgrade, it certainly wouldn't hurt to spend a few minutes using --rebuilddb to clean things up.
If you are already using RPM, the --initdb option is one you'll probably never have to use. The --initdb option is used to create a new RPM database. That's why you'll probably not need it if you're already using RPM — you already have an RPM database.
It might seem that the --initdb already, it's still perfectly safe to use the option, even though it won't accomplish much. As an example, here's a listing of the files that make up the RPM database on a Red Hat Linux system:
# ls /var/lib/rpm
total 3559
-rw-r--r-- 1 root root 16384 Jan 8 22:10 conflictsindex.rpm
-rw-r--r-- 1 root root 1351680 Jan 8 22:10 fileindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 groupindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 nameindex.rpm
-rw-r--r-- 1 root root 2349640 Jan 8 22:10 packages.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 providesindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 requiredby.rpm
#
|
Next, let's use the --initdb option, just to see what it does to this database:
# rpm --initdb
# ls /var/lib/rpm
total 3559
-rw-r--r-- 1 root root 16384 Jan 8 22:10 conflictsindex.rpm
-rw-r--r-- 1 root root 1351680 Jan 8 22:10 fileindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 groupindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 nameindex.rpm
-rw-r--r-- 1 root root 2349640 Jan 8 22:10 packages.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 providesindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 requiredby.rpm
#
|
Since an RPM database existed already, the --initdb option did no harm to it — there was no change to the database files.
The only other option that can be used with --initdb is --dbpath. This permits the easy creation of a new RPM database in the directory specified with the --dbpath option.
Adding the --quiet option to any RPM command directs RPM to produce as little output as possible. For example, RPM's build command (the subject of the second half of this book) normally produces reams of output; by adding the --quiet option, this is all you'll see:
# rpm -ba --quiet bother-3.5.spec
* Package: bother
1 block
3 blocks
#
|
The --quiet option can silence even the mighty -vv option:
# rpm -Uvv --quiet eject-1.2-2.i386.rpm
#
|
RPM includes a concise built-in help message for those times when you need a reminder about a particular command. Normally you'll want to use the --help option by itself, though you might want to pipe the output through a pager such as less, since the output is more than one screen long:
# rpm --help|less
RPM version 2.3
Copyright (C) 1995 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License
<file> - use <file> instead of /etc/rpmrc and $HOME/.rpmrc
-v - be a little more verbose
-vv - be incredibly verbose (for debugging)
-q - query mode
--root <dir> - use <dir> as the top level directory
--dbpath <dir> - use <dir> as the directory for the database
--queryformat <s> - use s as the header format (implies -i)
install, upgrade and query (with -p) allow ftp URL's to be used in place
of file names as well as the following options:
--ftpproxy <host> - hostname or IP of ftp proxy
--ftpport <port> - port number of ftp server (or proxy)
|
This is just the first screen of RPM's help command. To see the rest, give the command a try. Practically everything there is to know about RPM is present in the --help output. It's a bit too concise to learn RPM from, but it's enough to refresh your memory when the syntax of a particular option escapes you.
If you're not sure what version of RPM is presently installed on your system, the easiest way to find out is to ask RPM itself using the --version option:
# rpm --version
RPM version 2.3
#
|
| Главная |