Bootable 3" Mini-CDR Linux Distribution mini-HOWTO


         

v. 1.1 - August 2002

(c)2002 by main(){int j=-1;char t[]="rfnqyt?%ggfqqEyz}3twl\n";
while(t[j]!='\n'){putchar(t[++j]-'\05');}return 0;}

Introduction

Here's how to make a 3" mini-CDR distribution for your SFF (micro-ATX, Flex-ATX, or mini-ITX) PC. If you use a small form factor computer, why not have a mini-Linux installation and rescue CD? There are a number of other 3" mini-CDR Linux distros, including many different bootable business card Linux distributions. These typically fit onto a floppy, or a 40- or 50MB credit card-sized CDR. One of my favorites is from http://www.lnx-bbc.org . Some other mini distros are:

CRUX

http://crux.nu/

Quote:

CRUX is a lightweight, i686-optimized Linux distribution targeted at experienced Linux users. The primary focus of this distribution is "keep it simple", which is reflected in a simple tar.gz-based package system, BSD-style initscripts, and a relatively small collection of trimmed packages. The secondary focus is utilization of new Linux features and recent tools and libraries. CRUX also has a ports system which makes it easy to install and upgrade applications.


Comment: Easily fits on 210MB Memorex CDRWs, includes development tools, and is simple and easy to install.

Trustix

http://www.trustix.net/

Quote:


Trustix Secure Linux is a small Linux distribution for servers. With focus on security and stability, the system is painlessly kept safe and up to date from day one using swup, the automated software updater.


Comment: Even though this distro uses the latest 2.2.XX stable kernel - it is updated quite often, with automatically generated .iso images incorporating the latest security fixes - i use VMware to test installs prior to attempting CF installs, and you can set up extremely small systems w/ssh, http, firewalling, etc. on 128MB or smaller CFs! you get nearly *everything* you need, including kernels, gcc, etc. - system is RPM based.

Smoothwall

http://www.smoothwall.org/community/home/

Quote:


SmoothWall was first released to the world in July 2000. Founded by myself and Lawrence Manning it was designed to produce a hardened internet firewall device, turning a server, workstation or reduntant PC into a replacement for a hardware firewall router often costing several thousands of dollars.

SmoothWall was designed from the ground up with specific aims.

1. to be easy to manage via a webbrowser
2. to support and compliment existing ISDN cards, Modems and network hardware seamlessly and support a vast array of connection methods and ISPs in over 40 countries
3. able to be installed by everyone from a home user to an IT technician
4. to offer support for webservers and servers having to live securely in a de-militarised zone
5. to take this product and shove it under the noses of the security vendors charging huge amounts of money for providing lesser product.


Comment: Bizarre #5 aim, but the 22MB smoothwall distro, easily fits on a bootable business card and nearly instantly installs a web-administered firewall/router/gateway with ssh, http, mail, and other services... the .99se edition is the latest stable version, but a 2.0 edition is in beta. Not suitable for use as a development environment or use with X11.

Debian

http://www.phy.olemiss.edu/debian-cd/

Quote:

These ISO images are installation media for the current release of the Debian GNU/Linux operating system (Debian 3.0). For more information about Debian, please visit http://www.debian.org/ .

The ISOs are small enough to burn to a 8 cm (3 inch) CD-R/RW (although they'll also work on 12 cm/5 inch CD-R/RW media), and contain enough packages to install a functional version of Debian woody without going to the net -- all packages from required, important and standard are included, as are emacs21, postfix, ssh, and gnupg when they fit. A complete list of included packages is available in the .packages file for each architecture. Unlike most "netinst" ISOs, they will install a useful console-based subset of Debian woody without any extra packages downloaded, and provide all the tools you should need to install a complete Debian with any sort of network connection - PPP dialup, ISDN, (A)DSL, cable modem, or LAN/WAN.

Comment: Nice CD distro (updated quite often for security fixes - last update was yesterday [8/30/02])... you won't get a working X system up w/o additional downloads (it supports network, Internet installs), and may have to rebuild the kernel in order to use ipchains or iptables, unlike some of these other mini-distros... but it is Debian, and you can install a working system w/compiler, etc. in less than 300MB.

This mini-HOWTO focuses on the more complete, up to date, and installable Peanut Linux distro. The approach outlined here offers the chance to build a great little Linux distribution with X, KDE, gcc, sound, USB, and a host of other goodies. I focus on the latest Peanut Linux distribution for a number of reasons: Peanut Linux offers a cutting-edge 2.4.19 Linux kernel; XFree86 4.2; Enlightenment; and KDE3, along with a wealth of other utilities for the x386 platform. The distribution is easy to install, and has many sane defaults. Alas, OpenSSH is not included in the base distribution, but you can easily add the software later on.

The following steps are necessary because the original Peanut Linux author distributes an .iso that is too large to fit on a 3" mini-CDR (but otherwise does an OUTSTANDING job with the distro)..

Note that 3" CDRs come in a variety of sizes from a number of vendors:

185MB
190MB
210MB
245MB <- new! just found!

Supported burn speeds will vary, but you can count on 4X as a safe base burn speed to avoid creating 'coasters.' You may also consider using a mini-CDRW, especially if you want to upgrade your SFF mini-CDR distro frequently, and your drive supports booting from CDRW. Memorex currently markets  3" 210MB CDRs and CDRWs, and I just found 245MB CDRs (24X!) at a local computer store.

What's Not Covered Here

This mini-HOWTO does not discuss the pros or cons of using the Peanut Linux distribution. Nor will you find instructions on installing, configuring, maintaining or using Peanut Linux. As always, back up your original system if you are performing a new install. The Peanut Linux distro also works quite well under VMWare's Workstation 3.1.1 release. You may find that Peanut Linux contains nearly everything you need in a distribution.

Requirements

Step-by-Step Instructions

You'll need to remove selected clients, libraries, or documents from the original Peanut distribution in order to build a smaller .iso image which can then be burned onto your 3" CDR. Note that once you build a working mini-CD, you can always add software later on after installation!

The procedure outlined here can take about half an hour, depending on the speed of your computer's hardware.

Here's how:

1. Download the peanut linux .iso image previoulsy a 236290048-byte image named small.iso, but which has now bloated to more than 254MB!) from the Peanut Linux home page, or any mirror site.

