Overlays

Finnix, the LiveCD for system administrators

Finnix includes several options when it comes to customization: remastering, a startup shell script, and overlays. Remastering is described on its own page, and while this page will touch briefly on the startup shell script, overlays are the main focus.

Contents

[edit] Ripping and re-creating the ISO

Both options require the CD be copied to disk, modified, and the ISO re-created. This can be done a number of ways, but the easiest to explain would be in Finnix itself. Boot Finnix, mount a disk (we will be using /mnt/hda1/finnixcopy as an example), and copy the contents of the CD to that directory:

# rsync -a /cdrom/ /mnt/hda1/finnixcopy/

Now, make modifications to the copy, using one (or both) of the methods below. When you are done, you will need to create the ISO.

For x86:

# mkisofs -pad -l -r -J -v -V "Finnix Modified" -no-emul-boot -boot-load-size 4 \
     -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat \
     -hide-rr-moved -o /mnt/hda1/newfinnix.iso /mnt/hda1/finnixcopy

For PowerPC:

# cat <<EOM >/mnt/hda1/maps
.b              Raw     'UNIX'    'tbxi'   "bootstrap"
yaboot          Raw     'UNIX'    'boot'   "bootstrap"
linux           Raw     'UNIX'    'boot'   "kernel"
linux64         Raw     'UNIX'    'boot'   "kernel"
.conf           Raw     'UNIX'    'conf'   "bootstrap"
minirt          Raw     'UNIX'    'root'   "root_image"
*               Raw     'UNIX     'UNIX'   "unix"
EOM
# mkisofs -hide-rr-moved -hfs -part -map /mnt/hda1/maps -no-desktop \
    -hfs-volid "Finnix_Mod" -hfs-bless /mnt/hda1/finnixcopy/boot \
    -pad -l -r -J -v -V "Finnix Modified" -o /mnt/hda1/newfinnix.iso \
    /mnt/hda1/finnixcopy

[edit] Startup shell script

The simplest way to modify Finnix is to create a file on the CD at /FINNIX/finnix.sh. Place any commands you wish to execute here, and they will be executed just before a shell is given in Finnix, after all other commands. The closest analogy is /etc/rc.local on Red Hat-based systems.

[edit] Overlays

Overlays give you a great deal of flexibility. They allow you to create directory structures or loopback filesystems that are laid on top of the "default" Finnix filesystem. This gives you the most of the benefits of remastering Finnix, but without the complexity.

[edit] Location of overlays

Overlays are stored in /FINNIX/overlay.d on the CDROM. The contents of overlay.d may be either directories, or loopback image files.

[edit] Overlay directories

The easiest way to create an overlay is to create a directory under /FINNIX/overlay.d and treat it as a root filesystem. Consider this directory layout:

/FINNIX/overlay.d/myoverlay/usr/bin/foo
/FINNIX/overlay.d/myoverlay/etc/foo.conf

When Finnix is run, the contents of /FINNIX/overlay.d/myoverlay will be placed on top of the root filesystem. When you are given a shell prompt, /usr/bin/foo and /etc/foo.conf will be visible to you. Multiple overlay directories can be created, and all will be laid on top of the root filesystem. The overlay directory name (myoverlay in this case) is simply an identifier, and has little meaning. The only reason to consider what to name the directory overlay is the fact that overlays are placed in alphabetical order, so if /FINNIX/overlay.d/myoverlay/usr/bin/foo and /FINNIX/overlay.d/youroverlay/usr/bin/foo both exist, "youroverlay"'s version of foo will show up.

Since the CD filesystem is RockRidge, almost any type of file (symlinks, etc) can be placed. However, keep in mind:

  • PowerPC's RockRidge implementation cannot have colons (:) in the filenames.
  • Finnix can also be placed on a USB thumb drive, which must be on a VFAT filesystem, which has severe limitations.

Therefore, if you plan on doing anything fancy (such as symlinks to startup scripts), consider using the loopback image method below.

[edit] Loopback images

overlay.d may also contain files. While directories are treated as root filesystem overlays, files are treated as loopback images of root filesystem overlays. Therefore, you could take the above example and make a filesystem image out of it:

# mkisofs -r -o /mnt/hda1/finnixcopy/FINNIX/overlay.d/myoverlay.img \
  /mnt/hda1/finnixcopy/FINNIX/overlay.d/myoverlay
# rm -rf /mnt/hda1/finnixcopy/FINNIX/overlay.d/myoverlay

Finnix will mount the image loopback and proceed to overlay the directory structure as if it were a normal directory structure. The only difference is the source is a loopback filesystem of your choice, and you no longer have to worry about whether the Finnix CD is on VFAT or not.

A loopback filesystem can be:

  • ISO9660 (mkisofs) (Recommended)
  • SquashFS (mksquashfs) (Recommended, just as easy to use as mkisofs, but includes inline compression)
  • VFAT (Not recommended)
  • ext2 (ext3 may also be used, but journaling metadata will not be read)
Personal tools