LifeBoat

Copyright   (C)   2003 Steve Stites
There is NO warrenty.
This program is released under the GNU General Public License.
GNU General Public License. Tux to the rescue



Table of Contents


Introduction

          LifeBoat is a script program which can be used to create a Linux 
          bootable rescue CD.  LifeBoat uses your kernel, your device 
          configuration, your man pages, and your utility programs so that the 
          resulting rescue CD is highly compatible with your Linux system.
          LifeBoat is configurable and you can add any program you want to the
          base system provided by LifeBoat.

          The LifeBoat CD is designed to be a versatile and reliable rescue system. 
          It is not a general purpose Linux system although with a lot of work 
          you could create a general purpose Linux CD system using the addons 
          feature.  Rather than doing that, if you want a general purpose CD Linux 
          system then I highly recommend Klaus Knopper's Knoppix:  

          http://www.knoppix.org/

          The LifeBoat CD base system is a command line based system running as root. 
          It does not have a GUI.  It does not have passwords.  It does not have a   
          package manager.  It does not have a compiler.  It does not have any
          networking.  What the LifeBoat CD does have is your kernel, your devices, a 
          large number of your command line utilities and your man pages.     
Table of Contents

Installation

          Login as root or su to root.
          Extract the tarball in the working directory you will use to create your 
          LifeBoat CD.
Table of Contents

Creating your LifeBoat CD

          1.  Use a text editor to make any necessary changes to the configuration 
              file, config.  the config parameters are:
     
            CDR_DEVICE
              The CDR_DEVICE is the scsi address of your CD-RW.  
              The default is:  CDR_DEVICE="0,0,0"

            CDR_SPEED
              The CDR_SPEED is the burn speed of your blank CD-RW or CD-R.  
              LifeBoat runs the burn at the fastest speed that your CD burner 
              will allow.  If you want to run the burn at a slower speed then 
              set CDR_SPEED to the slower speed.  For example if you want to
              do a 12X burn then set CDR_SPEED=12
              The default is:  CDR_SPEED=  (which means as fast as possible)

             DISTRO
               The DISTRO is the name of your Linux distribution.  Different 
               distributions have different file structures so LifeBoat gives
               you a choice of commands to copy your files to the LifeBoat CD.
               The current choices are Debian, Fedora, generic, Mandrake, RedHat,
               Slackware, SuSE, and Yoper.  If all of these choices do a poor job of
               finding files on your distribution then make your own DISTRO command.
               Use the generic command as a base to create a DISTRO command that
               works well on your distribution.  Save your command in the
               distributions directory and make it executable.  If you make your own
               DISTRO command please send it to me as an email attachment and I will
               include it in a future release of LifeBoat.
               The default is:  DISTRO=RedHat

             IDESCCI
               The IDESCSI parameter is entered into isolinux.cfg as a boot parameter
               describing your CD-RW.  If your CD-RW is scsi then set it to null:
               IDESCSI=
               If your CD-RW is on /dev/hdb and uses ide-scsi emulation then
               enter:  IDESCSI="hdb=ide-scsi"
               The default is:  IDESCSI="hdd=ide-scsi"

             KERNEL
              The KERNEL parameter describes the full path and name of your kernel.
              The default is:  /boot/vmlinuz

             MANPAGES
               The MANPAGES parameter is used to indicate whether or not you want
               your man pages included on the LifeBoat CD.  See the "memory usage"
               section for more information about MANPAGES.  Answer yes or no. 
               The default is:  yes

             MYNAME
               MYNAME is the name of the person who is creating the LifeBoat CD.  
               That's you!  Enclosing your name in quotes will take care of any
               names which contain special characters like "O'LEARY" or "VAN DER
               WAALS".  If your name has more than thirty characters try using a
               shorter nickname.  The default is STITES.

             RAMDISK_SIZE
               The RAMDISK_SIZE is the megabytes of memory set aside for a ramdisk.  
               See the "Ram disk" section for a description of how to decide how 
               large a ramdisk you need.  The default is:  RAMDISK_SIZE=250

          2.  Use a text editor to edit the addons file.  In the addons file you can 
              add anything that you want to the base LifeBoat system.

          3.  cd to the LifeBoat-0.4 directory.  This is in the directory where you
              extracted the LifeBoat tarball.

          4.  Insert a CD-RW or a blank CD-R in your CD recorder.

          5.  Issue the command:  ./lifeboat