2. As root, create a mount directory for the .iso image:

mkdir peanut_org


3. Mount the iso image and make its contents available:

mount -t iso9660 -o loop small.iso peanut_org

4. Copy the file peanut.bz2 (which contains a compressed tar archive of an entire Linux file system) to a new directory:

mkdir foo ; cp peanut_org/peanut/peanut.bz2 foo

5. Uncompress the peanut.bz2 file (note that newer versions of the tar command support bzip2 operation):

cd foo ; bunzip2 peanut.bz2

6. Use the tar command to extract the resulting peanut file (preserving permissions), then delete the tar archive:

tar -pxf peanut ; rm peanut

7. You'll end up with a root filesystem in the current directory:

bin  dev home lost+found opt  root tmp var
boot etc lib  mnt        proc sbin usr


8. Now comes the fun part. Find the largest files in the file system - these will make good candidates for removal in order to pare down your system.

HINT: If you don't want to use KDE3, and would prefer to use the Enlightenment window manager instead, save yourself a lot of time and trouble - simply delete the opt directory and then create your bootable .iso image. You'll end up with an image that fits perfectly on 185MB 3" mini-CDRs!

Start with all files 1MB or larger:

find . -size +1024k -print

./lib/libc-2.2.5.so
./opt/kde3/bin/kmail
./opt/kde3/lib/kde3/libkpresenterpart.so
./opt/kde3/lib/kde3/libkspreadpart.so
./opt/kde3/lib/kde3/libkiviopart.so
./opt/kde3/lib/kde3/libkwordpart.so
./opt/kde3/lib/kde3/kjs_html.so
./opt/kde3/lib/libkio.so.4.0.0
./opt/kde3/lib/libartsmodules.so.0.0.0
./opt/kde3/lib/libkdecore.so.4.0.0
./opt/kde3/lib/ksirc.so
./opt/kde3/lib/libkdeui.so.4.0.0
./opt/kde3/lib/libkotext.so.2.0.0
./opt/kde3/lib/libkhtml.so.4.0.0
./opt/kde3/share/apps/kthememgr/Themes/Eclipse.ktheme
./usr/bin/gs
./usr/bin/vi
./usr/bin/mplayer
./usr/bin/gimp-1.2
./usr/bin/mencoder
./usr/lib/qt3/lib/libqt-mt.so.3.0.4
./usr/lib/cups/filter/pdftops
./usr/lib/win32/3ivxdmo.dll
./usr/lib/libaspell.so.10.1.1
./usr/share/foomatic/db/source/opt/gimp-print-ijs-pagesize.xml
./usr/share/foomatic/db/source/opt/gimp-print-pagesize.xml
./usr/share/aspell/english-med-only
./usr/local/RealPlayer8/Common/rmacore.so.6.0
./usr/local/RealPlayer8/realplay
./usr/local/compupic/compupic
./usr/local/netscape/java/classes/java40.jar
./usr/local/netscape/netscape
./usr/X11R6/bin/Xprt
./usr/X11R6/bin/Xvfb
./usr/X11R6/bin/gvim
./usr/X11R6/bin/Xnest
./usr/X11R6/bin/XFree86
./usr/X11R6/lib/libOSMesa.so.3.3
./usr/X11R6/lib/modules/dri/sis_dri.so
./usr/X11R6/lib/modules/dri/radeon_dri.so
./usr/X11R6/lib/modules/dri/tdfx_dri.so
./usr/X11R6/lib/modules/dri/i810_dri.so
./usr/X11R6/lib/modules/dri/r128_dri.so
./usr/X11R6/lib/modules/dri/i830_dri.so
./usr/X11R6/lib/modules/dri/mga_dri.so
./usr/X11R6/lib/modules/dri/gamma_dri.so
./usr/X11R6/lib/modules/extensions/libGLcore.a
./var/lib/rpm/fileindex.rpm
./var/lib/rpm/packages.rpm


Hmm. Looks like there are a number of candidates in the list. I'd avoid deleting any libraries at this point unless you know what you're doing. To get a better idea about potential candidates, use the du command to see the relative sizes of the directories:

du -b --summarize usr/local/RealPlayer8
12288000 usr/local/RealPlayer8

du -b --summarize usr/local/netscape
17178624 usr/local/netscape


Other candidates in the list above may be the XFree86 Xnest and Xprt servers. If you don't use them, why not get rid of 'em?

ls -l usr/X11R6/bin/Xnest
-rwxr-xr-x 1 root root 2780856 Jun 9 20:00 usr/X11R6/bin/Xnest

ls -l usr/X11R6/bin/Xprt
-rwxr-xr-x 1 root root 1720984 Jun 9 20:00 usr/X11R6/bin/Xprt


You may find that additional candidates are the contents of the /usr/share/doc and/or /usr/X11R6/lib/X11/doc directories. If you don't need man pages, you can also delete the contents of one or more of those directories without harming commands or library dependencies. You'll also save some room by deleting unwanted sounds and wallpapers.

Also, note that the file sizes here reflect the uncompressed sizes - this means that you'll need to delete roughly 2X the number of bytes from the uncompressed peanut file system in order to pare down the resulting .iso image to fit onto your CDR. For example, if you have a 185MB CDR, you'll need to delete at least 100MB or more of uncompressed files!

HINT: At the same time, you can also add files! For example, Why not copy a working XF86Config-4 file into the /etc/X11 or root operator's home directory and have it available immediately after installation? If you know the correct kernel modules to load for sound and Ethernet, edit /etc/rc.d/rc.modules to enable probing at boot time. This will save time and effort following an initial install. You can also add your own /etc/hosts or /etc/resolv.conf file and others to have a working, pre-configured system after installation!

Continue working until you have removed files you don't want or don't need. Don't forget to remove stale symbolic links (usually shown in red when using a colorized ls listing). However, note that some links may appear stale, but point to commands or directories that will become available after installation and booting.

9. When finished, rebuild the tar archive named peanut (preserving permissions) in a directory above (again, note that newer versions of the tar command support bzip2):

tar -cpf ../peanut .

10. Use the bzip2 command to compress the tar archive:

cd .. ; bzip2 peanut

11. Create a copy of the original peanut_org directory, then unmount the mounted peanut linux .iso image:

cp -avR peanut_org mini_peanut ; umount peanut_org

12. Copy the new peanut.bz2 file into the new peanut directory:

cp peanut.bz2 mini_peanut/peanut

(you may be asked to overwrite the original)

13. Create a bootable .iso image of the new peanut directory:

this used to work with versions of peanut linux prior to Nov. 2002:

mkisofs -b Linux -c catalog -r -o mini_peanut.iso mini_peanut

however, you should now use:

mkisofs -o mini_peanut.iso -b boot.bin -c boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -l -R -r mini_peanut


14. Burn a copy of the new .iso image and try booting! If you are unsure or unwilling to risk creating a coaster of a blank 3" CDR, use a cheap 5" CDR (~$0.18[US] nowadays):

cdrecord -v speed=4 -data -eject dev=X,X,X mini_peanut.iso

Where X,X,X is the SCSI info returned by the cdrecord command:

cdrecord -scanbus

Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.22
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'PLEXTOR ' 'CD-R PX-320A ' '1.01' Removable CD-ROM
0,1,0 1) *
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *

In this case, the cdrecord command would use dev=0,0,0

Installation

Proceed as normally with the Peanut install. You may get some errors reported during the installation of the new peanut.bz2 file. The errors will most likely be "timestamp" errors, especially if you copy files from an existing Linux install into the new peanut.bz2 archive. You can get around this by using the touch command to reset the date/timestamp of the new files, but I found that the install proceeded without problems. (It is actually good that you get such errors, btw, as this is a check against a possible corruption of the original .iso image!)

Note that if you simply delete the opt directory and then build your .iso, you won't get any errors during installation (perhaps not until you use the rpm command after logging into your new system - see below).

Post-Installation

If you have trouble burning CDs or using your CDRW drive, read the CD-WRITING HOWTO. Usually, a kernel boot argument is used in the LILO (or GRUB) boot configuration file to automatically set up SCSI emulation for an ATAPI device:

append="hdc=ide-scsi"

After installation you will also probably need to rebuild the new Peanut Linux system's RPM database (as you've deleted files from the filesystem using the rm and not rpm command before creating the .iso image). See the rpm man page for the rebuild command line incantation.

You may also want to consider building a new peanut.bz2 file system after installing and configuring Peanut Linux. Simply burn a new custom mini-CD and you'll have a super-quick restore CD for your Linux box!

Final Thoughts

A big vote of thanks to the Peanut Linux folks for creating a great distribution (there are 5,000 additional packages of software for the system). Obviously, the best approach in creating a mini-CDR distro would be to build one from scratch. However, I use the Peanut Linux distro as an example because it is such a good distribution and constantly updated. Feel free to experiment on your own, and if you come up with an easier way to create a mini-CD, let people know about it!

Good luck!

updated: Veterans Day 11/11/02