E-Lane Live CD Notes

Spent some time at B&N the other day perusing a book on live CD Linux distros (I will not mention the name at this time.)

Important information from it, pertinent to e-lane server project:

1) Knoppix boots using isolinux.

    (this is verified in passing mention on page 251
     of the 'Knoppix Hacks' book, it replaced the earlier use
     of syslinux)
     On the E-Lane CD, you can mount it and go to directory
     /boot/isolinux
     home page for syslinux and derived project isolinux:
     http://syslinux.zytor.com/

2) Isolinux boot menus are controlled by the file

   /boot/isolinux/isolinux.cfg

3) Some of the stuff passed to isolinux by the menus

   eventually makes it's way to other stuff run during the
   boot process (seems obvious, but will shortly elaborate on this
   below.)

4) After Linux starts booting the ramdisk specified via isolinux

   contains other stuff that affects the boot process.

5) Inside the ramdisk is a script Knoppix uses to do

   things during the boot process, called 'linuxrc'

6) A variable set/used in 'linuxrc' KNOPPIX_DIR

   controls what file/device is used for the root directory
   when boot is complete.

7) The setting/use of this is what probably needs to be changed

   to make the live cd default to using an on-harddisk-iso image.
   This can *probably* be altered by doing a *partial* remastering
   of the CD, only changeing things in the /boot directory,
   leaving the large, compressed system contents file alone.

   d.e.l. 8/Dec/2006

--

Steps to customize Knoppix/Knoppix-like live CD boot up process.

In this process we will for example use the Debian forks of mkisofs and cdrecord, genisoimage and wodim (Write Optical DIsk Media) respectively.

The warnings in O'Reilly "Knoppix Hacks", Hack #94, p. 282 about necessary total memory didn't seem to be of concern. This may simply be because this simplified process does not remaster the compressed file system, it only modifies the boot parameters.

1) Mount the CD, for example we'll say at /mnt/cdrom

    # mount /dev/cdrom /mnt/cdrom

2) Make sure there is a working directory to make you changes on

    # mkdir workspace/

3) Copy the contents of the CD to the workspace. Easiest is:

    # rsync -a /mnt/cdrom/   workspace/

   This is simpler then the O'Reilly "Knoppix Hacks" book
   uses in it's Hack #94 (p. 281 - 285) specificly on page 284,
   because this process is not going to modify any of the
   applications or configuration files on the CD.
   The large file of the compressed file system does not have
   to be changed.  We are concerned only with the boot parameters,
   as set by isolinux.

   Do not be concerned about the owner/group of the files
   when copied by this process, they will be irrelevant
   in the final CD, as explained in the man page for
   'genisoimage' (or 'mkisofs').

4) cd workspace/boot/isolinux

5) Make sure that the file isolinux.bin is writeable:

    chmod +w isolinux.bin

   This is because this file will me modified in the process of
   creating the bootable CD image ('mkisofs' or 'genisoimage').

6) Make sure you know how to force your editor of choice

   to override readonly access to file you edit, or change
   the permission of other files mentioned in following
   instructions to writeable as described in step # 5 above.
   Fro vi/vim/etc. for example, append '!' to any write instructions.

7) Edit the isolinux.cfg file to boot as you desire.

   An excellant reference to this are pages 135 - 149 of
   "Live Linux CDs" by Christopher Negus, (C) 2007,
   Prentice Hall, ISBN 0-13-243274-9
   http://www.prenhallprofessional.com/livelinux
   This book is Safari enabled.

   Example of an isolinux.cfg:

--

 DEFAULT elane
 # originally: DEFAULT knoppix
 # specifiing the default stanza (below) to use if
 #    none is chosen.
 #
 #  As is customary for software originating in the Unix/Linux
 #  world, a '#' in column 1 will make a comment.
 #
 #  the default APPEND statement, used if
 #  none is given:
 APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
 #   -- Note:  these are one line, ignore any wrap on it.
 TIMEOUT 300
 #   -- the timeout in seconds
 #      to trigger the default boot stanza specified above.
 PROMPT 1
 DISPLAY boot.msg
 #    The names following the 'F#' specifiers below are the
 #    files displayed when that 'F' key is pressed.
 #    These file are in the boot/isolinux/ directory.
 F1 boot.msg
 F2 f2
 F3 f3
 #
 #   Each stanza below goes from the 'LABEL' to just before the
 #   next 'LABEL' statement.
 #   It must include a 'KERNEL' statement, and should
 #   contain an 'APPEND' statement, though apparently
 #   the above default statement will be used if not specified.
 #
 # customized from the 'knoppix' label:
 LABEL elane
 KERNEL linux
 APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix myconfig=scan home=/dev/sda1
 #
 #     The statements entered at the boot command prompt
 #     (starting at 'myconfig=...')
 #     have been tacked on the end of the 'APPEND' used by the 'knoppix'
 #     stanza.
 #     Though not exaustively tested, it seems these need
 #     to be on the end of the 'APPEND",
 #     they cannot be put at the beginning.
 #
 LABEL knoppix
 KERNEL linux
 APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
 LABEL expert
 KERNEL linux
 APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce BOOT_IMAGE=expert
 #  end of one stanza ('expert') and start of another ('memtest').
 LABEL memtest
 KERNEL memtest
 APPEND initrd=
 ..............

--

8) You might also need/want to edit the menu files as desired

    ( boot.mst, f2, f3 in the above example.)
    Again, these are in the boot/isolinux/ directory.
    We will not go into details of this in this discussion.

8) cd workspace/ # use whatever is appropriate to get back to this

                    #  directory.

9) Create the iso image.

    Using the 'genisoimage' command of Debian:

 # genisoimage -pad -l -r -J -v -V 'ELANE' -no-emul-boot   \
 #         -boot-load-size 4 -boot-info-table              \
 #         -b boot/isolinux/isolinux.bin                   \
 #         -c boot/isolinux/boot.cat -hide-rr-moved        \
 #         -o /some/dirctory/your.elane.iso  workspace/

    ( above, '#' = command prompt, '\'  = continuation to next line)

    This pretty much the same as specified in the "Knoppix Hacks"
    book, but the 'genisoimage' command has replaced
    'mkisofs' (which it is a fork of).
    You may need to use the older name.

    It might be good to put this in a script file,
    to either shebang or source it, or perhaps make a
    shell alias or function of it.
    Even if you edit the file to make changes, instead of
    passing parameters, it will probably be less error prone.

    It probably is also good to at least once go through
    all the switches on this in the man pages
    for genisoimage/mkisofs to see what they are for.

    Warning:  on the -b and -c parameters above,
              the directory is relative to the source path
              (in the example 'workspace/')
              not the directory you are actually in
              when issuing this commadn. Otherwise
              you will get only error messages.

10) Now burn your CD, typically

    #  wodim -dao  dev=reliable    your.elane.iso

11) Verify that it is a good burn

    # cmp your.elane.iso /dev/cdrom  ;  echo $?

12) Try it out by booting a computer with it!

Dallas E. Legan / 15 Dec. 2006

--

From email filed away 22 Nov 2006:

Below are change made to files run and nsd-postgres in directory /OpenACS/knoppix/etc/daemontools/ to enable restarting nsd after killing it. I haven't tried rebooting the system from scratch yet to make sure that isn't a problem.:

 ls

 cat run

#!/bin/sh

# give time for Postgres to come up sleep 4

# orig: exec /usr/local/aolserver/bin/nsd-postgres -it /var/lib/aolserver/service0/etc/config.tcl -u service0 -g web

exec /OpenACS/knoppix/etc/daemontools/nsd-postgres -it /OpenACS/knoppix/www/config.tcl -u service0 -g web -b 192.168.1.229:80

# For AOLserver 4 using privileged ports (usually < 1024), add the flag # -b youraddress:yourport

# /OpenACS/knoppix/etc/daemontools

 cat nsd-postgres

#!/bin/bash

export PATH=$PATH:/usr/local/pgsql/bin # orig: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib:/usr/local/aolserver/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/UNIONFS/usr/lib/postgresql/lib:/usr/local/aolserver/lib:/KNOPPIX/usr/lib/aolserver4/bin

# orig: exec /usr/local/aolserver/bin/nsd $* exec /KNOPPIX/usr/lib/aolserver4/bin/nsd $*

 d.e.l. 18 April 2007

--

 From Hack #5 from the 'Knoppix Hacks' ORA book, pages 11-12, add the

 bootfrom=/dir/path/some/live_CD.iso

 boot parameter to boot from a live CD iso on your hard drive.

 To simply copy the CD contents to a harddrive, use boot parameter

 tohd=/dev/hdXY

 and it will use a directory copied to /dev/hdXY instead of your CDROM drive.

 Use boot parameter

 fromhd=/dev/hdXY

 when booting in the future to reuse the contents previously copied to
 the drive.

 Using boot parameter

 toram

 will cause Knoppix to run from a ramdisk file system,
 completly in memory.  For a full Knoppix CD this needs at least
 1 G of memory.

 Dallas E. Legan II / legan@acm.org / dallas.legan@gmail.com / aw585@lafn.org
 07 Nov 2007

Help