Table of Contents

Ram disk

          In the following paragraphs the amounts of ram mentioned can vary widely
          from one Linux box to another.  You will have to make a test run with 
          LifeBoat before you get your LifeBoat ram usage configured correctly.

          The LifeBoat system uses a ram disk file system.  This file system is 
          entirely located in memory.  So once boot has finished, the rescue system 
          runs entirely in memory.  It does not need a CD or a hard disk to run.  But 
          the ram disk does take up a significant amount of memory.  The size of the 
          ram disk is set using the config parameter RAMDISK_SIZE.  The default  
          RAMDISK_SIZE is set to a deliberately too large 250M.  When you run 
          ./lifeboat it will tell you how much ram disk is actually used and will 
          also store the information in the audit directory.  Then you should set 
          RAMDISK_SIZE to 16M more than is actually used and run ./lifeboat again.  
          You cannot reduce RAMDISK_SIZE to the actual usage because that would set 
          up a "disk full" situation, i.e. you would not have any free working space
          on the ram disk.  If you get "disk full", either while running ./lifeboat 
          or after booting the LifeBoat CD, then increase RAMDISK_SIZE.   If you 
          don't want to ruin a CD-R in a trial run then leave the CD-ROM tray empty.
Table of Contents

Memory usage

          There is a trade off between the number of tools available to repair your 
          broken system and the size of the rescue system.  I have tilted toward 
          making the rescue system as complete a tool kit as possible and therefore 
          you may run into memory size problems when trying to boot the LifeBoat 
          CD.  You will need enough ram for the ram disk, your kernel, room to run
          programs, and cache space.  Altogather you will need approximately the
          RAMDISK_SIZE plus about 10M.  If that is too large for your machine then 
          you can remove the man pages by setting the config variable MANPAGES=no and 
          then reduce the RAMDISK_SIZE by about 33M. 

          If you want to reduce the size of the LifeBoat CD system even further then 
          you will have to rework the DISTRO script and throw out a lot of utility
          programs.  Rather than do that I recommend that you take a look at tomsrbt
          Tom Oehser has probably done as good a job as possible in creating a small
          small generalized Linux system on a floppy.  tomsrtbt tilts heavily 
          toward being as small as possible:  http://www.toms.net/rb/

          Another way that you can save space is to compile your own kernel.  The     
          kernels provided by a distribution usually includes every function that 
          anybody might need.  You can reduce the size of /lib/modules/* dramatically 
          by compiling your own kernel and only including the functions that you      
          actually need.  In my case I saved about 38M in by compiling my own kernel.
Table of Contents

Kernel requirements

          LifeBoat uses your kernel because there is probably an excellent fit
          between your kernel configuration and your hardware configuration, file
          systems, partition types, etc.
       
          LifeBoat does require that your kernel have loopback device support and 
          ramdisk support compiled into your kernel.  Most distributions now have 
          loopback device support and ramdisk support in their default kernels, 
          but if your kernel lacks either of those features then LifeBoat will 
          not work.  If you compile your own kernel remember to include loopback
          device support and ramdisk support.
          
          You tell LifeBoat the name of your kernel with the KERNEL= parameter in    
          the config file.  The default is:  KERNEL=/boot/vmlinuz  LifeBoat will 
          rename the kernel on the CD to linux.

          If you have more than one kernel then the KERNEL= parameter must name the
          kernel that you are currently running on.  The LifeBoat CD does not multi-
          boot.  If you want more than one kernel then create a separate LifeBoat 
          CD for each kernel.  You will also have to boot your system into the proper
          kernel to create each LifeBoat CD.
Table of Contents

Addons

          You can add directories, programs, and other files to your rescue CD by
          using the addons feature.  In the directory where you installed LifeBoat
          you will find an executable file called addons.  You enter commands into
          the addons file to create directories and to copy files from your
          Linux system into the ramdisk that LifeBoat is building on the bootable CD.
          In your addons commands you reference the ramdisk as ${RAMDISK}.  Your
          addons commands will be executed after ./lifeboat has finished building the
          standard rescue system so you can count on the standard directories to be
          existing in ${RAMDISK} when addons is run.

          Lifeboat contains the utility programs to inspect and repair partitions,
          ext2 file systems, and DOS file systems.  If you are using other file
          systems like ext3, or reiserfs, or perhaps something like LVM or RAID,
          then you should include the utilities to inspect and repair these things
          in the addons file.

          For example:  Suppose that you want to use nano as your LifeBoat command
          line editor.  Also suppose that you have a program called bedbug which
          finds and destroys viruses embedded in any of your Linux programs and you
          want to include bedbug on the LifeBoat CD.  The bedbug program is located
          in /usr/local/bin.  bedbug has lists of virus signatures and control files
          in /usr/bedbug.  ${RAMDISK} has /usr/local/bin but it does not have
          /usr/bedbug.  So you would add the following code to the addons file:

          # add bedbug
          mkdir  ${RAMDISK}/usr/bedbug
          cp  /usr/local/bin/bedbug  ${RAMDISK}/usr/local/bin
          cp  /usr/bedbug/*  ${RAMDISK}/usr/bedbug  -R
          # add nano
          cp /usr/local/bin/nano  ${RAMDISK}/usr/local/bin
          # make changes to the LifeBoat CD profile
          cp /root/my.lifeboat.profile ${RAMDISK}/etc/profile.local
          # use the LVM2-Debian contributed addon
          .  ./contributed.addons/LVM2-Debian
Table of Contents

Contributed addons

          There is some user contributed addon code in the contributed.addons
          directory.  If you want to use some of this code you can include a
          contributed addons file in your code with the command:
          .  ./contributed.addons/[filename]
          The addons example shows how to use LVM2-Debian.  If the contributed
          addons code does not work correctly on your system you can paste it into
          your addons file and rewrite it to work.  If you create any interesting
          addons routines please consider contributing it to LifeBoat.
Table of Contents

Functions

          Some script functions are available for people who want to make major
          additions or changes to LifeBoat.  They relieve the tedium of some
          repetitive LifeBoat coding.  The functions have some built in robustness
          to allow for missing files, etc.  Also the functions produce more
          descriptive and less alarming error messages than raw script code does.

          See the file documentation/functions.txt for a full description of what
          the functions do.  See the file functionlib/standard.functions for the
          source code.
Table of Contents

Profile

          You may want to have a different profile than the default profile provided
          by LifeBoat in etc/profile.  For example, you might want a different PATH
          or to add libraries to the PATH.  To do so, set up your changes in
          ${RAMDISK}/etc/profile.local.  The Addons example shows how to add your
          /etc/profile.local to the LifeBoat CD.  When the LifeBoat CD boots it will
          execute /etc/profile.local immediately after executing /etc/profile.
Table of Contents

Editor

          There are several open source command line editors available.  Rather than
          take up a lot of space with half a dozen or so editors LifeBoat comes with
          a single text editor called mp.  mp was chosen because it is very intuitive
          to use.  Even if a person has never used mp before they can quickly master
          it well enough to repair a broken /etc/fstab file or startup script.
          LifeBoat gives mp linked names of ed, edit, editor, emacs, nano, pico, vi,
          and vim so that whatever editor name you try you will get a usable text
          editor.  If you want to use some editor other than mp then include your
          preferred editor in LifeBoat by using the addons function.  If your
          preferred editor's name is one of the mp alias names there is no conflict.
          LifeBoat will either overwrite the alias symbolic link with your editor or
          your editor will appear earlier in the PATH than the link to mp.  See the
          "addons" section for an example of how to add the nano editor to the
          LifeBoat CD.
Table of Contents

mp

          mp is a command line editor written by Angel Ortega which is released under
          the GPL.  A binary of mp version 3.2.9 is included with LifeBoat in the mp
          directory.  You can get the latest version of mp and the source code from:

          http://www.triptico.com/software/mp.html

          mp contains a configuration file located in the LifeBoat package at
          mp/.mprc.  You can change .mprc with a text editor.
Table of Contents

CD support

          LifeBoat assumes that your CD recorder is located at /dev/hdd and uses
          the kernel ide-scsi support.  If your CD recorder is scsi, or if your CD
          recorder is on an IDE device other than /dev/hdd, then set the IDESCSI
          variable in the config file.

          LifeBoat creates a rescue system on either CD-R or CD-RW.  LifeBoat tries
          to burn the CD-R or CD-RW at the fastest speed that your CD recorder can
          burn that media type.  If you want LifeBoat to do a slower speed burn then
          set the CDR_DEVICE variable in the config file to the speed that you want
          to burn at.

          LifeBoat assumes that your CD recorder is scsi device number 0,0,0.  If
          your CD recorder is located at a different address then set the CDR_DEVICE
          variable in the config file to the correct scsi device number.
          
          If you do not have a CD burner on the machine that you are making
          a LifeBoat CD for then set CDR_DEVICE="".  This tells LifeBoat that
          you have no CD burner.  LifeBoat will build a LifeBoat ISO in
          tmp/cd.image but will not try to burn it to CD.  You can move the ISO
          to a machine that has a CD burner and burn a LifeBoat CD there.
Table of Contents

Copying /dev

          LifeBoat copies your device information to the rescue cd so that there is a
          high degree of compatibility between your Linux system and your rescue CD.
          /dev is hard to copy and a mistake in copying /dev can potentially
          destroy your Linux system.  LifeBoat uses cpbk to safely and accurately
          copy your /dev directory to the rescue CD.  cpbk is also included on the
          LifeBoat CD for your use in backing up and restoring /dev if you choose
          to do so.
Table of Contents

cpbk

          cpbk is a backup program written by Kevin Lindsay and Yuuki Ninomiya which
          is released under the GPL.  A binary of cpbk version 4.1.0 and the
          cpbk man pages are included with LifeBoat in the cpbk directory.  You can
          get the latest version of cpbk and the source code from:

          http://www.icewalkers.com/Linux/Software/513790/Backup-Copy.html
Table of Contents

Bootloader

          LifeBoat uses isolinux for the bootloader.  A binary of isolinux version
          1.63 is included with LifeBoat in the isolinux directory.  You can find a
          copy of the isolinux.cfg that LifeBoat created in the audit directory.
Table of Contents

isolinux

          isolinux is a boot loader for CD written by H. Peter Anvin which is
          released under the GPL.  isolinux is part of the syslinux package.
          Documentation for both isolinux and syslinux can be found in the isolinux
          directory.  You can get the latest version of isolinux and the source
          code from:

          http://syslinux.zytor.com/iso.php
Table of Contents

Updating the LifeBoat CD

          Whenever you make major changes to your Linux system I suggest that you
          create a new rescue CD to maintain the utmost compatibility between your
          main system and your LifeBoat system.  But don't be in any hurry to throw
          away the previous version of your LifeBoat CD.  Your upgraded system may
          have problems and your latest rescue system will also contain the problems.
          I recommend that you always keep two generations of your LifeBoat CD
          available and clearly mark which is which.  You can find the date that your
          latest LifeBoat CD was created in the boot message and in the audit
          directory.
Table of Contents

Booting the rescue CD

          You need to do the following things in order to boot your rescue CD:

          Set up your bios boot sequence.  The recommended sequence is to boot floppy
          first, cdrom second, and hard disk third.

          Place your rescue CD in your cdrom.

          Boot.
     
          The following harmless warning message may appear when you boot the 
          LifeBoat CD:  Bash: no job control in this shell
     
          Once you get the command prompt you do not need the CD any longer and you 
          can remove it if you want.
Table of Contents

Using the LifeBoat CD

          There is no login or password.  You are running as root.
     
          The documentation available on the LifeBoat CD includes your man pages 
          and /root/LifeBoat.txt.  You can read /root/LifeBoat.txt with either 
          mp or less.     

          There are four empty directories available as mount points.  These are:     
             /boat1        
             /boat2
             /boat3
             /boat4
Table of Contents

Shutting down the rescue system

          Do not simply boot or power down when you are finished with your rescue
          system.  Instead remove the LifeBoat CD and then use the shutdown command.
          If you want to power down use:  shutdown -h now
          If you want to boot into your Linux system use:  shutdown -r now
     
          If you want to reboot the LifeBoat system, leave your LifeBoat CD in your 
          CD-ROM and use:  shutdown -r now
Table of Contents

Security

          The LifeBoat CD has no security.  There is no login, no password, and     
          you run as root.  This lack of security is deliberate.  It allows you to 
          use LifeBoat to repair your Linux box when security is broken and you
          cannot log in.

          The total lack of security also means that your LifeBoat CD is potentially
          very dangerous in the wrong hands.  You should keep your LifeBoat CD where
          your little brother cannot find it.
Table of Contents

Changelog

          v 0.4
            Fedora support added
            /etc/defaults added to Debian
            Documentation typos fixed
            
          v 0.3
            Debian support added
            script functions support added
            support for /etc/profile.local added
            LifeBoat will now optionally create an ISO image without burning it
            minor bug fixes
            default distribution was changed to RedHat

          v 0.2  This is the first public release of LifeBoat.
Table of Contents

Contributions

          No, I am not asking you for money.  I am asking you to make LifeBoat
          work on your distribution and then send the changes to me.

          Different distributions have different file structures so LifeBoat
          gives you a choice of DISTRO commands to copy your files to the LifeBoat
          CD.  It is quite possible that none of the DISTRO commands that come with
          LifeBoat will work well with your distribution and you may have to rewrite
          the generic distribution command to fit your distribution.  If you do so
          I would very much appreciate your sending me your new DISTRO command so
          that I can include it in future releases of LifeBoat.  Be sure to include
          your distribution name and release number.

          One of my design goals is to make LifeBoat easy to use.  If you have
          difficulties using LifeBoat, let me know, along with your ideas on
          how to make it easier to use.
Table of Contents

Bugs

          There are no known bugs in LifeBoat.  However I expect that when people
          try it on a variety of hardware and distributions some bugs will be
          discovered.  Please send me as complete a bug report as possible keeping
          in mind that I need to know any relevant information about your hardware
          and software setup.
Table of Contents

Contact

          You can contact Steve Stites at:

          lifeboat@myrealbox.com
Table of Contents

Attributions

          LifeBoat was created by Steve Stites

          cpbk was created by Kevin Lindsay and Yuuki Ninomiya

          isolinux was created by H. Peter Anvin

          mp was created by Angel Ortega

          The following people have made contributions to LifeBoat:
               Mark Alexander
Table of Contents

Return codes

          The ./lifeboat command return codes are:
            0 - normal exit
            1 - not running as root
            2 - kernel does not exist
            3 - terminated by external signal
            4 - MANPAGES variable is not yes or no
            5 - CD burn failed
            6 - DISTRO file does not exist
            7 - the loopback device does not work

Table of Contents

submarine