home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Unix / HOWTOs / BOOTDISK < prev    next >
Text File  |  1999-11-04  |  86KB  |  2,509 lines

  1.   The Linux Bootdisk HOWTO
  2.   Tom Fawcett (fawcett@croftj.net)
  3.  
  4.  
  5.   v3.2, June 1998
  6.  
  7.   This document describes how to design and build your own boot/root
  8.   diskettes for Linux.  These disks could be used as rescue disks or to
  9.   test new system components.  If you haven't read the Linux FAQ and
  10.   related documents, such as the Linux Installation HOWTO and the Linux
  11.   Install Guide, you should not be trying to build boot diskettes.  If
  12.   you just want a rescue disk to have for emergencies, see Appendix
  13.   ``Pre-made bootdisks''.
  14.   ______________________________________________________________________
  15.  
  16.   Table of Contents
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. Preface.
  68.  
  69.      1.1 Version notes.
  70.      1.2 Feedback and credits.
  71.      1.3 Distribution policy.
  72.  
  73.   2. Introduction.
  74.  
  75.   3. Bootdisks and the boot process.
  76.  
  77.      3.1 The boot process.
  78.      3.2 Disk types.
  79.  
  80.   4. Building a root filesystem.
  81.  
  82.      4.1 Overview.
  83.      4.2 Creating the filesystem.
  84.      4.3 Populating the filesystem.
  85.         4.3.1 /dev
  86.         4.3.2 /etc
  87.         4.3.3 /bin and /sbin
  88.         4.3.4 /lib
  89.      4.4 Modules.
  90.      4.5 Some final details.
  91.      4.6 Wrapping it up.
  92.  
  93.   5. Choosing a kernel.
  94.  
  95.   6. Putting them together: Making the disk(s).
  96.  
  97.      6.1 Transferring the kernel with LILO
  98.      6.2 Transferring the kernel without LILO.
  99.      6.3 Setting the ramdisk word.
  100.      6.4 Transferring the root filesystem.
  101.  
  102.   7. Troubleshooting, or The Agony of Defeat.
  103.  
  104.   8. Miscellaneous topics.
  105.  
  106.      8.1 Reducing root filesystem size.
  107.      8.2 Non-ramdisk root filesystems.
  108.      8.3 Building a utility disk.
  109.  
  110.   9. How the pros do it.
  111.  
  112.   10. Frequently asked question (FAQ) list.
  113.  
  114.   11. Resources and pointers
  115.  
  116.      11.1 Pre-made bootdisks.
  117.      11.2 Rescue packages.
  118.      11.3 Graham Chapman's shell scripts
  119.      11.4 LILO --- the Linux loader.
  120.      11.5 Linux FAQ and HOWTOs.
  121.      11.6 Ramdisk usage.
  122.      11.7 The Linux boot process.
  123.  
  124.   12. LILO boot error codes.
  125.  
  126.   13. Sample rootdisk directory listings.
  127.  
  128.   14. Sample utility disk directory listing.
  129.  
  130.  
  131.  
  132.  
  133.   ______________________________________________________________________
  134.  
  135.   1.  Preface.
  136.  
  137.  
  138.   Note: This document may be outdated. If the date on the title page is
  139.   more than six months ago, please check the Linux Documentation Project
  140.   homepage  <http://sunsite.unc.edu/LDP/> to see if a more recent
  141.   version exists.
  142.  
  143.   Although this document should be legible in its text form, it looks
  144.   much better in Postscript (.ps) or HTML because of the typographical
  145.   notation used.  We encourage you to select one of these forms.  The
  146.   Info version, as of this writing, ends up so damaged as to be
  147.   unusable.
  148.  
  149.  
  150.   1.1.  Version notes.
  151.  
  152.  
  153.   Graham Chapman (grahamc@zeta.org.au) wrote the original Bootdisk-HOWTO
  154.   and he supported it through version 3.1.  Tom Fawcett
  155.   (fawcett@croftj.net) added a lot of material for kernel 2.0, and he is
  156.   the document's maintainer as of version 3.2.  Much of Chapman's
  157.   original content remains.
  158.  
  159.   This document is intended for Linux kernel 2.0 and later.  If you have
  160.   an older kernel (1.2.xx or before), please consult previous versions
  161.   of the Bootdisk-HOWTO archived on Graham Chapman's homepage
  162.   <http://www.zeta.org.au/~grahamc/linux.html>.
  163.  
  164.   This information is intended for Linux on the Intel platform.  Much of
  165.   this information may be applicable to Linux on other processors, but
  166.   we have no first-hand experience or information about this.  If anyone
  167.   has experience with bootdisks on other platforms, please contact us.
  168.  
  169.  
  170.  
  171.   1.2.  Feedback and credits.
  172.  
  173.  
  174.   We welcome any feedback, good or bad, on the content of this document.
  175.   We have done our best to ensure that the instructions and information
  176.   herein are accurate and reliable.  Please let us know if you find
  177.   errors or omissions.
  178.  
  179.   We thank the many people who assisted with corrections and
  180.   suggestions.  Their contributions have made it far better than we
  181.   could ever have done alone.
  182.  
  183.   Send comments, corrections and questions to the author at the email
  184.   address above.  I don't mind trying to answer questions, but please
  185.   read section ``Troubleshooting'' first.
  186.  
  187.  
  188.  
  189.   1.3.  Distribution policy.
  190.  
  191.  
  192.   Copyright ⌐ 1995,1996,1997,1998 by Tom Fawcett and Graham Chapman.
  193.   This document may be distributed under the terms set forth in the
  194.   Linux Documentation Project License at
  195.   <http://sunsite.unc.edu/LDP/COPYRIGHT.html>.  Please contact the
  196.   authors if you are unable to get the license.
  197.  
  198.  
  199.   This is free documentation.  It is distributed in the hope that it
  200.   will be useful, but without any warranty; without even the implied
  201.   warranty of merchantability or fitness for a particular purpose.
  202.  
  203.  
  204.  
  205.  
  206.   2.  Introduction.
  207.  
  208.  
  209.   Linux boot disks are useful in a number of situations, such as:
  210.  
  211.   ╖  Testing a new kernel.
  212.  
  213.   ╖  Recovering from a disk failure --- anything from a lost boot sector
  214.      to a disk head crash.
  215.  
  216.   ╖  Fixing a disabled system.  A minor mistake as root can leave your
  217.      system unusable, and you may have to boot from diskette to fix it.
  218.  
  219.   ╖  Upgrading critical system files, such as libc.so.
  220.  
  221.   There are several ways of obtaining boot disks:
  222.  
  223.  
  224.   ╖  Use one from a distribution such as Slackware.  This will at least
  225.      allow you to boot.
  226.  
  227.   ╖  Use a rescue package to set up disks designed to be used as rescue
  228.      disks.
  229.  
  230.   ╖  Learn what is required for each of the types of disk to operate,
  231.      then build your own.
  232.  
  233.   Some people choose the last option so they can do it themselves.  That
  234.   way, if something breaks, they can work out what to do to fix it.
  235.   Plus it's a great way to learn about how a Linux system works.
  236.  
  237.   This document assumes some basic familiarity with Linux system
  238.   administration concepts.  For example, you should know about
  239.   directories, filesystems and floppy diskettes.  You should know how to
  240.   use mount and df.  You should know what /etc/passwd and fstab files
  241.   are for and what they look like.  You should know that most of the
  242.   commands in this HOWTO should be run as root.
  243.  
  244.   Constructing your own bootdisk from scratch can be complicated.  If
  245.   you haven't read the Linux FAQ and related documents, such as the
  246.   Linux Installation HOWTO and the Linux Install Guide, you should not
  247.   be trying to build boot diskettes.  If you just need a working
  248.   bootdisk for emergencies, it is much easier to download a
  249.   prefabricated one.  See Appendix ``Pre-made bootdisks'', below, for
  250.   where to find these.
  251.  
  252.  
  253.  
  254.   3.  Bootdisks and the boot process.
  255.  
  256.  
  257.   A bootdisk is basically a miniature, self-contained Linux system on a
  258.   floppy diskette.  It must perform many of the same functions that a
  259.   complete full-size Linux system performs.  Before trying to build one
  260.   you should understand the basic Linux boot process.  We present the
  261.   basics here, which are sufficient for understanding the rest of this
  262.   document.  Many details and alternative options have been omitted.
  263.  
  264.  
  265.   3.1.  The boot process.
  266.  
  267.  
  268.   All PC systems start the boot process by executing code in ROM
  269.   (specifically, the BIOS) to load the sector from sector 0, cylinder 0
  270.   of the boot drive.  The boot drive is usually the first floppy drive
  271.   (designated A: in DOS and /dev/fd0 in Linux).  The BIOS then tries to
  272.   execute this sector.  On most bootable disks, sector 0, cylinder 0
  273.   contains either:
  274.  
  275.   ╖  code from a boot loader such as LILO, which locates the kernel,
  276.      loads it and executes it to start the boot proper.
  277.  
  278.   ╖  the start of an operating system kernel, such as Linux.
  279.  
  280.   If a Linux kernel has been raw-copied to a diskette, the first sector
  281.   of the disk will be the first sector of the Linux kernel itself.  This
  282.   first sector will continue the boot process by loading the rest of the
  283.   kernel from the boot device.
  284.  
  285.   Once the kernel is completely loaded, it goes through some basic
  286.   device initialization.  It then tries to load and mount a root
  287.   filesystem from some device.  A root filesystem is simply a filesystem
  288.   that is mounted as ``/''.  The kernel has to be told where to look for
  289.   the root filesystem; if it cannot find a loadable image there, it
  290.   halts.
  291.  
  292.   In some boot situations --- often when booting from a diskette --- the
  293.   root filesystem is loaded into a ramdisk, which is RAM accessed by the
  294.   system as if it were a disk.  There are two reasons why the system
  295.   loads to ramdisk.  First, RAM is several orders of magnitude faster
  296.   than a floppy disk, so system operation is fast; and second, the
  297.   kernel can load a compressed filesystem from the floppy and uncompress
  298.   it onto the ramdisk, allowing many more files to be squeezed onto the
  299.   diskette.
  300.  
  301.   Once the root filesystem is loaded and mounted, you see a message
  302.   like:
  303.  
  304.  
  305.           VFS: Mounted root (ext2 filesystem) readonly.
  306.  
  307.  
  308.  
  309.   init program on the root filesystem (in /bin or /sbin) and executes
  310.   it.  init reads its configuration file /etc/inittab, looks for a line
  311.   designated sysinit, and executes the named script .  The sysinit
  312.   script is usually something like /etc/rc or /etc/init.d/boot.  This
  313.   script is a set of shell commands that set up basic system services,
  314.   such as:
  315.  
  316.  
  317.   ╖  Running fsck on all the disks,
  318.  
  319.   ╖  Loading necessary kernel modules,
  320.  
  321.   ╖  Starting swapping,
  322.  
  323.   ╖  Initializing the network,
  324.  
  325.   ╖  Mounting disks mentioned in fstab.
  326.  
  327.   This script often invokes various other scripts to do modular
  328.   initialization.  For example, in the common SysVinit structure, the
  329.   directory /etc/rc.d/ contains a complex structure of subdirectories
  330.   whose files specify how to enable and shut down most system services.
  331.   However, on a bootdisk the sysinit script is often very simple.
  332.  
  333.   When the sysinit script finishes, control returns to init, which then
  334.   enters the default runlevel, specified in inittab with the initdefault
  335.   keyword.  The runlevel line usually specifies a program like getty,
  336.   which is responsible for handling commununications through the console
  337.   and ttys.  It is the getty program which prints the familiar
  338.   ``login:'' prompt.  The getty program in turn invokes the login
  339.   program to handle login validation and to set up user sessions.
  340.  
  341.  
  342.   3.2.  Disk types.
  343.  
  344.  
  345.   Having reviewed the basic boot process, we can now define various
  346.   kinds of disks involved.  We classify disks into four types.  The
  347.   discussion here and throughout this document uses the term ``disk'' to
  348.   refer to floppy diskettes unless otherwise specified, though most of
  349.   the discussion could apply equally well to hard disks.
  350.  
  351.  
  352.  
  353.      boot
  354.         A disk containing a kernel which can be booted.  The disk can be
  355.         used to boot the kernel, which then may load a root file system
  356.         on another disk.  The kernel on a bootdisk usually must be told
  357.         where to find its root filesystem.
  358.  
  359.         Often a bootdisk loads a root filesystem from another diskette,
  360.         but it is possible for a bootdisk to be set up to load a hard
  361.         disk's root filesystem instead.  This is commonly done when
  362.         testing a new kernel.  (in fact, ``make zdisk'' will create such
  363.         a bootdisk automatically from the kernel source code).
  364.  
  365.  
  366.      root
  367.         A disk with a filesystem containing files required to run a
  368.         Linux system.  Such a disk does not necessarily contain either a
  369.         kernel or a boot loader.
  370.  
  371.         A root disk can be used to run the system independently of any
  372.         other disks, once the kernel has been booted.  Usually the root
  373.         disk is automatically copied to a ramdisk.  This makes root disk
  374.         accesses much faster, and frees up the disk drive for a utility
  375.         disk.
  376.  
  377.  
  378.      boot/root
  379.         A disk which contains both the kernel and a root filesystem.  In
  380.         other words, it contains everything necessary to boot and run a
  381.         Linux system without a hard disk.  The advantage of this type of
  382.         disk is that is it compact --- everything required is on a
  383.         single disk.  However, the gradually increasing size of
  384.         everything means that it is increasingly difficult to fit
  385.         everything on a single diskette, even with compression.
  386.  
  387.  
  388.      utility
  389.         A disk which contains a file system, but is not intended to be
  390.         mounted as a root file system.  It is an additional data disk.
  391.         You would use this type of disk to carry additional utilities
  392.         where you have too much to fit on your root disk.
  393.  
  394.  
  395.  
  396.  
  397.   In general, when we talk about ``building a bootdisk'' we mean
  398.   creating both the boot (kernel) and root (files) portions.  They may
  399.   be either together (a single boot/root disk) or separate (boot + root
  400.   disks).  The most flexible approach for rescue diskettes is probably
  401.   to use separate boot and root diskettes, and one or more utility
  402.   diskettes to handle the overflow.
  403.  
  404.  
  405.  
  406.  
  407.   4.  Building a root filesystem.
  408.  
  409.  
  410.   Creating the root filesystem involves selecting files necessary for
  411.   the system to run.  In this section we describe how to build a
  412.   compressed root filesystem.  A less common option is to build an
  413.   uncompressed filesystem on a diskette that is directly mounted as
  414.   root; this alternative is described in section ``Non-ramdisk Root
  415.   Filesystem''.
  416.  
  417.  
  418.   4.1.  Overview.
  419.  
  420.  
  421.   A root filesystem must contain everything needed to support a full
  422.   Linux system.  To be able to do this, the disk must include the
  423.   minimum requirements for a Linux system:
  424.  
  425.  
  426.   ╖  The basic file system structure,
  427.  
  428.   ╖  Minimum set of directories: /dev, /proc, /bin, /etc, /lib, /usr,
  429.      /tmp,
  430.  
  431.   ╖  Basic set of utilities: sh, ls, cp, mv, etc.,
  432.  
  433.   ╖  Minimum set of config files: rc, inittab, fstab, etc.,
  434.  
  435.   ╖  Devices: /dev/hd*, /dev/tty*, /dev/fd0, etc.,
  436.  
  437.   ╖  Runtime library to provide basic functions used by utilities.
  438.  
  439.   Of course, any system only becomes useful when you can run something
  440.   on it, and a root diskette usually only becomes useful when you can do
  441.   something like:
  442.  
  443.  
  444.   ╖  Check a file system on another drive, for example to check your
  445.      root file system on your hard drive, you need to be able to boot
  446.      Linux from another drive, as you can with a root diskette system.
  447.      Then you can run fsck on your original root drive while it is not
  448.      mounted.
  449.  
  450.   ╖  Restore all or part of your original root drive from backup using
  451.      archive and compression utilities such as cpio, tar, gzip and
  452.      ftape.
  453.  
  454.  
  455.   We will describe how to build a compressed filesystem, so called
  456.   because it is compressed on disk and, when booted, is uncompressed
  457.   onto a ramdisk.  With a compressed filesystem you can fit many files
  458.   (approximately two megabytes) onto a standard 1440K diskette.  Because
  459.   the filesystem is much larger than a diskette, it cannot be built on
  460.   the diskette.  We have to build it elsewhere, compress it, then copy
  461.   it to the diskette.
  462.  
  463.   4.2.  Creating the filesystem.
  464.  
  465.  
  466.   In order to build such a root filesystem, you need a spare device that
  467.   is large enough to hold all the files before compression.  You will
  468.   need a device capable of holding about four megabytes.  There are
  469.   several choices:
  470.  
  471.  
  472.   ╖  Use a ramdisk (DEVICE = /dev/ram0).  In this case, memory is used
  473.      to simulate a disk drive.  The ramdisk must be large enough to hold
  474.      a filesystem of the appropriate size.  If you use LILO, check your
  475.      configuration file (/etc/lilo.conf) for a line like:
  476.  
  477.  
  478.              RAMDISK_SIZE = nnn
  479.  
  480.  
  481.   which determines how much RAM will be allocated.  The default is
  482.   4096K, which should be sufficient.  You should probably not try to use
  483.   such a ramdisk on a machine with less than 8MB of RAM.
  484.  
  485.   Check to make sure you have a device like /dev/ram0, /dev/ram or
  486.   /dev/ramdisk.  If not, create /dev/ram0 with mknod (major number 1,
  487.   minor 0).
  488.  
  489.   ╖  If you have an unused hard disk partition that is large enough
  490.      (several megabytes), this is a good solution.  If you have enough
  491.      physical RAM you can turn off swapping and build the filesystem in
  492.      your swap partition.
  493.  
  494.   ╖  Use a loopback device, which allows a disk file to be treated as a
  495.      device.  Using a loopback device you can create a three megabyte
  496.      file on your hard disk and build the filesystem on it.
  497.  
  498.      In order to use loopback devices you need specially modified mount
  499.      and unmount programs.  You can find these in the directory:
  500.  
  501.      ftp://ftp.win.tue.nl:/pub/linux/util/mount/
  502.  
  503.  
  504.      If you do not have a loop device (/dev/loop0, /dev/loop1, etc.) on
  505.      your system, you will have to create one with ``mknod /dev/loop0 b
  506.      7 0''.  One you've installed these special mount and umount
  507.      binaries, create a temporary file on a hard disk with enough
  508.      capacity (eg, /tmp/fsfile).  You can use a command like
  509.  
  510.  
  511.        dd if=/dev/zero of=/tmp/fsfile bs=1k count=nnn
  512.  
  513.  
  514.   to create an nnn-block file.
  515.  
  516.   Use the file name in place of DEVICE below.  When you issue a mount
  517.   command you must include the option ``-o loop'' to tell mount to use a
  518.   loopback device.
  519.  
  520.           mount -o loop -t ext2 /tmp/fsfile /mnt
  521.  
  522.  
  523.  
  524.   will mount /tmp/fsfile (via a loopback device) at the mount point
  525.   /mnt.  A df will confirm this.
  526.  
  527.  
  528.  
  529.   After you've chosen one of these options, prepare the DEVICE with:
  530.  
  531.           dd if=/dev/zero of=DEVICE bs=1k count=3000
  532.  
  533.  
  534.  
  535.   This command zeroes out the device.  This step is important because
  536.   the filesystem on the device will be compressed later, so all unused
  537.   portions should be filled with zeroes to achieve maximum compression.
  538.  
  539.   Next, create the filesystem.  The Linux kernel recognizes two file
  540.   system types for root disks to be automatically copied to ramdisk.
  541.   These are minix and ext2, of which ext2 is the preferred file system.
  542.   If using ext2, you may find it useful to use the -i option to specify
  543.   more inodes than the default; -i 2000 is suggested so that you don't
  544.   run out of inodes.  Alternatively, you can save on inodes by removing
  545.   lots of unnecessary /dev files.  mke2fs will by default create 360
  546.   inodes on a 1.44Mb diskette.  I find that 120 inodes is ample on my
  547.   current rescue root diskette, but if you include all the devices in
  548.   the /dev directory then you will easily exceed 360.  Using a
  549.   compressed root filesystem allows a larger filesystem, and hence more
  550.   inodes by default, but you may still need to either reduce the number
  551.   of files or increase the number of inodes.
  552.  
  553.   So the command you use will look like:
  554.  
  555.        mke2fs -m 0 -i 2000 DEVICE
  556.  
  557.  
  558.   (If you're using a loopback device, the disk file you're using should
  559.   be supplied in place of this DEVICE.  mke2fs will ask if you really
  560.   want to do this; say yes.)
  561.  
  562.   The mke2fs command will automatically detect the space available and
  563.   configure itself accordingly.  The -m 0 parameter prevents it from
  564.   reserving space for root, and hence provides more usable space on the
  565.   disk.
  566.  
  567.   Next, mount the device:
  568.  
  569.  
  570.           mount -t ext2 DEVICE /mnt
  571.  
  572.  
  573.  
  574.   (You must create a mount point /mnt if it does not already exist.)  In
  575.   the remaining sections, all destination directory names are assumed to
  576.   be relative to /mnt.
  577.  
  578.  
  579.  
  580.   4.3.  Populating the filesystem.
  581.  
  582.  
  583.   Here is a reasonable minimum set of directories for your root
  584.   filesystem:
  585.  
  586.  
  587.   ╖  /dev --- Devices, required to perform I/O
  588.  
  589.   ╖  /proc --- Directory stub required by the proc filesystem
  590.  
  591.   ╖  /etc --- System configuration files
  592.  
  593.   ╖  /sbin --- Critical system binaries
  594.  
  595.   ╖  /bin  --- Basic binaries considered part of the system
  596.  
  597.   ╖  /lib --- Shared libraries to provide run-time support
  598.  
  599.   ╖  /mnt --- A mount point for maintenance on other disks
  600.  
  601.   ╖  /usr --- Additional utilities and applications
  602.  
  603.   (The directory structure presented here is for root diskette use only.
  604.   Real Linux systems have a more complex and disciplined set of
  605.   policies, called the File System Standard, for determining where files
  606.   should go.)
  607.  
  608.  
  609.   Three of these directories will be empty on the root filesystem, so
  610.   they only need to be created with mkdir.  The /proc directory is
  611.   basically a stub under which the proc filesystem is placed.  The
  612.   directories /mnt and /usr are only mount points for use after the
  613.   boot/root system is running.  Hence again, these directories only need
  614.   to be created.
  615.  
  616.   The remaining four directories are described in the following
  617.   sections.
  618.  
  619.  
  620.  
  621.  
  622.  
  623.   4.3.1.  /dev
  624.  
  625.  
  626.  
  627.   A /dev directory containing a special file for all devices to be used
  628.   by the system is mandatory for any Linux system.  The directory itself
  629.   is a normal directory, and can be created with mkdir in the normal
  630.   way.  The device special files, however, must be created in a special
  631.   way, using the mknod command.
  632.  
  633.   There is a shortcut, though --- copy your existing /dev directory
  634.   contents, and delete the ones you don't want.  The only requirement is
  635.   that you copy the device special files using -R option.  This will
  636.   copy the directory without attempting to copy the contents of the
  637.   files.  Be sure to use an upper case R.  If you use the lower case
  638.   switch -r, you will probably end up copying the entire contents of all
  639.   of your hard disks --- or at least as much of them as will fit on a
  640.   diskette!  Therefore, take care, and use the command:
  641.  
  642.  
  643.           cp -dpR /dev /mnt
  644.  
  645.  
  646.  
  647.   assuming that the diskette is mounted at /mnt.  The dp switches ensure
  648.   that symbolic links are copied as links, rather than using the target
  649.   file, and that the original file attributes are preserved, thus
  650.   preserving ownership information.
  651.  
  652.   Alternatively, you can use the cpio program with the -p option,
  653.   because cpio handles device special files correctly, and will not try
  654.   to copy the contents.  For example, the commands:
  655.  
  656.  
  657.  
  658.        cd /dev
  659.        find . -print | cpio -pmd /mnt/dev
  660.  
  661.   will copy all device special files from /dev to /mnt/dev.  In fact it
  662.   will copy all files in the directory tree starting at /dev, and will
  663.   create any required subdirectories in the target directory tree.
  664.  
  665.   If you want to do it the hard way, use ls -l to display the major and
  666.   minor device numbers for the devices you want, and create them on the
  667.   diskette using mknod.
  668.  
  669.   However the devices are copied, it is worth checking that any special
  670.   devices you need have been placed on the rescue diskette.  For
  671.   example, ftape uses tape devices, so you will need to copy all of
  672.   these if you intend to access your floppy tape drive from the
  673.   bootdisk.
  674.  
  675.   Note that one inode is required for each device special file, and
  676.   inodes can at times be a scarce resource, especially on diskette
  677.   filesystems.  It therefore makes sense to remove any device special
  678.   files that you don't need from the diskette /dev directory.  Many
  679.   devices are obviously unnecessary on specific systems.  For example,
  680.   if you do not have SCSI disks you can safely remove all the device
  681.   files starting with sd.  Similarly, if you don't intend to use your
  682.   serial port then all device files starting with cua can go.
  683.  
  684.   Be sure to include the following files from this directory: console,
  685.   kmem, mem, null, ram, tty1.
  686.  
  687.  
  688.   4.3.2.  /etc
  689.  
  690.  
  691.   This directory must contain a number of configuration files.  On most
  692.   systems, these can be divided into three groups:
  693.  
  694.  
  695.   1. Required at all times, e.g. rc, fstab, passwd.
  696.  
  697.   2. May be required, but no-one is too sure.
  698.  
  699.   3. Junk that crept in.
  700.  
  701.   Files which are not essential can be identified with the command:
  702.  
  703.  
  704.  
  705.                ls -ltru
  706.  
  707.  
  708.  
  709.  
  710.   This lists files in reverse order of date last accessed, so if any
  711.   files are not being accessed, they can be omitted from a root
  712.   diskette.
  713.  
  714.   On my root diskettes, I have the number of config files down to 15.
  715.   This reduces my work to dealing with three sets of files:
  716.  
  717.  
  718.   1. The ones I must configure for a boot/root system:
  719.  
  720.  
  721.      a. rc.d/* --- system startup and run level change scripts
  722.  
  723.      b. fstab --- list of file systems to be mounted
  724.  
  725.      c. inittab --- parameters for the init process, the first process
  726.         started at boot time.
  727.   2. The ones I should tidy up for a boot/root system:
  728.  
  729.      a. passwd --- list of users, home directories, etc.
  730.  
  731.      b. group --- user groups.
  732.  
  733.      c. shadow --- passwords of users.  You may not have this.
  734.  
  735.  
  736.      If security is important, passwd and shadow should be pruned to
  737.      avoid copying user passwords off the system, and so that when you
  738.      boot from diskette, unwanted logins are rejected.  However, there
  739.      is a reason not to prune passwd and group.  tar (and probably other
  740.      archivers) stores user and group names with files.  If you restore
  741.      files to your hard disk from tape, the files will be restored with
  742.      their original names.  If these names do not exist in passwd/group
  743.      when they are restored, the UIDs/GIDs will not be correct.
  744.  
  745.      Be sure that passwd contains at least root.  If you intend other
  746.      users to login, be sure their home directories and shells exist.
  747.  
  748.   3. The rest. They work at the moment, so I leave them alone.
  749.  
  750.   Out of this, I only really have to configure two files, and what they
  751.   should contain is surprisingly small.
  752.  
  753.   ╖  rc should contain:
  754.  
  755.              #!/bin/sh
  756.              /bin/mount -av
  757.              /bin/hostname Kangaroo
  758.  
  759.  
  760.  
  761.   Be sure the directories are right.  You don't really need to run host¡
  762.   name --- it just looks nicer if you do.
  763.  
  764.   ╖  fstab should contain at least:
  765.  
  766.  
  767.              /dev/ram0       /               ext2    defaults
  768.              /dev/fd0        /               ext2    defaults
  769.              /proc           /proc           proc    defaults
  770.  
  771.  
  772.  
  773.   You can copy entries from your existing fstab, but you should not
  774.   automatically mount any of your hard disk partitions; use the noauto
  775.   keyword with them.  Your hard disk may be damaged or dead when the
  776.   bootdisk is used.
  777.  
  778.   Your inittab should be changed so that its sysinit line runs rc or
  779.   whatever basic boot script will be used.  Also, if you want to ensure
  780.   that users on serial ports cannot login, comment out all the entries
  781.   for getty which include a ttys or ttyS device at the end of the line.
  782.   Leave in the tty ports so that you can login at the console.
  783.  
  784.   A minimal inittab file looks like this:
  785.  
  786.           id:2:initdefault:
  787.           si::sysinit:/etc/rc
  788.           1:2345:respawn:/sbin/getty 9600 tty1
  789.           2:23:respawn:/sbin/getty 9600 tty2
  790.  
  791.  
  792.  
  793.   The inittab file defines what the system will run in various states
  794.   including startup, move to multi-user mode, etc.  A point to be
  795.   careful of here is to carefully check that the commands entered in
  796.   inittab refer to programs which are present and to the correct
  797.   directory.  If you place your command files on your rescue disk using
  798.   Section ``Sample rootdisk directory listings''  as a guide, and then
  799.   copy your inittab to your rescue disk without checking it, the
  800.   probability of failure will be quite high because half of the inittab
  801.   entries will refer to missing programs or to the wrong directory.
  802.  
  803.  
  804.   Note that some programs cannot be moved elsewhere because other
  805.   programs have hardcoded their locations.  For example on my system,
  806.   /etc/shutdown has hardcoded in it /etc/reboot.  If I move reboot to
  807.   /bin/reboot, and then issue a shutdown command, it will fail because
  808.   it cannot find the reboot file.
  809.  
  810.  
  811.   For the rest, just copy all the text files in your /etc directory,
  812.   plus all the executables in your /etc directory that you cannot be
  813.   sure you do not need.  As a guide, consult the sample listing in
  814.   Section ``Sample rootdisk directory listings''.  Probably it will
  815.   suffice to copy only those files, but systems differ a great deal, so
  816.   you cannot be sure that the same set of files on your system is
  817.   equivalent to the files in the list.  The only sure method is to start
  818.   with inittab and work out what is required.
  819.  
  820.   Most systems now use an /etc/rc.d/ directory containing shell scripts
  821.   for different run levels.  The minimum is a single rc script, but it
  822.   may be simpler just to copy inittab and the /etc/rc.d directory from
  823.   your existing system, and prune the shell scripts in the rc.d
  824.   directory to remove processing not relevent to a diskette system
  825.   environment.
  826.  
  827.  
  828.   4.3.3.  /bin and /sbin
  829.  
  830.  
  831.   The /bin directory is a convenient place for extra utilities you need
  832.   to perform basic operations, utilities such as ls, mv, cat and dd.
  833.   See Appendix ``Sample rootdisk directory listings'' for an example
  834.   list of files that go in a /bin and /sbin directories.  It does not
  835.   include any of the utilities required to restore from backup, such as
  836.   cpio, tar and gzip.  That is because I place these on a separate
  837.   utility diskette, to save space on the boot/root diskette.  Once the
  838.   boot/root diskette is booted, it is copied to the ramdisk leaving the
  839.   diskette drive free to mount another diskette, the utility diskette.
  840.   I usually mount this as /usr.
  841.  
  842.   Creation of a utility diskette is described below in the section
  843.   Section ``Building a utility disk''.  It is probably desirable to
  844.   maintain a copy of the same version of backup utilities used to write
  845.   the backups so you don't waste time trying to install versions that
  846.   cannot read your backup tapes.
  847.  
  848.   Make sure you include the following programs: init, getty or
  849.   equivalent, login, mount, some shell capable of running your rc
  850.   scripts, a link from sh to the shell.
  851.  
  852.  
  853.  
  854.  
  855.   4.3.4.  /lib
  856.  
  857.  
  858.  
  859.   In /lib you place necessary shared libraries and loaders.  If the
  860.   necessary libraries are not found in your /lib directory then the
  861.   system will be unable to boot.  If you're lucky you may see an error
  862.   message telling you why.
  863.  
  864.   Nearly every program requires at least the libc library, libc.so.N,
  865.   where N is the current version number.  Check your /lib directory.
  866.   libc.so.5 is usually a symlink to a filename with a complete version
  867.   number:
  868.  
  869.  
  870.  
  871.        % ls -l /lib/libc.so*
  872.        lrwxrwxrwx  1 root root      14 Nov  1 20:34 /lib/libc.so.5 -> libc.so.5.4.33*
  873.        -rwxr-xr-x  1 root root  573176 Jun 12 02:05 /lib/libc.so.5.4.33*
  874.  
  875.  
  876.  
  877.  
  878.   In this case, you want libc.so.5.4.33.  To find other libraries you
  879.   should go through all the binaries you plan to include and check their
  880.   dependencies with the ldd command.  For example:
  881.  
  882.  
  883.           % ldd /sbin/mke2fs
  884.                   libext2fs.so.2 => /lib/libext2fs.so.2
  885.                   libcom_err.so.2 => /lib/libcom_err.so.2
  886.                   libuuid.so.1 => /lib/libuuid.so.1
  887.                   libc.so.5 => /lib/libc.so.5
  888.  
  889.  
  890.  
  891.   Each file on the right-hand side is required.  Keep in mind that the
  892.   libraries listed may be symbolic links.
  893.  
  894.   In /lib you must also include a loader for the libraries.  or ld-
  895.   linux.so (for ELF libraries).  not sure which you need, run the file
  896.   command on the library.  For example:
  897.  
  898.  
  899.           % file /lib/libc.so.5.4.33 /lib/libc.so.4.7.2
  900.           /lib/libc.so.4.7.2: Linux/i386 demand-paged executable (QMAGIC), stripped
  901.           /lib/libc.so.5.4.33: ELF 32-bit LSB shared object, Intel 386, version 1, stripped
  902.  
  903.  
  904.  
  905.   The QMAGIC indicates that 4.7.2 is for a.out libraries, and ELF
  906.   indicates that 5.4.33 is for ELF.
  907.  
  908.   Copy the specific loader(s) you need to the root filesystem you're
  909.   building.  Libraries and loaders should be checked carefully against
  910.   the included binaries.  If the kernel cannot load a necessary library,
  911.   the kernel will usually hang with no error message.
  912.  
  913.  
  914.   4.4.  Modules.
  915.  
  916.  
  917.   If you have a modular kernel, you must consider which modules you may
  918.   want to load from your bootdisk after booting.  You might want to
  919.   include ftape and zftape modules if your backup tapes are on floppy
  920.   tape, modules for SCSI devices if you have them, and possibly modules
  921.   for PPP or SLIP support if you want to access the net in an emergency.
  922.  
  923.   These modules may be placed in /lib/modules.  You should also include
  924.   insmod, rmmod and lsmod.  Depending on whether you want to load
  925.   modules automatically, you might also include modprobe, depmod and
  926.   swapout.  If you use kerneld, include it along with /etc/conf.modules.
  927.  
  928.   However, the main advantage to using modules is that you can move non-
  929.   critical modules to a utility disk and load them when needed, thus
  930.   using less space on your root disk.  If you may have to deal with many
  931.   different devices, this approach is preferable to building one huge
  932.   kernel with many drivers built in.
  933.  
  934.   Note that in order to boot a compressed ext2 filesystem, you must have
  935.   ramdisk and ext2 support built-in.  They cannot be supplied as
  936.   modules.
  937.  
  938.  
  939.  
  940.   4.5.  Some final details.
  941.  
  942.  
  943.   Some system programs, such as login, complain if the file
  944.   /var/run/utmp and the directory /var/log do not exist.
  945.  
  946.  
  947.           mkdir -p /mnt/var/{log,run}
  948.           touch /mnt/var/run/utmp
  949.  
  950.  
  951.  
  952.   Finally, after you have set up all the libraries you need, run
  953.   ldconfig to remake /etc/ld.so.cache on the root filesystem.  The cache
  954.   tells the loader where to find the libraries.  To remake ld.so.cache,
  955.   issue the following commands:
  956.  
  957.  
  958.           chdir /mnt; chroot /mnt /sbin/ldconfig
  959.  
  960.  
  961.  
  962.   The chroot is necessary because ldconfig always remakes the cache for
  963.   the root filesystem.
  964.  
  965.  
  966.   4.6.  Wrapping it up.
  967.  
  968.  
  969.   Once you have finished constructing the root filesystem, unmount it,
  970.   copy it to a file and compress it:
  971.  
  972.  
  973.           umount /mnt
  974.           dd if=DEVICE bs=1k | gzip -v9 > rootfs.gz
  975.  
  976.  
  977.  
  978.   This may take several minutes.  When it finishes you will have a file
  979.   rootfs.gz that is your compressed root filesystem.  You should check
  980.   its size to make sure it will fit on a diskette; if it doesn't you'll
  981.   have to go back and remove some files.  Section ``Reducing root
  982.   filesystem size'' has some hints for reducing the size of the root
  983.   filesystem.
  984.  
  985.  
  986.  
  987.   5.  Choosing a kernel.
  988.  
  989.  
  990.  
  991.   At this point you have a complete compressed root filesystem.  The
  992.   next step is to build or select a kernel.  In most cases it would be
  993.   possible to copy your current kernel and boot the diskette from that.
  994.   However, there may be cases where you wish to build a separate one.
  995.  
  996.   One reason is size.  If you are building a single boot/root diskette,
  997.   the kernel will be one of the largest files on the diskette so you
  998.   will have to reduce the size of the kernel as much as possible.  If
  999.   you are building a two-disk boot+root diskette, this is not a concern
  1000.   since the kernel will go on a separate disk.
  1001.  
  1002.   To reduce kernel size, build it with the minumum set of facilities
  1003.   necessary to support the desired system.  This means leaving out
  1004.   everything you don't need.  Networking is a good thing to leave out,
  1005.   as well as support for any disk drives and other devices which you
  1006.   don't need when running your boot/root system.  As stated before, your
  1007.   kernel must have ramdisk and ext2 support built into it.
  1008.  
  1009.   Having worked out a minimum set of facilities to include in a kernel,
  1010.   you then need to work out what to add back in.  Probably the most
  1011.   common uses for a boot/root diskette system would be to examine and
  1012.   restore a corrupted root file system, and to do this you may need
  1013.   kernel support.  For example, if your backups are all held on tape
  1014.   using Ftape to access your tape drive, then, if you lose your current
  1015.   root drive and drives containing Ftape, then you will not be able to
  1016.   restore from your backup tapes.  You will have to reinstall Linux,
  1017.   download and reinstall ftape, and then try to read your backups.
  1018.  
  1019.   The point here is that, whatever I/O support you have added to your
  1020.   kernel to support backups should also be added into your boot/root
  1021.   kernel.
  1022.  
  1023.  
  1024.   The procedure for actually building the kernel is described in the
  1025.   documentation that comes with the kernel.  It is quite easy to follow,
  1026.   so start by looking in /usr/src/linux.  Note that if you have trouble
  1027.   building a kernel, then you should probably not attempt to build
  1028.   boot/root systems anyway.  Remember to compress the kernel with ``make
  1029.   zImage''.
  1030.  
  1031.  
  1032.  
  1033.   6.  Putting them together: Making the disk(s).
  1034.  
  1035.  
  1036.   At this point you have a kernel and a compressed root filesystem.  If
  1037.   you are making a boot/root disk, check their sizes to make sure they
  1038.   will both fit on one disk.  If you are making a two disk boot+root
  1039.   set, check the root filesystem to make sure it will fit on a single
  1040.   diskette.
  1041.  
  1042.   You should decide whether to use LILO to boot the bootdisk kernel.
  1043.   The alternative is to copy the kernel directly to the diskette and
  1044.   boot without LILO.  The advantage of using LILO is that it enables you
  1045.   to supply some parameters to the kernel which may be necessary to
  1046.   initialize your hardware (Check the file /etc/lilo.conf on your
  1047.   system.  If it exists and has a line like ``append=...'', you probably
  1048.   need this feature).  The disadvantage of using LILO is that building
  1049.   the bootdisk is more complicated, and takes slightly more space.  You
  1050.   will have to set up a small separate filesystem, which we shall call
  1051.   the kernel filesystem, where you transfer the kernel and a few other
  1052.   files that LILO needs.
  1053.  
  1054.  
  1055.   If you are going to use LILO, read on; if you are going to transfer
  1056.   the kernel directly, skip ahead to the section ``Without using LILO''.
  1057.   6.1.  Transferring the kernel with LILO
  1058.  
  1059.  
  1060.   The first thing you must do is create a small configuration file for
  1061.   LILO.  It should look like this:
  1062.  
  1063.  
  1064.   ______________________________________________________________________
  1065.           boot      =/dev/fd0
  1066.           install   =/boot/boot.b
  1067.           map       =/boot/map
  1068.           read-write
  1069.           backup    =/dev/null
  1070.           compact
  1071.           image     = KERNEL
  1072.           label     = Bootdisk
  1073.           root      =/dev/fd0
  1074.   ______________________________________________________________________
  1075.  
  1076.  
  1077.  
  1078.   For an explanation of these parameters, see LILO's user documentation.
  1079.   You will probably also want to add an append=... line to this file
  1080.   from your hard disk's /etc/lilo.conf file.
  1081.  
  1082.   Save this file as bdlilo.conf.
  1083.  
  1084.   You now have to create a small filesystem, which we shall call a
  1085.   kernel filesystem, to distinguish it from the root filesystem.
  1086.  
  1087.   First, figure out how large the filesystem should be.  Take the size
  1088.   of your kernel in blocks (the size shown by ``ls -l KERNEL'' divided
  1089.   by 1024 and rounded up) and add 50.  Fifty blocks is approximately the
  1090.   space needed for inodes plus other files.  You can calculate this
  1091.   number exactly if you want to, or just use 50.  If you're creating a
  1092.   two-disk set, you may as well overestimate the space since the first
  1093.   disk is only used for the kernel anyway.  Call this number
  1094.   KERNEL_BLOCKS.
  1095.  
  1096.   Put a floppy diskette in the drive (for simplicity we'll assume
  1097.   /dev/fd0) and create an ext2 kernel filesystem on it:
  1098.  
  1099.  
  1100.           mke2fs -i 8192 -m 0 /dev/fd0 KERNEL_BLOCKS
  1101.  
  1102.  
  1103.  
  1104.  
  1105.   The ``-i 8192'' specifies that we want one inode per 8192 bytes.
  1106.   Next, mount the filesystem, remove the lost+found directory, and
  1107.   create dev and boot directories for LILO:
  1108.  
  1109.  
  1110.           mount /dev/fd0 /mnt
  1111.           rm -rf /mnt/lost+found
  1112.           mkdir /mnt/{boot,dev}
  1113.  
  1114.  
  1115.  
  1116.   Next, create devices /dev/null and /dev/fd0.  Instead of looking up
  1117.   the device numbers, you can just copy them from your hard disk using
  1118.   -R:
  1119.  
  1120.  
  1121.           cp -R /dev/{null,fd0} /mnt/dev
  1122.  
  1123.   LILO needs a copy of its boot loader, boot.b, which you can take from
  1124.   your hard disk.  It is usually kept in the /boot directory.
  1125.  
  1126.  
  1127.           cp /boot/boot.b /mnt/boot
  1128.  
  1129.  
  1130.  
  1131.   Finally, copy in the LILO configuration file you created in the last
  1132.   section, along with your kernel.  Both can be put in the root
  1133.   directory:
  1134.  
  1135.  
  1136.           cp bdlilo.conf KERNEL /mnt
  1137.  
  1138.  
  1139.  
  1140.   Everything LILO needs is now on the kernel filesystem, so you are
  1141.   ready to run it.  LILO's -r flag is used for installing the boot
  1142.   loader on some other root:
  1143.  
  1144.  
  1145.           lilo -v -C bdlilo.conf -r /mnt
  1146.  
  1147.  
  1148.  
  1149.   LILO should run without error, after which the kernel filesystem
  1150.   should look something like this:
  1151.  
  1152.  
  1153.   ______________________________________________________________________
  1154.   total 361
  1155.     1 -rw-r--r--   1 root     root          176 Jan 10 07:22 bdlilo.conf
  1156.     1 drwxr-xr-x   2 root     root         1024 Jan 10 07:23 boot/
  1157.     1 drwxr-xr-x   2 root     root         1024 Jan 10 07:22 dev/
  1158.   358 -rw-r--r--   1 root     root       362707 Jan 10 07:23 vmlinuz
  1159.   boot:
  1160.   total 8
  1161.     4 -rw-r--r--   1 root     root         3708 Jan 10 07:22 boot.b
  1162.     4 -rw-------   1 root     root         3584 Jan 10 07:23 map
  1163.   dev:
  1164.   total 0
  1165.     0 brw-r-----   1 root     root       2,   0 Jan 10 07:22 fd0
  1166.     0 crw-r--r--   1 root     root       1,   3 Jan 10 07:22 null
  1167.   ______________________________________________________________________
  1168.  
  1169.  
  1170.  
  1171.   Do not worry if the file sizes are slightly different from yours.
  1172.  
  1173.   Now leave the disk in the drive and go to section ``Setting the
  1174.   ramdisk word''.
  1175.  
  1176.  
  1177.   6.2.  Transferring the kernel without LILO.
  1178.  
  1179.  
  1180.   If you are not using LILO, transfer the kernel to the bootdisk with
  1181.   the dd command:
  1182.  
  1183.  
  1184.           % dd if=KERNEL of=/dev/fd0 bs=1k
  1185.           353+1 records in
  1186.           353+1 records out
  1187.  
  1188.  
  1189.   In this example, dd wrote 353 complete records + 1 partial record, so
  1190.   the kernel occupies the first 354 blocks of the diskette.  Call this
  1191.   number KERNEL_BLOCKS and remember it because you use it in the next
  1192.   section.
  1193.  
  1194.   Finally, set the root device to be the diskette itself, then set the
  1195.   root to be loaded read/write:
  1196.  
  1197.  
  1198.           rdev /dev/fd0 /dev/fd0
  1199.           rdev -R /dev/fd0 0
  1200.  
  1201.  
  1202.  
  1203.  
  1204.   Be careful to use a capital -R in the second rdev command.
  1205.  
  1206.  
  1207.  
  1208.   6.3.  Setting the ramdisk word.
  1209.  
  1210.  
  1211.   Inside the kernel image is the ramdisk word that specifies where the
  1212.   root filesystem is to be found, along with other options.  The word is
  1213.   defined in /usr/src/linux/arch/i386/kernel/setup.c and is interpreted
  1214.   as follows:
  1215.  
  1216.  
  1217.           bits  0-10:     Offset to start of ramdisk, in 1024 byte blocks
  1218.           bits 11-13:     unused
  1219.           bit     14:     Flag indicating that ramdisk is to be loaded
  1220.           bit     15:     Flag indicating to prompt before loading rootfs
  1221.  
  1222.  
  1223.  
  1224.   If bit 15 is set, on boot-up you will be prompted to place a new
  1225.   floppy diskette in the drive.  This is necessary for a two-disk boot
  1226.   set.
  1227.  
  1228.   There are two cases, depending on whether you are building a single
  1229.   boot/root diskette or a double ``boot+root'' diskette set.
  1230.  
  1231.  
  1232.   1. If you are building a single disk, the compressed root filesystem
  1233.      will be placed right after the kernel, so the offset will be the
  1234.      first free block (which should be the same as KERNEL_BLOCKS).  Bit
  1235.      14 will be set to 1, and bit 15 will be zero.
  1236.  
  1237.   2. If you are building a two-disk set, the root filesystem will begin
  1238.      at block zero of the second disk, so the offset will be zero.  Bit
  1239.      14 will be set to 1, and bit 15 will be 1.
  1240.  
  1241.   After carefully calculating the value for the ramdisk word, set it
  1242.   with rdev -r.  value.  If you used LILO, the argument to rdev here
  1243.   should be the mounted kernel path, e.g. /mnt/vmlinuz; if you copied
  1244.   the kernel with dd, instead use the floppy device name (e.g.,
  1245.   /dev/fd0).
  1246.  
  1247.  
  1248.           rdev -r KERNEL_OR_FLOPPY_DRIVE  VALUE
  1249.  
  1250.  
  1251.  
  1252.   If you used LILO, unmount the diskette now.
  1253.  
  1254.  
  1255.   6.4.  Transferring the root filesystem.
  1256.  
  1257.  
  1258.   The last step is to transfer the root filesystem.
  1259.  
  1260.  
  1261.   ╖  If the root filesystem will be placed on the same disk as the
  1262.      kernel, transfer it using dd with the seek option, which specifies
  1263.      how many blocks to skip:
  1264.  
  1265.  
  1266.              dd if=rootfs.gz of=/dev/fd0 bs=1k seek=KERNEL_BLOCKS
  1267.  
  1268.  
  1269.  
  1270.   ╖  If the root filesystem will be placed on a second disk, remove the
  1271.      first diskette, put the second diskette in the drive, then transfer
  1272.      the root filesystem to it:
  1273.  
  1274.  
  1275.              dd if=rootfs.gz of=/dev/fd0 bs=1k
  1276.  
  1277.  
  1278.  
  1279.   Congratulations, you are done!
  1280.  
  1281.   =====  You should always test a bootdisk before putting it aside for
  1282.   an emergency! =====
  1283.  
  1284.  
  1285.   7.  Troubleshooting, or The Agony of Defeat.
  1286.  
  1287.  
  1288.  
  1289.   When building bootdisks, the first few tries often will not boot.  The
  1290.   general approach to building a root disk is to assemble components
  1291.   from your existing system, and try and get the diskette-based system
  1292.   to the point where it displays messages on the console.  Once it
  1293.   starts talking to you, the battle is half over because you can see
  1294.   what it is complaining about, and you can fix individual problems
  1295.   until the system works smoothly.  If the system just hangs with no
  1296.   explanation, finding the cause can be difficult.  To get a system to
  1297.   boot to the stage where it will talk to you requires several
  1298.   components to be present and correctly configured.  The recommended
  1299.   procedure for investigating the problem where the system will not talk
  1300.   to you is as follows:
  1301.  
  1302.  
  1303.   ╖  Check that the root disk actually contains the directories you
  1304.      think it does.  It is easy to copy at the wrong level so that you
  1305.      end up with something like /rootdisk/bin instead of /bin on your
  1306.      root diskette.
  1307.  
  1308.   ╖  Check that there is a /lib/libc.so with the same link that appears
  1309.      in your /lib directory on your hard disk.
  1310.  
  1311.   ╖  Check that any symbolic links in your /dev directory in your
  1312.      existing system also exist on your root diskette filesystem, where
  1313.      those links are to devices which you have included in your root
  1314.      diskette. In particular, /dev/console links are essential in many
  1315.      cases.
  1316.  
  1317.   ╖  Check that you have included /dev/tty1, /dev/null, /dev/zero,
  1318.      /dev/mem, /dev/ram and /dev/kmem files.
  1319.  
  1320.  
  1321.   ╖  Check your kernel configuration --- support for all resources
  1322.      required up to login point must be built in, not modules.  So
  1323.      ramdisk and ext2 support must be built-in.
  1324.  
  1325.   ╖  Check that your kernel root device and ramdisk settings are
  1326.      correct.
  1327.  
  1328.   Once these general aspects have been covered, here are some more
  1329.   specific files to check:
  1330.  
  1331.  
  1332.   1. Make sure init is included as /sbin/init or /bin/init.  Make sure
  1333.      it is executable.
  1334.  
  1335.   2. Run ldd init to check init's libraries.  Usually this is just
  1336.      libc.so, but check anyway.  Make sure you included the necessary
  1337.      libraries and loaders.
  1338.  
  1339.   3. Make sure you have the right loader for your libraries --- ld.so
  1340.      for a.out or ld-linux.so for ELF.
  1341.  
  1342.   4. Check the /etc/inittab on your bootdisk filesystem for the calls to
  1343.      getty (or some getty-like program, such as agetty, mgetty or
  1344.      getty_ps).  your hard disk inittab.  Check the man pages of the
  1345.      program you use to make sure these make sense.  inittab is possibly
  1346.      the trickiest part because its syntax and content depend on the
  1347.      init program used and the nature of the system.  The only way to
  1348.      tackle it is to read the man pages for init and inittab and work
  1349.      out exactly what your existing system is doing when it boots.
  1350.      Check to make sure /etc/inittab has a system initialisation entry.
  1351.      This should contain a command to execute the system initialization
  1352.      script, which must exist.
  1353.  
  1354.   5. As with init, run ldd on your getty to see what it needs, and make
  1355.      sure the necessary library files and loaders were included in your
  1356.      root filesystem.
  1357.  
  1358.   6. Be sure you have included a shell program (e.g., bash or ash)
  1359.      capable of running all of your rc scripts.
  1360.  
  1361.   7. If you have a /etc/ld.so.cache file on your rescue disk, remake it.
  1362.  
  1363.  
  1364.  
  1365.   If init starts, but you get a message like:
  1366.  
  1367.           Id xxx respawning too fast: disabled for 5 minutes
  1368.  
  1369.  
  1370.  
  1371.  
  1372.   it is coming from init, usually indicating that getty or login is
  1373.   dying as soon as it starts up.  executables and the libraries they
  1374.   depend upon.  Make sure the invocations in /etc/inittab are correct.
  1375.   If you get strange messages from getty, it may mean the calling form
  1376.   in /etc/inittab is wrong.  The options of the getty programs are
  1377.   variable; even different versions of agetty are reported to have
  1378.   different incompatible calling forms.
  1379.  
  1380.   If you try to run some executable, such as df, which is on your rescue
  1381.   disk but you yields a message like: df: not found, check two things:
  1382.   (1) Make sure the directory containing the binary is in your PATH, and
  1383.   (2) make sure you have libraries (and loaders) the program needs.
  1384.  
  1385.  
  1386.  
  1387.   8.  Miscellaneous topics.
  1388.  
  1389.  
  1390.  
  1391.   8.1.  Reducing root filesystem size.
  1392.  
  1393.  
  1394.   Sometimes a root filesystem is too large to fit on a diskette even
  1395.   after compression.  Here are some ways to reduce the filesystem size,
  1396.   listed in decreasing order of effectiveness:
  1397.  
  1398.  
  1399.  
  1400.      Increase the disk density
  1401.         By default, floppy diskettes are formatted at 1440K, but higher
  1402.         density formats are available.  fdformat will format disks for
  1403.         the following sizes: 1600, 1680, 1722, 1743, 1760, 1840, and
  1404.         1920.  Most 1440K drives will support 1722K, and this is what I
  1405.         always use for bootdisks.  See the fdformat man page and
  1406.         /usr/src/linux/Documentation/devices.txt.
  1407.  
  1408.  
  1409.      Replace your shell
  1410.         Some of the popular shells for Linux, such as bash and tcsh, are
  1411.         large and require many libraries.  Light-weight alternatives
  1412.         exist, such as ash, lsh, kiss and smash, which are much smaller
  1413.         and require few (or no) libraries.  Most of these replacement
  1414.         shells are available from
  1415.         <http://sunsite.unc.edu/pub/Linux/system/shells/>.  Make sure
  1416.         any shell you use is capable of running commands in all the rc
  1417.         files you include on your bootdisk.
  1418.  
  1419.  
  1420.      Strip libraries and binaries
  1421.         are typically unstripped (include debugging symbols).  Running
  1422.         'file' on these files will tell you 'not stripped' if so.  When
  1423.         copying binaries to your root filesystem, it is good practice to
  1424.         use:
  1425.  
  1426.  
  1427.                 objcopy --strip-all FROM TO
  1428.  
  1429.  
  1430.  
  1431.      When copying libraries, use:
  1432.  
  1433.  
  1434.              objcopy --strip-debug FROM TO
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.      Move non-critical files to a utility disk
  1441.         If some of your binaries are not needed immediately to boot or
  1442.         login, you can move them to a utility disk.  See section
  1443.         ``Building a utility disk'' for details.  You may also consider
  1444.         moving modules to a utility disk as well.
  1445.  
  1446.  
  1447.  
  1448.   8.2.  Non-ramdisk root filesystems.
  1449.  
  1450.  
  1451.  
  1452.  
  1453.   Section ``Building a root filesystem'' gave instructions for building
  1454.   a compressed root filesystem which is loaded to ramdisk when the
  1455.   system boots.  This method has many advantages so it is commonly used.
  1456.   However, some systems with little memory cannot afford the RAM needed
  1457.   for this; for such cases a root filesystem can be built that is
  1458.   mounted directly instead of copied to ramdisk.
  1459.  
  1460.   Such filesystems are actually easier to build than compressed root
  1461.   filesystems because they can be built on a diskette rather than on
  1462.   some other device, and they do not have to be compressed.  We will
  1463.   outline the procedure as it differs from the instructions above.  If
  1464.   you choose to do this, keep in mind that you will have far less space
  1465.   available.
  1466.  
  1467.  
  1468.   1. Calculate how much space you will have available for root files.
  1469.  
  1470.      If you are building a single boot/root disk, you must fit all
  1471.      blocks for the kernel plus all blocks for the root filesystem on
  1472.      the one disk.
  1473.  
  1474.   2. Using mke2fs, create a root filesystem on a diskette of the
  1475.      appropriate size.
  1476.  
  1477.   3. Populate the filesystem as described above.
  1478.  
  1479.   4. When done, unmount the filesystem and transfer it to a disk file
  1480.      but do not compress it.
  1481.  
  1482.   5. Transfer the kernel to a floppy diskette, as described above.  When
  1483.      calculating the ramdisk word, set bit 14 to zero, to indicate that
  1484.      the root filesystem is not to be loaded to ramdisk.  Run the rdev's
  1485.      as described.
  1486.  
  1487.   6. Transfer the root filesystem as before.
  1488.  
  1489.   There are several shortcuts you can take.  If you are building a two-
  1490.   disk set, you can build the complete root filesystem directly on the
  1491.   second disk and you need not transfer it to a hard disk file and then
  1492.   back.  Also, if you are building a single boot/root disk and using
  1493.   LILO, you can build a single filesystem on the entire disk, containing
  1494.   the kernel, LILO files and root files, and simply run LILO as the last
  1495.   step.
  1496.  
  1497.  
  1498.  
  1499.   8.3.  Building a utility disk.
  1500.  
  1501.  
  1502.  
  1503.   Building a utility disk is relatively easy --- simply create a
  1504.   filesystem on a formatted disk and copy files to it.  To use it with a
  1505.   bootdisk, mount it manually after the system is booted.
  1506.  
  1507.   In the instructions above, we mentioned that the utility disk could be
  1508.   mounted as /usr.  In this case, binaries could be placed into a /bin
  1509.   directory on your utility disk, so that placing /usr/bin in your path
  1510.   will access them.  Additional libraries needed by the binaries are
  1511.   placed in /lib on the utility disk.
  1512.  
  1513.   There are several important points to keep in mind when designing a
  1514.   utility disk:
  1515.  
  1516.  
  1517.   1. Do not place critical system binaries or libraries onto the utility
  1518.      disk, since it will not be mountable until after the system has
  1519.      booted.
  1520.  
  1521.   2. You cannot access a floppy diskette and a floppy tape drive
  1522.      simultaneously.  This means that if you have a floppy tape drive,
  1523.      you will not be able to access it while your utility disk is
  1524.      mounted.
  1525.  
  1526.   3. Access to files on the utility disk will be slow.
  1527.  
  1528.   Appendix ``Sample utility disk directory listing'' shows a sample of
  1529.   files on a utility disk.  Here are some ideas for files you may find
  1530.   useful: programs for examining and manipulating disks (format, fdisk)
  1531.   and filesystems (mke2fs, fsck, isofs.o), a lightweight text editor
  1532.   (elvis, jove), compression and archive utilities (gzip, tar, cpio,
  1533.   afio), tape utilities (mt, tob, taper), communications utilities
  1534.   (ppp.o, slip.o, minicom) and utilities for devices (setserial, mknod).
  1535.  
  1536.  
  1537.   9.  How the pros do it.
  1538.  
  1539.  
  1540.   You may notice that the bootdisks used by major distributions such as
  1541.   Slackware, RedHat or Debian, seem more sophisticated than what is
  1542.   described in this document.  Professional distribution bootdisks are
  1543.   based on the same principles outlined here, but employ various tricks
  1544.   because their bootdisks have additional requirements.  First, they
  1545.   must be able to work with a wide variety of hardware, so they must be
  1546.   able to interact with the user and load various device drivers.
  1547.   Second, they must be prepared to work with many different installation
  1548.   options, with varying degrees of automation.  Finally, distribution
  1549.   bootdisks usually combine installation and rescue capabilities.
  1550.  
  1551.   Some bootdisks use a feature called initrd (initial ramdisk).  2.0.x
  1552.   and provides greater flexibility by allowing a kernel to boot in two
  1553.   phases.  When the kernel first boots, it loads an initial ramdisk
  1554.   image from the boot disk.  This initial ramdisk is a root filesystem
  1555.   containing a program that runs before the real root fs is loaded.
  1556.   This program usually inspects the environment and/or asks the user to
  1557.   select various boot options, such as the device from which to load the
  1558.   real rootdisk.  It typically loads additional modules not built in to
  1559.   the kernel.  When this initial program exits, the kernel loads the
  1560.   real root image and booting continues normally.  For further
  1561.   information on initrd, see /usr/src/linux/Documentation/initrd.txt and
  1562.   <ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz>
  1563.  
  1564.   The following are summaries of how each distribution's installation
  1565.   disks seem to work, based on inspecting their filesystems and/or
  1566.   source code.  We do not guarantee that this information is completely
  1567.   accurate, or that they have not changed since the versions noted.
  1568.  
  1569.   Slackware (v.3.1) uses a straightforward LILO boot similar to what is
  1570.   described in section ``Transferring the kernel with LILO''.  The
  1571.   Slackware bootdisk prints a bootup message (``Welcome to the Slackware
  1572.   Linux bootkernel disk!'') using LILO's message parameter.  This
  1573.   instructs the user to enter a boot parameter line if necessary.  After
  1574.   booting, a root filesystem is loaded from a second disk.  The user
  1575.   invokes a setup script which starts the installation.  Instead of
  1576.   using a modular kernel, Slackware provides many different kernels and
  1577.   depends upon the user to select the one matching his or her hardware
  1578.   requirements.
  1579.  
  1580.   RedHat (v.4.0) also uses a LILO boot.  It loads a compressed ramdisk
  1581.   on the first disk, which runs a custom init program.  This program
  1582.   queries for drivers, and loads additional files from a supplemental
  1583.   disk if necessary.
  1584.  
  1585.   Debian (v.1.3) is probably the most sophisticated of the installation
  1586.   disk sets.  It uses the SYSLINUX loader to arrange various load
  1587.   options, then uses an initrd image to guide the user through
  1588.   installation.  It appears to use both a customized init and a
  1589.   customized shell.
  1590.  
  1591.  
  1592.  
  1593.   10.  Frequently asked question (FAQ) list.
  1594.  
  1595.  
  1596.   Q. I boot from my boot/root disks and nothing happens. What do I do?
  1597.  
  1598.  
  1599.   See section ``Troubleshooting'', above.
  1600.  
  1601.   Q. How does the Slackware/Debian/RedHat bootdisk work?
  1602.  
  1603.  
  1604.   See section ``What the pros do'', above.
  1605.  
  1606.  
  1607.   Q. How can I make a boot disk with a XYZ driver?
  1608.  
  1609.  
  1610.   The easiest way is to obtain a Slackware kernel from your nearest
  1611.   Slackware mirror site. Slackware kernels are generic kernels which
  1612.   atttempt to include drivers for as many devices as possible, so if you
  1613.   have a SCSI or IDE controller, chances are that a driver for it is
  1614.   included in the Slackware kernel.
  1615.  
  1616.   Go to the a1 directory and select either IDE or SCSI kernel depending
  1617.   on the type of controller you have. Check the xxxxkern.cfg file for
  1618.   the selected kernel to see the drivers which have been included in
  1619.   that kernel. If the device you want is in that list, then the
  1620.   corresponding kernel should boot your computer. Download the
  1621.   xxxxkern.tgz file and copy it to your boot diskette as described above
  1622.   in the section on making boot disks.
  1623.  
  1624.   You must then check the root device in the kernel, using the rdev
  1625.   command:
  1626.  
  1627.           rdev zImage
  1628.  
  1629.  
  1630.  
  1631.   rdev will then display the current root device in the kernel.  If this
  1632.   is not the same as the root device you want, then use rdev to change
  1633.   it.  For example, the kernel I tried was set to /dev/sda2, but my root
  1634.   SCSI partition is /dev/sda8.  To use a root diskette, you would have
  1635.   to use the command:
  1636.  
  1637.  
  1638.           rdev zImage /dev/fd0
  1639.  
  1640.  
  1641.  
  1642.   If you want to know how to set up a Slackware root disk as well,
  1643.   that's outside the scope of this HOWTO, so I suggest you check the
  1644.   Linux Install Guide or get the Slackware distribution.  See the
  1645.   section in this HOWTO titled ``References''.
  1646.  
  1647.   Q. How do I update my boot diskette with a new kernel?
  1648.  
  1649.  
  1650.  
  1651.   Just copy the kernel to your boot diskette using the dd command for a
  1652.   boot diskette without a filesystem, or the cp command for a boot/root
  1653.   disk. Refer to the section in this HOWTO titled ``Boot'' for details
  1654.   on creating a boot disk. The description applies equally to updating a
  1655.   kernel on a boot disk.
  1656.  
  1657.   Q. How do I update my root diskette with new files?
  1658.  
  1659.  
  1660.   The easiest way is to copy the filesystem from the rootdisk back to
  1661.   the DEVICE you used (from section ``Creating the filesystem'', above).
  1662.   Then mount the filesystem and make the changes.  You have to remember
  1663.   where your root filesystem started and how many blocks it occupied:
  1664.  
  1665.  
  1666.           dd if=/dev/fd0 bs=1k skip=ROOTBEGIN count=BLOCKS | gunzip > DEVICE
  1667.           mount -t ext2 DEVICE /mnt
  1668.  
  1669.  
  1670.  
  1671.   After making the changes, proceed as before (in Section ``Wrapping it
  1672.   up'') and transfer the root filesystem back to the disk.  You should
  1673.   not have to re-transfer the kernel or re-compute the ramdisk word if
  1674.   you do not change the starting position of the new root filesystem.
  1675.  
  1676.  
  1677.   Q. How do I remove LILO so that I can use DOS to boot again?
  1678.  
  1679.  
  1680.   This is not really a Bootdisk topic, but it is asked often.  Within
  1681.   Linux, you can run:
  1682.  
  1683.  
  1684.  
  1685.                /sbin/lilo -u
  1686.  
  1687.  
  1688.  
  1689.  
  1690.   You can also use the dd command to copy the backup saved by LILO to
  1691.   the boot sector.  Refer to the LILO documentation if you wish to do
  1692.   this.
  1693.  
  1694.   Within DOS and Windows you can use the DOS command:
  1695.  
  1696.  
  1697.                FDISK /MBR
  1698.  
  1699.  
  1700.  
  1701.  
  1702.   MBR stands for Master Boot Record, and it replaces the boot sector
  1703.   with a clean DOS one, without affecting the partition table.  Some
  1704.   purists disagree with this, but even the author of LILO, Werner
  1705.   Almesberger, suggests it.  It is easy, and it works.
  1706.  
  1707.  
  1708.  
  1709.   Q. How can I boot if I've lost my kernel and my boot disk?
  1710.  
  1711.  
  1712.   If you don't have a boot disk standing by, probably the easiest method
  1713.   is to obtain a Slackware kernel for your disk controller type (IDE or
  1714.   SCSI) as described above for ``How do I make a boot disk with a XXX
  1715.   driver?''.  You can then boot your computer using this kernel, then
  1716.   repair whatever damage there is.
  1717.   The kernel you get may not have the root device set to the disk type
  1718.   and partition you want. For example, Slackware's generic SCSI kernel
  1719.   has the root device set to /dev/sda2, whereas my root Linux partition
  1720.   happens to be /dev/sda8.  In this case the root device in the kernel
  1721.   will have to be changed.
  1722.  
  1723.   You can still change the root device and ramdisk settings in the
  1724.   kernel even if all you have is a kernel, and some other operating
  1725.   system, such as DOS.
  1726.  
  1727.   rdev changes kernel settings by changing the values at fixed offsets
  1728.   in the kernel file, so you can do the same if you have a hex editor
  1729.   available on whatever systems you do still have running --- for
  1730.   example, Norton Utilities Disk Editor under DOS.  You then need to
  1731.   check and if necessary change the values in the kernel at the
  1732.   following offsets:
  1733.  
  1734.  
  1735.  
  1736.        HEX     DEC  DESCRIPTION
  1737.        0x01F8  504  Low byte of RAMDISK word
  1738.        0x01F9  505  High byte of RAMDISK word
  1739.        0x01FC  508  Root minor device number - see below
  1740.        0X01FD  509  Root major device number - see below
  1741.  
  1742.  
  1743.  
  1744.  
  1745.   The interpretation of the ramdisk word was described in Section
  1746.   ``Setting the ramdisk word'', above.
  1747.  
  1748.   The major and minor device numbers must be set to the device you want
  1749.   to mount your root filesystem on. Some useful values to select from
  1750.   are:
  1751.  
  1752.  
  1753.  
  1754.        DEVICE          MAJOR MINOR
  1755.        /dev/fd0            2     0   1st floppy drive
  1756.        /dev/hda1           3     1   partition 1 on 1st IDE drive
  1757.        /dev/sda1           8     1   partition 1 on 1st SCSI drive
  1758.        /dev/sda8           8     8   partition 8 on 1st SCSI drive
  1759.  
  1760.  
  1761.  
  1762.  
  1763.   Once you have set these values then you can write the file to a
  1764.   diskette using either Norton Utilities Disk Editor, or a program
  1765.   called rawrite.exe.  This program is included in all distributions.
  1766.   It is a DOS program which writes a file to the ``raw'' disk, starting
  1767.   at the boot sector, instead of writing it to the file system.  If you
  1768.   use Norton Utilities you must write the file to a physical disk
  1769.   starting at the beginning of the disk.
  1770.  
  1771.   Q. How can I make extra copies of boot/root diskettes?
  1772.  
  1773.  
  1774.   Because magnetic media may deteriorate over time, you should keep
  1775.   several copies of your rescue disk, in case the original is
  1776.   unreadable.
  1777.  
  1778.   The easiest way of making copies of any diskettes, including bootable
  1779.   and utility diskettes, is to use the dd command to copy the contents
  1780.   of the original diskette to a file on your hard drive, and then use
  1781.   the same command to copy the file back to a new diskette.  Note that
  1782.   you do not need to, and should not, mount the diskettes, because dd
  1783.   uses the raw device interface.
  1784.  
  1785.   To copy the original, enter the command:
  1786.  
  1787.  
  1788.                dd if=DEVICENAME of=FILENAME
  1789.                where   DEVICENAME is the device name of the diskette drive
  1790.                and     FILENAME is the name of the (hard-disk) output file
  1791.  
  1792.  
  1793.  
  1794.  
  1795.   Omitting the count parameter causes dd to copy the whole diskette
  1796.   (2880 blocks if high-density).
  1797.  
  1798.   To copy the resulting file back to a new diskette, insert the new
  1799.   diskette and enter the reverse command:
  1800.  
  1801.  
  1802.                dd if=FILENAME of=DEVICENAME
  1803.  
  1804.  
  1805.  
  1806.  
  1807.   Note that the above discussion assumes that you have only one diskette
  1808.   drive. If you have two of the same type, you can copy diskettes using
  1809.   a command like:
  1810.  
  1811.  
  1812.  
  1813.                dd if=/dev/fd0 of=/dev/fd1
  1814.  
  1815.  
  1816.  
  1817.  
  1818.   Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every time?
  1819.  
  1820.  
  1821.   Where a disk device cannot be autodetected it is necessary to supply
  1822.   the kernel with a command device parameter string, such as:
  1823.  
  1824.  
  1825.                aha152x=0x340,11,3,1
  1826.  
  1827.  
  1828.  
  1829.  
  1830.   This parameter string can be supplied in several ways using LILO:
  1831.  
  1832.  
  1833.   ╖  By entering it on the command line every time the system is booted
  1834.      via LILO.  This is boring, though.
  1835.  
  1836.   ╖  By using the LILO ``lock'' keyword to make it store the command
  1837.      line as the default command line, so that LILO will use the same
  1838.      options every time it boots.
  1839.  
  1840.   ╖  By using the append= statement in the LILO config file.  Note that
  1841.      the parameter string must be enclosed in quotes.
  1842.  
  1843.   For example, a sample command line using the above parameter string
  1844.   would be:
  1845.  
  1846.  
  1847.                zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
  1848.  
  1849.   This would pass the device parameter string through, and also ask the
  1850.   kernel to set the root device to /dev/sda1 and save the whole command
  1851.   line and reuse it for all future boots.
  1852.  
  1853.   A sample APPEND statement is:
  1854.  
  1855.  
  1856.                APPEND = "aha152x=0x340,11,3,1"
  1857.  
  1858.  
  1859.  
  1860.  
  1861.   Note that the parameter string must NOT be enclosed in quotes on the
  1862.   command line, but it MUST be enclosed in quotes in the APPEND
  1863.   statement.
  1864.  
  1865.   Note also that for the parameter string to be acted on, the kernel
  1866.   must contain the driver for that disk type.  If it does not, then
  1867.   there is nothing listening for the parameter string, and you will have
  1868.   to rebuild the kernel to include the required driver.  For details on
  1869.   rebuilding the kernel, cd to /usr/src/linux and read the README, and
  1870.   read the Linux FAQ and Installation HOWTO.  Alternatively you could
  1871.   obtain a generic kernel for the disk type and install that.
  1872.  
  1873.   Readers are strongly urged to read the LILO documentation before
  1874.   experimenting with LILO installation.  Incautious use of the BOOT
  1875.   statement can damage partitions.
  1876.  
  1877.   Q. At boot time, I get error "A: cannot execute B". Why?
  1878.  
  1879.  
  1880.   There are several cases of program names being hardcoded in various
  1881.   utilities.  These cases do not occur everywhere, but they may explain
  1882.   why an executable apparently cannot be found on your system even
  1883.   though you can see that it is there.  You can find out if a given
  1884.   program has the name of another hardcoded by using the strings command
  1885.   and piping the output through grep.
  1886.  
  1887.   Known examples of hardcoding are:
  1888.  
  1889.   ╖  Shutdown in some versions has /etc/reboot hardcoded, so reboot must
  1890.      be placed in the /etc directory.
  1891.  
  1892.   ╖  init has caused problems for at least one person, with the kernel
  1893.      being unable to find init.
  1894.  
  1895.   To fix these problems, either move the programs to the correct
  1896.   directory, or change configuration files (e.g. inittab) to point to
  1897.   the correct directory.  If in doubt, put programs in the same
  1898.   directories as they are on your hard disk, and use the same inittab
  1899.   and /etc/rc.d files as they appear on your hard disk.
  1900.  
  1901.   Q. My kernel has ramdisk support, but initializes ramdisks of 0K
  1902.  
  1903.  
  1904.   Where this occurs, a kernel message like this will appear as the
  1905.   kernel is booting:
  1906.  
  1907.  
  1908.           Ramdisk driver initialized : 16 ramdisks of 0K size
  1909.  
  1910.  
  1911.  
  1912.   This is probably because the size has been set to 0 by kernel
  1913.   parameters at boot time.  This could possibly be because of an
  1914.   overlooked LILO configuration file parameter:
  1915.        ramdisk= 0
  1916.  
  1917.  
  1918.  
  1919.  
  1920.   This was included in sample LILO configuration files in some older
  1921.   distributions, and was put there to override any previous kernel
  1922.   setting.  If you have such a line, remove it.
  1923.  
  1924.   Note that if you attempt to use a ramdisk which has been set to 0K the
  1925.   behaviour can be unpredictable, and can result in kernel panics.
  1926.  
  1927.  
  1928.  
  1929.   K.  Resources and pointers.
  1930.  
  1931.  
  1932.   In this section, vvv is used in package names in place of the version,
  1933.   to avoid referring here to specific versions.  When retrieving a
  1934.   package, always get the latest version unless you have good reasons
  1935.   for not doing so.
  1936.  
  1937.  
  1938.   K.1.  Pre-made bootdisks.
  1939.  
  1940.  
  1941.   These are sources for distribution bootdisks.  Please use one of the
  1942.   mirror sites to reduce the load on these machines.
  1943.  
  1944.  
  1945.   ╖  Slackware bootdisks
  1946.      <http://sunsite.unc.edu/pub/Linux/distributions/slackware/bootdsks.144/>
  1947.      and Slackware mirror sites
  1948.      <http://sunsite.unc.edu/pub/Linux/distributions/slackware/MIRRORS.TXT>
  1949.  
  1950.   ╖  RedHat bootdisks
  1951.      <http://sunsite.unc.edu/pub/Linux/distributions/redhat/current/i386/images/>
  1952.      and Red Hat mirror sites <http://www.redhat.com/ftp.html>
  1953.  
  1954.   ╖  Debian bootdisks <ftp://ftp.debian.org/pub/debian/stable/disks-
  1955.      i386> and Debian mirror sites
  1956.      <ftp://ftp.debian.org/debian/README.mirrors>
  1957.  
  1958.   In addition to the distribution bootdisks, the following rescue disk
  1959.   images are available.
  1960.  
  1961.  
  1962.   ╖  tomsrtbt, by Tom Oehser, is a single-disk boot/root disk based on
  1963.      kernel 2.0.33, with a large list of features and support programs.
  1964.      It supports IDE, SCSI, tape, network adaptors, PCMCIA and more.
  1965.      About 100 utility programs and tools are included for fixing and
  1966.      restoring disks.  The package also includes scripts for
  1967.      disassembling and reconstructing the images so that new material
  1968.      can be added if necessary.
  1969.  
  1970.      <http://www.toms.net/~toehser/rb/tomsrtbt-current.tar.gz>
  1971.  
  1972.      <http://sunsite.unc.edu/pub/Linux/system/recovery/>
  1973.  
  1974.  
  1975.   ╖  rescue02, by John Comyns, is a rescue disk based on kernel 1.3.84,
  1976.      with support for IDE and Adaptec 1542 and NCR53C7,8xx.  It uses ELF
  1977.      binaries but it has enough commands so that it can be used on any
  1978.      system.  There are modules that can be loaded after booting for all
  1979.      other SCSI cards.  It probably won't work on systems with 4 mb of
  1980.      ram since it uses a 3 mb ram disk.
  1981.      <http://sunsite.unc.edu/pub/Linux/system/recovery/rescue02.zip>
  1982.  
  1983.  
  1984.   ╖  resque_disk-2.0.22, by Sergei Viznyuk, is a full-featured boot/root
  1985.      disk based on kernel 2.0.22 with built-in support for IDE, many
  1986.      difference SCSI controllers, and ELF/AOUT.  Also includes many
  1987.      modules and useful utilities for repairing and restoring a hard
  1988.      disk.
  1989.  
  1990.      <http://sunsite.unc.edu/pub/Linux/system/recovery/resque_disk-
  1991.      vvv.tar.gz>
  1992.  
  1993.  
  1994.   ╖  cramdisk images, based on the 2.0.23 kernel, available for 4 meg
  1995.      and 8 meg machines.  They include math emulation and networking
  1996.      (PPP and dialin script, NE2000, 3C509), or support for the parallel
  1997.      port ZIP drive.  These diskette images will boot on a 386 with 4MB
  1998.      RAM.  MSDOS support is included so you can download from the net to
  1999.      a DOS partition.
  2000.  
  2001.      <http://sunsite.unc.edu/pub/Linux/system/recovery/images/>
  2002.  
  2003.  
  2004.  
  2005.   K.2.  Rescue packages.
  2006.  
  2007.  
  2008.   Several packages for creating rescue disks are available on
  2009.   sunsite.unc.edu.  With these packages you generally specify a set of
  2010.   files for inclusion and the software automates (to varying degrees)
  2011.   the creation of a bootdisk.  See
  2012.   <http://sunsite.unc.edu/pub/Linux/system/recovery/!INDEX.html> for
  2013.   more information.  Check the file dates carefully --- some of these
  2014.   packages have not been updated in several years and will not support
  2015.   the creation of a compressed root filesystem loaded into ramdisk.  To
  2016.   the best of our knowledge, Yard is the only package that will.
  2017.  
  2018.  
  2019.  
  2020.   K.3.  Graham Chapman's shell scripts
  2021.  
  2022.  
  2023.   Graham Chapman has written a set of scripts that may be useful as
  2024.   examples of how to create bootdisks.  In previous versions of this
  2025.   HOWTO the scripts appeared in an appendix, but they have been deleted
  2026.   from the documented and placed on a web page:
  2027.  
  2028.   <http://www.zeta.org.au/~grahamc/linux.html>
  2029.  
  2030.   You may find it convenient to use these scripts, but if so, read the
  2031.   instructions carefully --- for example, if you specify the wrong swap
  2032.   device, you will find your root filesystem has been throroughly and
  2033.   permanently erased.  Be sure you have it correctly configured before
  2034.   you use it!
  2035.  
  2036.  
  2037.  
  2038.   K.4.  LILO --- the Linux loader.
  2039.  
  2040.  
  2041.   Written by Werner Almesberger.  Excellent boot loader, and the
  2042.   documentation includes information on the boot sector contents and the
  2043.   early stages of the boot process.
  2044.  
  2045.   Ftp from
  2046.   <ftp://tsx-11.mit.edu/pub/linux/packages/lilo/lilo.vvv.tar.gz>.  It is
  2047.   also available on Sunsite and mirrors.
  2048.  
  2049.  
  2050.   K.5.  Linux FAQ and HOWTOs.
  2051.  
  2052.  
  2053.   These are available from many sources.  Look at the usenet newsgroups
  2054.   news.answers and comp.os.linux.announce.
  2055.  
  2056.   The FAQ is available from
  2057.   <http://sunsite.unc.edu/pub/Linux/docs/faqs/linux-faq> and the HOWTOs
  2058.   from  <http://sunsite.unc.edu/pub/Linux/docs/HOWTO>.
  2059.  
  2060.   Most documentation for Linux may be found at The Linux Documentation
  2061.   Project homepage <http://sunsite.unc.edu/LDP/>.
  2062.  
  2063.   If desperate, send mail to mail-server@rtfm.mit.edu with the word
  2064.   ``help'' in the message, then follow the mailed instructions.
  2065.  
  2066.  
  2067.  
  2068.   K.6.  Ramdisk usage.
  2069.  
  2070.  
  2071.   An excellent description of the how the new ramdisk code works may be
  2072.   found with the documentation supplied with the Linux kernel.  See
  2073.   /usr/src/linux/Documentation/ramdisk.txt.  It is written by Paul
  2074.   Gortmaker and includes a section on creating a compressed ramdisk.
  2075.  
  2076.  
  2077.  
  2078.   K.7.  The Linux boot process.
  2079.  
  2080.  
  2081.   For more detail on the Linux boot process, here are some pointers:
  2082.  
  2083.  
  2084.   ╖  The Linux System Administrators' Guide has a section on booting,
  2085.      See  <http://sunsite.unc.edu/LDP/LDP/sag-0.5/node68.html>
  2086.  
  2087.   ╖  The LILO ``Technical overview''
  2088.      <http://sunsite.unc.edu/pub/Linux/system/boot/lilo/lilo-t-20.ps.gz>
  2089.      has the definitive technical, low-level description of the boot
  2090.      process, up to where the kernel is started.
  2091.  
  2092.   ╖  The source code is the ultimate guide.  Below are some kernel files
  2093.      related to the boot process.  If you have the Linux kernel source
  2094.      code, you can find these under /usr/src/linux on your machine;
  2095.      alternatively, Shigio Yamaguchi (shigio@wafu.netgate.net) has a
  2096.      very nice hypertext kernel browser at
  2097.      <http://wafu.netgate.net/linux/>.
  2098.  
  2099.  
  2100.  
  2101.      arch/i386/boot/bootsect.S,setup.S
  2102.         Contain assembly code for the bootsector.
  2103.  
  2104.  
  2105.      arch/i386/boot/compressed/misc.c
  2106.         Contains code for uncompressing the kernel.
  2107.  
  2108.  
  2109.      arch/i386/kernel/
  2110.         Directory containing kernel initialization code.  setup.c
  2111.         contains the ramdisk word.
  2112.  
  2113.      drivers/block/rd.c
  2114.         Contains the ramdisk driver. The procedures rd_load and
  2115.         rd_load_image load blocks from a device into a ramdisk.  The
  2116.         procedure identify_ramdisk_image determines what kind of
  2117.         filesystem is found and whether it is compressed.
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.   L.  LILO boot error codes.
  2124.  
  2125.  
  2126.   Questions about these errors are asked so often on Usenet that we
  2127.   include them here as a public service.  This summary is excerpted from
  2128.   Werner Almsberger's LILO User Documentation, available at
  2129.   <ftp://lrcftp.epfl.ch:/pub/linux/local/lilo/lilo.u.19.ps.gz>.
  2130.  
  2131.   When LILO loads itself, it displays the word ``LILO''.  Each letter is
  2132.   printed before or after performing some specific action.  If LILO
  2133.   fails at some point, the letters printed so far can be used to
  2134.   identify the problem.
  2135.  
  2136.  
  2137.  
  2138.      (nothing)
  2139.         No part of LILO has been loaded.  LILO either isn't installed or
  2140.         the partition on which its boot sector is located isn't active.
  2141.  
  2142.  
  2143.      L  The first stage boot loader has been loaded and started, but it
  2144.         can't load the second stage boot loader.  The two-digit error
  2145.         codes indicate the type of problem. (See also section ``Disk
  2146.         error codes''.)  This condition usually indicates a media
  2147.         failure or a geometry mismatch (e.g. bad disk parameters)
  2148.  
  2149.  
  2150.      LI The first stage boot loader was able to load the second stage
  2151.         boot loader, but has failed to execute it. This can either be
  2152.         caused by a geometry mismatch or by moving /boot/boot.b without
  2153.         running the map installer.
  2154.  
  2155.  
  2156.      LIL
  2157.         The second stage boot loader has been started, but it can't load
  2158.         the descriptor table from the map file. This is typically caused
  2159.         by a media failure or by a geometry mismatch.
  2160.  
  2161.  
  2162.      LIL?
  2163.         The second stage boot loader has been loaded at an incorrect
  2164.         address. This is typically caused by a subtle geometry mismatch
  2165.         or by moving /boot/boot.b without running the map installer.
  2166.  
  2167.  
  2168.      LIL-
  2169.         The descriptor table is corrupt. This can either be caused by a
  2170.         geometry mismatch or by moving /boot/map without running the map
  2171.         installer.
  2172.  
  2173.  
  2174.      LILO
  2175.         All parts of LILO have been successfully loaded.
  2176.  
  2177.  
  2178.  
  2179.   If the BIOS signals an error when LILO is trying to load a boot image,
  2180.   the respective error code is displayed.  These codes range from 0x00
  2181.   through 0xbb.  See the LILO User Guide for an explanation of these.
  2182.  
  2183.  
  2184.  
  2185.   M.  Sample rootdisk directory listings.
  2186.  
  2187.  
  2188.  
  2189.   Here are the contents of Graham's root and utility diskettes.  These
  2190.   lists are provided as an example only of the files included to create
  2191.   a working system.  Graham has added some explanatory notes where it
  2192.   seemed useful.
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.   total 18
  2246.   drwxr-xr-x   2 root     root         1024 Jul 29 21:16 bin/
  2247.   drwxr-xr-x   2 root     root         9216 Jul 28 16:21 dev/
  2248.   drwxr-xr-x   3 root     root         1024 Jul 29 20:25 etc/
  2249.   drwxr-xr-x   2 root     root         1024 Jul 28 19:53 lib/
  2250.   drwxr-xr-x   2 root     root         1024 Jul 24 22:47 mnt/
  2251.   drwxr-xr-x   2 root     root         1024 Jul 24 22:47 proc/
  2252.   drwxr-xr-x   2 root     root         1024 Jul 28 19:07 sbin/
  2253.   drwxr-xr-x   2 root     root         1024 Jul 29 20:57 tmp/
  2254.   drwxr-xr-x   4 root     root         1024 Jul 29 21:35 usr/
  2255.   drwxr-xr-x   3 root     root         1024 Jul 28 19:52 var/
  2256.  
  2257.   /bin:
  2258.   total 713
  2259.   -rwxr-xr-x   1 root     bin          7737 Jul 24 22:16 cat*
  2260.   -rwxr-xr-x   1 root     bin          9232 Jul 24 22:48 chmod*
  2261.   -rwxr-xr-x   1 root     bin          8156 Jul 24 22:48 chown*
  2262.   -rwxr-xr-x   1 root     bin         19652 Jul 24 22:48 cp*
  2263.   -rwxr-xr-x   1 root     root         8313 Jul 29 21:16 cut*
  2264.   -rwxr-xr-x   1 root     bin         12136 Jul 24 22:48 dd*
  2265.   -rwxr-xr-x   1 root     bin          9308 Jul 24 22:48 df*
  2266.   -rwxr-xr-x   1 root     root         9036 Jul 29 20:24 dircolors*
  2267.   -rwxr-xr-x   1 root     bin          9064 Jul 24 22:48 du*
  2268.   -rwxr-x---   1 root     bin         69252 Jul 24 22:51 e2fsck*
  2269.   -rwxr-xr-x   1 root     bin          5361 Jul 24 22:48 echo*
  2270.   -rwxr-xr-x   1 root     bin          5696 Jul 24 22:16 hostname*
  2271.   -rwxr-xr-x   1 root     bin          6596 Jul 24 22:49 kill*
  2272.   -rwxr-xr-x   1 root     bin         10644 Jul 24 22:17 ln*
  2273.   -rwxr-xr-x   1 root     bin         13508 Jul 24 22:17 login*
  2274.   -rwxr-xr-x   1 root     bin         26976 Jul 24 22:17 ls*
  2275.   -rwxr-xr-x   1 root     bin          7416 Jul 24 22:49 mkdir*
  2276.   -rwxr-x---   1 root     bin         34596 Jul 24 22:51 mke2fs*
  2277.   -rwxr-xr-x   1 root     bin          6712 Jul 24 22:49 mknod*
  2278.   -rwxr-xr-x   1 root     bin         20304 Jul 24 22:17 more*
  2279.   -rwxr-xr-x   1 root     bin         24704 Jul 24 22:17 mount*
  2280.   -rwxr-xr-x   1 root     bin         12464 Jul 24 22:17 mv*
  2281.   -rwxr-xr-x   1 root     bin         20829 Jul 24 22:50 ps*
  2282.   -rwxr-xr-x   1 root     bin          9424 Jul 24 22:50 rm*
  2283.   -rwxr-xr-x   1 root     bin          4344 Jul 24 22:50 rmdir*
  2284.   -rwxr-xr-x   1 root     root       299649 Jul 27 14:12 sh*
  2285.   -rwxr-xr-x   1 root     bin          9853 Jul 24 22:17 su*
  2286.   -rwxr-xr-x   1 root     bin           380 Jul 27 14:12 sync*
  2287.   -rwxr-xr-x   1 root     bin         13620 Jul 24 22:17 umount*
  2288.   -rwxr-xr-x   1 root     root         5013 Jul 29 20:03 uname*
  2289.  
  2290.   /dev:
  2291.   total 0
  2292.   lrwxrwxrwx   1 root     root           10 Jul 24 22:34 cdrom -> /dev/sbpcd
  2293.   crw--w--w-   1 root     tty        4,   0 Jul 24 21:49 console
  2294.   brw-rw----   1 root     floppy     2,   0 Apr 28  1995 fd0
  2295.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 ftape -> rft0
  2296.   crw-rw-rw-   1 root     sys       10,   2 Jul 18  1994 inportbm
  2297.   crw-rw----   1 root     kmem       1,   2 Jul 28 16:21 kmem
  2298.   crw-rw----   1 root     kmem       1,   1 Jul 18  1994 mem
  2299.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 modem -> cua0
  2300.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 mouse -> cua1
  2301.   crw-rw-rw-   1 root     sys        1,   3 Jul 18  1994 null
  2302.   brw-rw----   1 root     disk       1,   1 Jul 18  1994 ram
  2303.   crw-rw----   1 root     disk      27,   0 Jul 18  1994 rft0
  2304.   brw-rw----   1 root     disk      25,   0 Jul 19  1994 sbpcd
  2305.   ***  I have only included devices for the SCSI partitions I use.
  2306.   ***  If you use IDE, then use /dev/hdxx instead.
  2307.   brw-rw----   1 root     disk       8,   0 Apr 29  1995 sda
  2308.   brw-rw----   1 root     disk       8,   6 Apr 29  1995 sda6
  2309.   brw-rw----   1 root     disk       8,   7 Apr 29  1995 sda7
  2310.   brw-rw----   1 root     disk       8,   8 Apr 29  1995 sda8
  2311.   lrwxrwxrwx   1 root     root            7 Jul 28 12:56 systty -> console
  2312.   ***  this link from systty to console is required
  2313.   crw-rw-rw-   1 root     tty        5,   0 Jul 18  1994 tty
  2314.   crw--w--w-   1 root     tty        4,   0 Jul 18  1994 tty0
  2315.   crw--w----   1 root     tty        4,   1 Jul 24 22:33 tty1
  2316.   crw--w----   1 root     tty        4,   2 Jul 24 22:34 tty2
  2317.   crw--w--w-   1 root     root       4,   3 Jul 24 21:49 tty3
  2318.   crw--w--w-   1 root     root       4,   4 Jul 24 21:49 tty4
  2319.   crw--w--w-   1 root     root       4,   5 Jul 24 21:49 tty5
  2320.   crw--w--w-   1 root     root       4,   6 Jul 24 21:49 tty6
  2321.   crw-rw-rw-   1 root     tty        4,   7 Jul 18  1994 tty7
  2322.   crw-rw-rw-   1 root     tty        4,   8 Jul 18  1994 tty8
  2323.   crw-rw-rw-   1 root     tty        4,   9 Jul 19  1994 tty9
  2324.   crw-rw-rw-   1 root     sys        1,   5 Jul 18  1994 zero
  2325.  
  2326.   /etc:
  2327.   total 20
  2328.   -rw-r--r--   1 root     root         2167 Jul 29 20:25 DIR_COLORS
  2329.   -rw-r--r--   1 root     root           20 Jul 28 12:37 HOSTNAME
  2330.   -rw-r--r--   1 root     root          109 Jul 24 22:57 fstab
  2331.   -rw-r--r--   1 root     root          271 Jul 24 22:21 group
  2332.   -rw-r--r--   1 root     root         2353 Jul 24 22:27 inittab
  2333.   -rw-r--r--   1 root     root            0 Jul 29 21:02 issue
  2334.   -rw-r--r--   1 root     root         2881 Jul 28 19:38 ld.so.cache
  2335.   ***  Lots of things get upset at boot time if ld.so.cache is missing, but
  2336.   ***  make sure that ldconfig is included and run from rc.x to
  2337.   ***  update it.
  2338.   -rw-r--r--   1 root     root           12 Jul 24 22:22 motd
  2339.   -rw-r--r--   1 root     root          606 Jul 28 19:25 passwd
  2340.   -rw-r--r--   1 root     root         1065 Jul 24 22:21 profile
  2341.   drwxr-xr-x   2 root     root         1024 Jul 29 21:01 rc.d/
  2342.   -rw-r--r--   1 root     root           18 Jul 24 22:21 shells
  2343.   -rw-r--r--   1 root     root          774 Jul 28 13:43 termcap
  2344.   -rw-r--r--   1 root     root          126 Jul 28 13:44 ttys
  2345.   -rw-r--r--   1 root     root            0 Jul 24 22:47 utmp
  2346.  
  2347.   /etc/rc.d:
  2348.   total 5
  2349.   *** I didn't bother with shutdown scripts - everthing runs on a
  2350.   *** ramdisk, so there's not much point shutting it down.
  2351.   -rwxr-xr-x   1 root     root         1158 Jul 24 22:23 rc.K*
  2352.   -rwxr-xr-x   1 root     root         1151 Jul 28 19:08 rc.M*
  2353.   -rwxr-xr-x   1 root     root          507 Jul 29 20:25 rc.S*
  2354.  
  2355.   /lib:
  2356.   total 588
  2357.   *** I have an ELF system, so I include the ELF loader ld-linux.so. if
  2358.   *** you are still on a.out, then you need ld.so. Use the file command to
  2359.   *** see which libraries you should include.
  2360.   lrwxrwxrwx   1 root     root           17 Jul 24 23:36 ld-linux.so.1 -> ld-linux.so.1.7.3*
  2361.   -rwxr-xr-x   1 root     root        20722 Aug 15  1995 ld-linux.so.1.7.3*
  2362.   lrwxrwxrwx   1 root     root           13 Jul 24 23:36 libc.so.5 -> libc.so.5.0.9*
  2363.   -rwxr-xr-x   1 root     root       562683 May 19  1995 libc.so.5.0.9*
  2364.   ***  Must include libtermcap
  2365.   lrwxrwxrwx   1 root     root           19 Jul 28 19:53 libtermcap.so.2 -> libtermcap.so.2.0.0*
  2366.   -rwxr-xr-x   1 root     root        11360 May 19  1995 libtermcap.so.2.0.0*
  2367.  
  2368.   /mnt:
  2369.   total 0
  2370.  
  2371.   /proc:
  2372.   total 0
  2373.  
  2374.   /sbin:
  2375.   total 191
  2376.   ***  I use Slackware, which uses agetty. Many systems use getty.
  2377.   ***  Check your /etc/inittab to see which it uses. Note that you
  2378.   ***  need (a)getty and login to be able to start doing much.
  2379.   -rwxr-xr-x   1 root     bin         11309 Jul 24 22:54 agetty*
  2380.   -rwxr-xr-x   1 root     bin          5204 Jul 24 22:19 halt*
  2381.   ***  Must have this to boot
  2382.   -rwxr-xr-x   1 root     bin         20592 Jul 24 22:19 init*
  2383.   -rwxr-xr-x   1 root     root        86020 Jul 28 19:07 ldconfig*
  2384.   -rwxr-xr-x   1 root     bin          5329 Jul 27 14:10 mkswap*
  2385.   -rwxr-xr-x   1 root     root         5204 Jul 24 22:20 reboot*
  2386.   -rwxr-xr-x   1 root     root         6024 Jul 24 22:20 rdev*
  2387.   -rwxr-xr-x   1 root     bin         12340 Jul 24 22:20 shutdown*
  2388.   -rwxr-xr-x   1 root     root         5029 Jul 24 22:20 swapoff*
  2389.   -rwxr-xr-x   1 root     bin          5029 Jul 24 22:20 swapon*
  2390.   -rwxr-xr-x   1 root     root        20592 Jul 27 18:18 telinit*
  2391.   -rwxr-xr-x   1 root     root         7077 Jul 24 22:20 update*
  2392.  
  2393.   /tmp:
  2394.   total 0
  2395.  
  2396.   /usr:
  2397.   total 2
  2398.   drwxr-xr-x   2 root     root         1024 Jul 29 21:00 adm/
  2399.   drwxr-xr-x   2 root     root         1024 Jul 29 21:16 lib/
  2400.  
  2401.   /usr/adm:
  2402.   total 0
  2403.  
  2404.   /usr/lib:
  2405.   total 0
  2406.  
  2407.   /var:
  2408.   total 1
  2409.   ***  Several things complained until I included this and
  2410.   ***  the /etc/rc.S code to initialise /var/run/utmp, but this
  2411.   ***  won't necessarily apply to your system.
  2412.   drwxr-xr-x   2 root     root         1024 Jul 28 19:52 run/
  2413.  
  2414.   /var/run:
  2415.   total 0
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.   N.  Sample utility disk directory listing.
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.   total 579
  2444.   -rwxr-xr-x   1 root     root        42333 Jul 28 19:05 cpio*
  2445.   -rwxr-xr-x   1 root     root       103560 Jul 29 21:31 elvis*
  2446.   -rwxr-xr-x   1 root     root        56401 Jul 28 19:06 find*
  2447.   -rwxr-xr-x   1 root     root        29536 Jul 28 19:04 fdisk*
  2448.   -rw-r--r--   1 root     root       128254 Jul 28 19:03 ftape.o
  2449.   -rwxr-xr-x   1 root     root        17564 Jul 25 03:21 ftmt*
  2450.   -rwxr-xr-x   1 root     root        64161 Jul 29 20:47 grep*
  2451.   -rwxr-xr-x   1 root     root        45309 Jul 29 20:48 gzip*
  2452.   -rwxr-xr-x   1 root     root        23560 Jul 28 19:04 insmod*
  2453.   -rwxr-xr-x   1 root     root          118 Jul 28 19:04 lsmod*
  2454.   lrwxrwxrwx   1 root     root            5 Jul 28 19:04 mt -> mt-st*
  2455.   -rwxr-xr-x   1 root     root         9573 Jul 28 19:03 mt-st*
  2456.   lrwxrwxrwx   1 root     root            6 Jul 28 19:05 rmmod -> insmod*
  2457.   -rwxr-xr-x   1 root     root       104085 Jul 28 19:05 tar*
  2458.   lrwxrwxrwx   1 root     root            5 Jul 29 21:35 vi -> elvis*
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.