Changeset 4349661


Ignore:
Timestamp:
10/01/2022 10:03:20 PM (19 months ago)
Author:
David Bryant <davidbryant@…>
Branches:
11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, bdubbs/gcc13, multilib, renodr/libudev-from-systemd, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
b3daf01, c093e6b
Parents:
2bf32ff
Message:

Corrected grammatical errors and cleaned up English idiom.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter08/pkgmgt.xml

    r2bf32ff r4349661  
    1212
    1313  <para>Package Management is an often requested addition to the LFS Book. A
    14   Package Manager allows tracking the installation of files making it easy to
     14  Package Manager tracks the installation of files, making it easier to
    1515  remove and upgrade packages. As well as the binary and library files, a
    1616  package manager will handle the installation of configuration files.  Before
     
    1818  any particular package manager. What it provides is a roundup of the more
    1919  popular techniques and how they work. The perfect package manager for you may
    20   be among these techniques or may be a combination of two or more of these
     20  be among these techniques, or it may be a combination of two or more of these
    2121  techniques. This section briefly mentions issues that may arise when upgrading
    2222  packages.</para>
     
    3333    <listitem>
    3434      <para>There are multiple solutions for package management, each having
    35       its strengths and drawbacks.  Including one that satisfies all audiences
     35      its strengths and drawbacks.  Finding one solution that satisfies all audiences
    3636      is difficult.</para>
    3737    </listitem>
     
    4040  <para>There are some hints written on the topic of package management. Visit
    4141  the <ulink url="&hints-root;">Hints Project</ulink> and see if one of them
    42   fits your need.</para>
     42  fits your needs.</para>
    4343
    4444  <sect2 id='pkgmgmt-upgrade-issues'>
     
    5252    <itemizedlist>
    5353      <listitem>
    54         <para>If Linux kernel needs to be upgraded (for example, from
    55         5.10.17 to 5.10.18 or 5.11.1), nothing else need to be rebuilt.
    56         The system will keep working fine thanks to the well-defined border
    57         between kernel and userspace.  Specifically, Linux API headers
    58         need not to be (and should not be, see the next item) upgraded
    59         alongside the kernel.  You'll need to reboot your system to use the
     54        <para>If the Linux kernel needs to be upgraded (for example, from
     55        5.10.17 to 5.10.18 or 5.11.1), nothing else needs to be rebuilt.
     56        The system will keep working fine thanks to the well-defined interface
     57        between the kernel and user space.  Specifically, Linux API headers
     58        need not be (and should not be, see the next item) upgraded
     59        along with the kernel.  You will merely need to reboot your system to use the
    6060        upgraded kernel.</para>
    6161      </listitem>
    6262
    6363      <listitem>
    64         <para>If Linux API headers or Glibc needs to be upgraded to a newer
    65         version, (e.g.  from glibc-2.31 to glibc-2.32), it is safer to
     64        <para>If Linux API headers or glibc need to be upgraded to a newer
     65        version, (e.g.,  from glibc-2.31 to glibc-2.32), it is safer to
    6666        rebuild LFS.  Though you <emphasis>may</emphasis> be able to rebuild
    6767        all the packages in their dependency order, we do not recommend
     
    7171      <listitem> <para>If a package containing a shared library is updated, and
    7272      if the name of the library changes, then any packages dynamically
    73       linked to the library need to be recompiled in order to link against the
     73      linked to the library must be recompiled, to link against the
    7474      newer library.  (Note that there is no correlation between the package
    7575      version and the name of the library.) For example, consider a package
    76       foo-1.2.3 that installs a shared library with name <filename
    77       class='libraryfile'>libfoo.so.1</filename>. If you upgrade the package to
    78       a newer version foo-1.2.4 that installs a shared library with name
     76      foo-1.2.3 that installs a shared library with the name <filename
     77      class='libraryfile'>libfoo.so.1</filename>. Suppose you upgrade the package to
     78      a newer version foo-1.2.4 that installs a shared library with the name
    7979      <filename class='libraryfile'>libfoo.so.2</filename>. In this case, any
    8080      packages that are dynamically linked to <filename
    8181      class='libraryfile'>libfoo.so.1</filename> need to be recompiled to link
    8282      against <filename class='libraryfile'>libfoo.so.2</filename> in order to
    83       use the new library version. You should not remove the previous
    84       libraries unless all the dependent packages are recompiled.</para>
     83      use the new library version. You should not remove the old
     84      libraries until all the dependent packages have been recompiled.</para>
    8585      </listitem>
    8686
    8787      <listitem> <para>If a package containing a shared library is updated,
    88       and the name of library doesn't change, but the version number of the
     88      and the name of the library doesn't change, but the version number of the
    8989      library <emphasis role="bold">file</emphasis> decreases (for example,
    90       the name of the library is kept named
     90      the library is still named
    9191      <filename class='libraryfile'>libfoo.so.1</filename>,
    92       but the name of library file is changed from
     92      but the name of the library file is changed from
    9393      <filename class='libraryfile'>libfoo.so.1.25</filename> to
    9494      <filename class='libraryfile'>libfoo.so.1.24</filename>),
    9595      you should remove the library file from the previously installed version
    96       (<filename class='libraryfile'>libfoo.so.1.25</filename> in the case).
    97       Or, a <command>ldconfig</command> run (by yourself using a command
     96      (<filename class='libraryfile'>libfoo.so.1.25</filename> in this case).
     97      Otherwise, a <command>ldconfig</command> command (invokeed by yourself from the command
    9898      line, or by the installation of some package) will reset the symlink
    9999      <filename class='libraryfile'>libfoo.so.1</filename> to point to
    100       the old library file because it seems having a <quote>newer</quote>
    101       version, as its version number is larger.  This situation may happen if
    102       you have to downgrade a package, or the package changes the versioning
    103       scheme of library files suddenly.</para> </listitem>
     100      the old library file because it seems to be a <quote>newer</quote>
     101      version; its version number is larger.  This situation may arise if
     102      you have to downgrade a package, or if the authors change the versioning
     103      scheme for library files.</para> </listitem>
    104104
    105105      <listitem><para>If a package containing a shared library is updated,
    106       and the name of library doesn't change, but a severe issue
     106      and the name of the library doesn't change, but a severe issue
    107107      (especially, a security vulnerability) is fixed, all running programs
    108108      linked to the shared library should be restarted.  The following
    109109      command, run as <systemitem class="username">root</systemitem> after
    110       updating, will list what is using the old versions of those libraries
     110      the update is cmplete, will list which processes are using the old versions of those libraries
    111111      (replace <replaceable>libfoo</replaceable> with the name of the
    112112      library):</para>
     
    116116
    117117      <para>
    118         If <application>OpenSSH</application> is being used for accessing
    119         the system and it is linked to the updated library, you need to
    120         restart <command>sshd</command> service, then logout, login again,
    121         and rerun that command to confirm nothing is still using the
     118        If <application>OpenSSH</application> is being used to access
     119        the system and it is linked to the updated library, you must
     120        restart the <command>sshd</command> service, then logout, login again,
     121        and rerun the preceding ps command to confirm that nothing is still using the
    122122        deleted libraries.
    123123      </para>
     
    125125      <para revision='systemd'>
    126126        If the <command>systemd</command> daemon (running as PID 1) is
    127         linked to the updated library, you can restart it without reboot
     127        linked to the updated library, you can restart it without rebooting
    128128        by running <command>systemctl daemon-reexec</command> as the
    129129        <systemitem class='username'>root</systemitem> user.
     
    131131
    132132      <listitem>
    133         <para>If a binary or a shared library is overwritten, the processes
    134         using the code or data in the binary or library may crash.  The
    135         correct way to update a binary or a shared library without causing
     133        <para>If an executable program or a shared library is overwritten, the processes
     134        using the code or data in that program or library may crash.  The
     135        correct way to update a program or a shared library without causing
    136136        the process to crash is to remove it first, then install the new
    137         version into position. The <command>install</command> command
    138         provided by <application>Coreutils</application> has already
    139         implemented this and most packages use it to install binaries and
     137        version. The <command>install</command> command
     138        provided by <application>coreutils</application> has already
     139        implemented this, and most packages use that command to install binary files and
    140140        libraries.  This means that you won't be troubled by this issue most of the time.
    141141        However, the install process of some packages (notably Mozilla JS
    142         in BLFS) just overwrites the file if it exists and causes a crash, so
     142        in BLFS) just overwrites the file if it exists; this causes a crash. So
    143143        it's safer to save your work and close unneeded running processes
    144         before updating a package.</para>
     144        before updating a package.</para> <!-- binary is an adjective, not a noun. -->
    145145      </listitem>
    146146    </itemizedlist>
     
    153153    <para>The following are some common package management techniques. Before
    154154    making a decision on a package manager, do some research on the various
    155     techniques, particularly the drawbacks of the particular scheme.</para>
     155    techniques, particularly the drawbacks of each particular scheme.</para>
    156156
    157157    <sect3>
    158158      <title>It is All in My Head!</title>
    159159
    160       <para>Yes, this is a package management technique. Some folks do not find
    161       the need for a package manager because they know the packages intimately
    162       and know what files are installed by each package. Some users also do not
     160      <para>Yes, this is a package management technique. Some folks do not
     161      need a package manager because they know the packages intimately
     162      and know which files are installed by each package. Some users also do not
    163163      need any package management because they plan on rebuilding the entire
    164       system when a package is changed.</para>
     164      system whenever a package is changed.</para>
    165165
    166166    </sect3>
     
    169169      <title>Install in Separate Directories</title>
    170170
    171       <para>This is a simplistic package management that does not need any extra
    172       package to manage the installations. Each package is installed in a
     171      <para>This is a simplistic package management technique that does not need a
     172      special program to manage the packages. Each package is installed in a
    173173      separate directory. For example, package foo-1.1 is installed in
    174174      <filename class='directory'>/usr/pkg/foo-1.1</filename>
    175175      and a symlink is made from <filename>/usr/pkg/foo</filename> to
    176       <filename class='directory'>/usr/pkg/foo-1.1</filename>. When installing
    177       a new version foo-1.2, it is installed in
     176      <filename class='directory'>/usr/pkg/foo-1.1</filename>. When
     177      a new version foo-1.2 comes along, it is installed in
    178178      <filename class='directory'>/usr/pkg/foo-1.2</filename> and the previous
    179179      symlink is replaced by a symlink to the new version.</para>
     
    182182      <envar>LD_LIBRARY_PATH</envar>, <envar>MANPATH</envar>,
    183183      <envar>INFOPATH</envar> and <envar>CPPFLAGS</envar> need to be expanded to
    184       include <filename>/usr/pkg/foo</filename>. For more than a few packages,
     184      include <filename>/usr/pkg/foo</filename>. If you install more than a few packages,
    185185      this scheme becomes unmanageable.</para>
    186186
     
    191191
    192192      <para>This is a variation of the previous package management technique.
    193       Each package is installed similar to the previous scheme. But instead of
    194       making the symlink, each file is symlinked into the
     193      Each package is installed as in the previous scheme. But instead of
     194      making the symlink via a generic package name, each file is symlinked into the
    195195      <filename class='directory'>/usr</filename> hierarchy. This removes the
    196196      need to expand the environment variables. Though the symlinks can be
    197       created by the user to automate the creation, many package managers have
    198       been written using this approach. A few of the popular ones include Stow,
     197      created by the user, many package managers use this approach, and
     198      automate the creation of the symlinks. A few of the popular ones include Stow,
    199199      Epkg, Graft, and Depot.</para>
    200200
    201       <para>The installation needs to be faked, so that the package thinks that
     201      <para>The installation script needs to be fooled, so the package thinks
    202202      it is installed in <filename class="directory">/usr</filename> though in
    203203      reality it is installed in the
     
    217217      instead of <filename class='libraryfile'>/usr/lib/libfoo.so.1</filename>
    218218      as you would expect. The correct approach is to use the
    219       <envar>DESTDIR</envar> strategy to fake installation of the package. This
     219      <envar>DESTDIR</envar> variable to direct the installation. This
    220220      approach works as follows:</para>
    221221
     
    225225
    226226      <para>Most packages support this approach, but there are some which do not.
    227       For the non-compliant packages, you may either need to manually install the
    228       package, or you may find that it is easier to install some problematic
     227      For the non-compliant packages, you may either need to install the
     228      package manually, or you may find that it is easier to install some problematic
    229229      packages into <filename class='directory'>/opt</filename>.</para>
    230230
     
    238238      <command>find</command> command with the appropriate options can generate
    239239      a log of all the files installed after the timestamp file was created. A
    240       package manager written with this approach is install-log.</para>
     240      package manager that uses this approach is install-log.</para>
    241241
    242242      <para>Though this scheme has the advantage of being simple, it has two
    243243      drawbacks. If, during installation, the files are installed with any
    244244      timestamp other than the current time, those files will not be tracked by
    245       the package manager. Also, this scheme can only be used when one package
    246       is installed at a time. The logs are not reliable if two packages are
    247       being installed on two different consoles.</para>
     245      the package manager. Also, this scheme can only be used when packages
     246      are installed one at a time. The logs are not reliable if two packages are
     247      installed simultaneously from two different consoles.</para>
    248248
    249249    </sect3>
     
    263263      executables need to be dynamically linked without the suid or sgid bit.
    264264      Preloading the library may cause some unwanted side-effects during
    265       installation. Therefore, it is advised that one performs some tests to
    266       ensure that the package manager does not break anything and logs all the
     265      installation. Therefore, it's a good idea to perform some tests to
     266      ensure that the package manager does not break anything, and that it logs all the
    267267      appropriate files.</para>
    268268
    269       <para>The second technique is to use <command>strace</command>, which
    270       logs all system calls made during the execution of the installation
     269      <para>Another technique is to use <command>strace</command>, which
     270      logs all the system calls made during the execution of the installation
    271271      scripts.</para>
    272272    </sect3>
     
    276276
    277277      <para>In this scheme, the package installation is faked into a separate
    278       tree as described in the Symlink style package management. After the
     278      tree as previously described in the symlink style package management section. After the
    279279      installation, a package archive is created using the installed files.
    280       This archive is then used to install the package either on the local
    281       machine or can even be used to install the package on other machines.</para>
     280      This archive is then used to install the package on the local
     281      machine or even on other machines.</para>
    282282
    283283      <para>This approach is used by most of the package managers found in the
     
    290290      url="&hints-root;fakeroot.txt"/>.</para>
    291291
    292       <para>Creation of package files that include dependency information is
    293       complex and is beyond the scope of LFS.</para>
    294 
    295       <para>Slackware uses a <command>tar</command> based system for package
     292      <para>The creation of package files that include dependency information is
     293      complex, and beyond the scope of LFS.</para>
     294
     295      <para>Slackware uses a <command>tar</command>-based system for package
    296296      archives.  This system purposely does not handle package dependencies
    297297      as more complex package managers do.  For details of Slackware package
     
    323323    simple as using <command>tar</command> on the LFS partition that contains
    324324    the root directory (about 250MB uncompressed for a base LFS build), copying
    325     that file via network transfer or CD-ROM to the new system and expanding
    326     it.  From that point, a few configuration files will have to be changed.
     325    that file via network transfer or CD-ROM / USB stick to the new system, and expanding
     326    it.  After that, a few configuration files will have to be changed.
    327327    Configuration files that may need to be updated include:
    328328    <filename>/etc/hosts</filename>,
     
    343343    </para>
    344344
    345     <para>A custom kernel may need to be built for the new system depending on
     345    <para>A custom kernel may be needed for the new system, depending on
    346346    differences in system hardware and the original kernel
    347347    configuration.</para>
     
    349349    <note><para>There have been some reports of issues when copying between
    350350    similar but not identical architectures. For instance, the instruction set
    351     for an Intel system is not identical with an AMD processor and later
    352     versions of some processors may have instructions that are unavailable in
     351    for an Intel system is not identical with the AMD processor's instructions, and later
     352    versions of some processors may provide instructions that are unavailable with
    353353    earlier versions.</para></note>
    354354
    355     <para>Finally the new system has to be made bootable via <xref
     355    <para>Finally, the new system has to be made bootable via <xref
    356356    linkend="ch-bootable-grub"/>.</para>
    357357
Note: See TracChangeset for help on using the changeset viewer.