⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0083-0085.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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="0079-0082.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0086-0088.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-83"><P>Page 83</P></A>







<H4><A NAME="ch06_ 9">

6.1.1.6. Major Number

</A></H4>



<P>Device character and block files possess a major number. The major number is used to

communicate information to the device driver associated with the special file. For instance,

under Linux the special files for SCSI disk drives should have a major number of 8, while the

major number for an IDE disk drive's special file would be 3. As you can imagine, any change to

a file's major number can have disastrous effects and is tracked by RPM.

</P>



<H4><A NAME="ch06_ 10">

6.1.1.7. Minor Number

</A></H4>



<P>A file's minor number is similar in concept to the major number, but conveys different

information to the device driver. In the case of disk drives, this information can consist of a

unit identifier. If the minor number changes, RPM will detect it.

</P>



<H4><A NAME="ch06_ 11">

6.1.1.8. Symbolic Link

</A></H4>



<P>If the file in question is really a symbolic link, the text string containing the name of the

linked-to file is checked.

</P>



<H4><A NAME="ch06_ 12">

6.1.1.9. Modification Time

</A></H4>



<P>Most operating systems keep track of the date and time that a file was last modified. RPM

uses this to its advantage by keeping modification times in its database.

</P>



<H3><A NAME="ch06_ 13">

6.2. When Verification Fails: rpm -V Output

</A></H3>



<P>When verifying a package, RPM produces output only if there is a verification failure.

When a file fails verification, the format of the output is a bit cryptic, but it packs all the

information you need into one line per file. Here is the format:

</P>



<!-- CODE SNIP //-->

<PRE>

SM5DLUGT c file

</PRE>

<!-- END CODE SNIP //-->



<P>In this syntax the following things are true:

</P>



<UL>

<LI>          S is the file size.

<LI>          M is the file's mode.

<LI>          5 is the MD5 checksum of the file.

<LI>          D is the file's major and minor numbers.

<LI>          L is the file's symbolic link contents.

<LI>          U is owner of the file.

<LI>          G is the file's group.

</UL>



<A NAME="PAGENUM-84"><P>Page 84</P></A>





<UL>

<LI>          T is the modification time of the file.

<LI>          c appears only if the file is a configuration file. This is handy for quickly

identifying config files, as they are very likely to change, and therefore, very unlikely to

verify successfully.

<LI>          file is the file that failed verification. The complete path is listed to make it easy to find.

</UL>



<P>It's unlikely that every file attribute will fail to verify, so each of the eight attribute flags

will only appear if there is a problem. Otherwise, a

. will be printed in that flag's place. Let's look at an example or two. In this case, the mode, MD5 checksum, and modification time for

the specified file have failed to verify:

</P>

<!-- CODE SNIP //-->

<PRE>

# rpm -V Xfree86

.M5....T /usr/X11R6/lib/X11/fonts/misc/fonts.dir

#

</PRE>

<!-- END CODE SNIP //-->



<P>The file is not a config file (note the absence of a

c between the attribute list and the filename).

</P>



<P>In the following, the size, checksum, and modification time of the system password file

have all changed:

</P>

<!-- CODE SNIP //-->

<PRE>

# rpm -V setup

S.5....T c /etc/passwd

#

</PRE>

<!-- END CODE SNIP //-->



<P>The c indicates that this is a config file.

</P>



<P>This last example illustrates what RPM does when a file that should be there is missing

entirely:

</P>



<!-- CODE SNIP //-->

<PRE>

# rpm -V at

missing    /var/spool/at/spool

#

</PRE>

<!-- END CODE SNIP //-->



<H4><A NAME="ch06_ 14">

6.2.1. Other Verification Failure Messages

</A></H4>



<P>When rpm -V finds other problems, the output is a bit easier to understand:

</P>



<!-- CODE SNIP //-->

<PRE>

# rpm -V blather

Unsatisfied dependencies for blather-7.9-1:    bother &gt;= 3.1

#

</PRE>

<!-- END CODE SNIP //-->



<P>It's pretty easy to see that the blather package requires at least version 3.1 of the

bother package.

</P>



<P>The output from a package's verification script is a bit harder to categorize because the

script's contents, as well as its messages, are entirely up to the package builder.

</P>



<A NAME="PAGENUM-85"><P>Page 85</P></A>







<H3><A NAME="ch06_ 15">

6.3. Selecting What to Verify and How

</A></H3>



<P>There are several ways to verify packages installed on your system. If you've taken a look

at RPM's query command, you'll find that many of them are similar. Let's start with the

simplest method of specifying packages: the package label.

</P>



<H4><A NAME="ch06_ 16">

6.3.1. The Package Label: Verify an Installed Package Against

the RPM Database

</A></H4>



<P>You can simply follow the rpm -V command with all or part of

a package label. As with every other RPM command that accepts package labels, you'll need to carefully specify each part

of the label you include. Keep in mind that package names are case sensitive, so

rpm -V PackageName and rpm -V packagename are not the same. Let's verify the

initscripts package:

</P>



<!-- CODE SNIP //-->

<PRE>

# rpm -V initscripts

#

</PRE>

<!-- END CODE SNIP //-->



<P>Although it looks like RPM didn't do anything, the following steps were performed:

</P>



<OL>

<LI>          For every file in the package, RPM checked the nine file attributes discussed earlier.

<LI>          If the package was built with dependencies, the RPM database was searched to

ensure that the packages that satisfy those dependencies were installed.

<LI>          If the package was built with a verification script, that script was executed.

</OL>



<P>In our example, each of these steps was performed without error&#151;the package verified

successfully. Remember, with rpm -V you'll only see output if a package fails to verify.

</P>



<H4><A NAME="ch06_ 17">

6.3.2. -a: Verify All Installed Packages Against the RPM Database

</A></H4>



<P>If you add -a to rpm -V, you can easily verify every installed package on your system. It

might take a while, but when it's done, you'll know exactly what's been changed on your system:

</P>



<!-- CODE //-->

<PRE>

# rpm -Va

.M5....T     /usr/X11R6/lib/X11/fonts/misc/fonts.dir

missing      /var/spool/at/.lockfile

missing      /var/spool/at/spool

S.5....T     /usr/lib/rhs/glint/icon.pyc

..5....T  c  /etc/inittab

..5.....     /usr/bin/loadkeys

#

</PRE>

<!-- END CODE //-->



<P>Don't be too surprised if rpm -Va turns up a surprising number of files that failed

verification. RPM's verification process is very strict! In many cases, the changes flagged don't indicate

problems&#151;they are only an indication of your system's configuration being different from

what

</P>



<P><CENTER>

<a href="0079-0082.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0086-0088.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -