📄 0086-0088.html
字号:
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Using RPM to Verify Installed Packages:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311054 //-->
<!-- TITLE=Maximum RPM (RPM)//-->
<!-- AUTHOR=Edward Bailey//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=06 //-->
<!-- PAGES=0079-0092 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0083-0085.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0089-0092.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-86"><P>Page 86</P></A>
<P>
the builders of the installed packages had on their systems. Also, some attributes change
during normal system operation. It would be wise to check into each verification failure, just to
make sure.
</P>
<H4><A NAME="ch06_ 18">
6.3.3. -f <file>: Verify the Package Owning
<file> Against the RPM Database
</A></H4>
<P>Imagine this: You're hard at work when a program you've used a million times before
suddenly stops working. What do you do? Well, before using RPM, you probably tried to
find other files associated with that program and see if they had changed recently.
</P>
<P>Now you can let RPM do at least part of that sleuthing for you. Simply direct RPM to
verify the package owning the ailing program:
</P>
<!-- CODE SNIP //-->
<PRE>
% rpm -Vf /sbin/cardmgr
S.5....T c /etc/sysconfig/pcmcia
%
</PRE>
<!-- END CODE SNIP //-->
<P>Hmmmm. Looks like a config file was recently changed.
</P>
<P>This isn't to say that using RPM to verify a package will always get you out of trouble, but
it's such a quick step that it should be one of the first things you try. Here's an example of <BR>
rpm -Vf not working out as well:
</P>
<!-- CODE SNIP //-->
<PRE>
% rpm -Vf /etc/blunder
file /etc/blunder is not owned by any package
%
</PRE>
<!-- END CODE SNIP //-->
<P>Note that the issue surrounding RPM and symbolic links mentioned in Chapter 5,
"Getting Information About Packages," also applies to
rpm -Vf. Watch those symlinks!
</P>
<H4><A NAME="ch06_ 19">
6.3.4. -p <file>: Verify Against a Specific Package File
</A></H4>
<P>Unlike the previous options to rpm -V, each of which verifies one or more packages
against RPM's database, the -p option performs the same
verification, but against a package file. Why on earth would you want to do this when the RPM database is sitting there, just waiting to
be used?
</P>
<P>Well, what if you didn't have an RPM database? While it isn't a common occurrence,
power failures, hardware problems, and inadvertent deletions (along with nonexistent backups)
can leave your system sans database. Then your system hiccups; what do you do now?
</P>
<P>This is where a CD full of package files can be worth its weight in gold. Simply mount the
CD and verify to your heart's content:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vp /mnt/cdrom/RedHat/RPMS/i386/adduser-1.1-1.i386.rpm
#
</PRE>
<!-- END CODE SNIP //-->
<A NAME="PAGENUM-87"><P>Page 87</P></A>
<P>Whatever else might be wrong with this system, at least we can add new users. But what if
you have many packages to verify? It would be a very slow process doing it one package at a
time. That's where the next option comes in handy.
</P>
<H4>
6.3.5. -g <group>: Verify Packages Belonging to
<group>
</H4>
<P>When a package is built, the package builder must classify the package, grouping it with
other packages that perform similar functions. RPM gives you the ability to verify installed
packages based on their groups. For example, there is a group known as
Shells. This group consists of packages that contain, strangely enough, shells. Let's verify the proper installation of every
shell-related package on the system:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vg Shells
missing /etc/bashrc
#
</PRE>
<!-- END CODE SNIP //-->
<P>One thing to keep in mind is that group specifications are case sensitive. Issuing the
command rpm -Vg shells wouldn't verify many packages:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vg shells
group shells does not contain any packages
#
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="ch06_ 20">
6.3.6. --nodeps: Do Not Check Dependencies Before
Erasing Package
</A></H4>
<P>When the --nodeps option is added to a verify command, RPM
will bypass its dependency verification processing. In this example, we've added the
-vv option to the command line so we can watch RPM at work:
</P>
<!-- CODE //-->
<PRE>
# rpm -Vvv rpm
D: opening database in //var/lib/rpm/
D: verifying record number 2341208
D: dependencies: looking for libz.so.1
D: dependencies: looking for libdb.so.2
D: dependencies: looking for libc.so.5
#
</PRE>
<!-- END CODE //-->
<P>As you can see, the rpm package provides three different capabilities:
</P>
<UL>
<LI> libz.so.1
<LI> libdb.so.2
<LI> libc.so.5
</UL>
<P>If we add the --nodeps option, the dependency verification of the three capabilities is no
longer performed:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vvv --nodeps rpm
D: opening database in //var/lib/rpm/
D: verifying record number 2341208
#
</PRE>
<!-- END CODE SNIP //-->
<A NAME="PAGENUM-88"><P>Page 88</P></A>
<P>The line D: verifying record number 2341208 indicates that RPM's normal file-based
verification proceeded normally.
</P>
<H4><A NAME="ch06_ 21">
6.3.7. --noscripts: Do Not Execute Verification Script
</A></H4>
<P>Adding the --noscripts option to a verify command prevents execution of the verification
scripts of each package being verified. In the following example, the package verification script is
executed:
</P>
<!-- CODE //-->
<PRE>
# rpm -Vvv bother
D: opening database in //var/lib/rpm/
D: verifying record number 616728
D: verify script found - running from file /var/tmp/rpm-321.vscript
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
+ export PATH
+ echo This is the bother 3.5 verification script
This is the bother 3.5 verification script
#
</PRE>
<!-- END CODE //-->
<P>While the actual script is not very interesting, it did execute when the package was being
verified. In the next example, we'll use the
--noscripts option to prevent its execution:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vvv --noscripts bother
D: opening database in //var/lib/rpm/
D: verifying record number 616728
#
</PRE>
<!-- END CODE SNIP //-->
<P>As expected, the output is identical to the prior example, minus the lines dealing with the
verification script, of course.
</P>
<H4><A NAME="ch06_ 22">
6.3.8. --nofiles: Do Not Verify File Attributes
</A></H4>
<P>The --nofiles option disables RPM's file-related
verification processing. When this option is used, only the verification script and dependency verification processing are performed. In
this example, the package has a file-related verification problem:
</P>
<!-- CODE //-->
<PRE>
# rpm -Vvv bash
D: opening database in //var/lib/rpm/
D: verifying record number 279448
D: dependencies: looking for libc.so.5
D: dependencies: looking for libtermcap.so.2
missing /etc/bashrc
#
</PRE>
<!-- END CODE //-->
<P>When the --nofiles option is added, the missing file doesn't cause a message anymore:
</P>
<!-- CODE //-->
<PRE>
# rpm -Vvv --nofiles bash
D: opening database in //var/lib/rpm/
D: verifying record number 279448
D: dependencies: looking for libc.so.5
D: dependencies: looking for libtermcap.so.2
#
</PRE>
<!-- END CODE //-->
<P><CENTER>
<a href="0083-0085.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0089-0092.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -