Debootstrap to LiveCD
This HOW-TO is to create a Live CD using the Debian debootstrap utility to install your base, and then to further work towards a complete LiveCD of your preference.
Contents
Pretense
It is assumed that you have the understanding:
- Vi or a similar editor
- BASH Programming howto
- You have a Knoppix 4.1 ISO
- 512MB Memory, possibly more or less
- 5 gigs of hard drive space (maybe less)
The goal of this remastering method is to create a custom live-cd that involves only the applications you desire.
- If you do not require X why have it take space?
Other goals of this project is to stem a new set of live-cd's to perform a specific function
- Instant SAN: iSCSI, ATAoE, HyperSCSI, start the live-cd and share the devices at the block level.
- Instant NAS: NFS, FTP, HTTP, SAMBA, Appletalk (netatalk)
- Instant VM: Instant Virtual Machine, Rapid administration for system provisioning.
- much much more.
Begin
First create a working directory, in this examle we will use /mnt/hda1/source/KNOPPIX
- choose a mirror of your choice: http://www.debian.org/mirror/list
- Also choose a release of your choice, either stable, testing, or unstable.
- Choose the binary type, i386 or x86-64, power pc, etc.
In this example I have chosen my mirror to be ftp://ftp.egr.msu.edu/debian and I have chosen my release to be stable to run debootstrap
debootstrap --arch i386 sarge /mnt/hda1/source/KNOPPIX ftp://ftp.egr.msu.edu/debian
next you will want to mount your proc directory
Mount Proc
Mount the proc directory as follows:
mount proc -t proc /mnt/hda1/source/KNOPPIX/proc
Setup Networking
cp /etc/resolv.conf /mnt/hda1/source/KNOPPIX/etc/resolv.conf cp /etc/hosts /mnt/hda1/source/KNOPPIX/etc/hosts cp /etc/hostname /mnt/hda1/source/KNOPPIX/etc/hostname
CHROOT
chroot /mnt/hda1/source/KNOPPIX/ /usr/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login
reconfigure console
dpkg-reconfigure console-data
MAKEDEV
run makedev
cd /dev ./MAKEDEV generic
BASE ENVIRONMENT
Run base-config
base-config
Install some necessary packages:
apt-get install hotplug hotplug-utils gawk laptop-detect
KNOPPIX PACKAGES
Export the following variable:
KNOPPIX_PACKAGES=" automount-knoppix \ etcskel-knoppix \ hotplug-knoppix \ hwdata-knoppix \ knoppix-bookmarks \ knoppix-certificates \ knoppix-customize \ knoppix-dma \ knoppix-graphics \ knoppix-image \ knoppix-installer \ knoppix-menu \ knoppix-ndiswrapper \ knoppix-remountrw \ knoppix-setrootpassword \ knoppix-sounds \ knoppix-splash \ knoppix-splash-utils \ knoppix-swm \ knoppix-terminalserver \ kudzu-knoppix-dev \ kudzu-knoppix-vesa \ libntfs5-knoppix \ linux-kernel-headers-knoppix \ networkconfig-knoppix \ rebuildfstab-knoppix \ rootshell-knoppix \ sambastart-knoppix \ saveconfig-knoppix \ scanpartitions-knoppix \ sshstart-knoppix \ sudoers-knoppix \ sysvinit-knoppix \ unionfs-knoppix-modules-2.6.12 \ user-profile-knoppix \ usleep-knoppix"
proper method
apt-get install ${KNOPPIX_PACKAGES};
work-around method
Since The mirrors I have to obtain the knoppix scripts are not functional (I can't connect, mirror is down), I am using dpkg -l to see what is installed for each package that was installed on the cd. From that list of packages I use dpkg --listfiles to see what files and directories each package has.
To copy over the files from the knoppix packages on the cd to the bootstrap installation:
for PACKAGE in ${KNOPPIX_PACKAGES}; { \ for ITEM in `dpkg --listfiles ${PACKAGE} | grep -v "\.$"`; { if [ -d ${ITEM} ]; then mkdir -p ${SOURCEDIR}/KNOPPIX${ITEM}; else cp -ax ${ITEM} ${SOURCEDIR}/KNOPPIX${ITEM}; fi; }; };
Copy passwd files
cp -ax /etc/passwd* ${SOURCEDIR}/KNOPPIX/etc/. cp -ax /etc/group* ${SOURCEDIR}/KNOPPIX/etc/. cp -ax /etc/shadow* ${SOURCEDIR}/KNOPPIX/etc/.
ENTIRE SCRIPT
#!/bin/bash SOURCEDIR=/mnt/hda1/source MASTERDIR=/mnt/hda1/master mkdir ${SOURCEDIR}/KNOPPIX debootstrap --arch i386 sarge /mnt/hda1/source/KNOPPIX ftp://ftp.egr.msu.edu/debian mount proc -t proc ${SOURCEDIR}/KNOPPIX/proc chroot ${SOURCEDIR}/KNOPPIX/ /usr/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login
Once Loged into chroot
dpkg-reconfigure console-data cd /dev ./MAKEDEV generic base-config apt-get install hotplug hotplug-utils gawk laptop-detect rm -rf /etc/rc{0,1,2,3,4,5,6,S}.d/*
Outside of CHROOT
KNOPPIX_PACKAGES=" automount-knoppix \ etcskel-knoppix \ hotplug-knoppix \ hwdata-knoppix \ knoppix-bookmarks \ knoppix-certificates \ knoppix-customize \ knoppix-dma \ knoppix-graphics \ knoppix-image \ knoppix-installer \ knoppix-menu \ knoppix-ndiswrapper \ knoppix-remountrw \ knoppix-setrootpassword \ knoppix-sounds \ knoppix-splash \ knoppix-splash-utils \ knoppix-swm \ knoppix-terminalserver \ kudzu-knoppix-dev \ kudzu-knoppix-vesa \ libntfs5-knoppix \ linux-kernel-headers-knoppix \ networkconfig-knoppix \ rebuildfstab-knoppix \ rootshell-knoppix \ sambastart-knoppix \ saveconfig-knoppix \ scanpartitions-knoppix \ sshstart-knoppix \ sudoers-knoppix \ sysvinit-knoppix \ unionfs-knoppix-modules-2.6.12 \ user-profile-knoppix \ usleep-knoppix"
for PACKAGE in ${KNOPPIX_PACKAGES}; { \ for ITEM in `dpkg --listfiles ${PACKAGE}`; { if [ -d ${ITEM} ]; then mkdir -p ${SOURCEDIR}/KNOPPIX${ITEM}; else cp -ax ${item} ${SOURCEDIR}/KNOPPIX${ITEM}; fi; }; };