Knoppix Remastering Howto

From Knoppix Documentation Wiki
(Redirected from KnoppixRemasteringHowto)
Jump to: navigation, search

German translation → Knoppix Remastering Howto Deutsch

This is a guide that will show you how to remaster KNOPPIX CD using the old "chroot method". The command lines within "Instructions" and "Remastering the ISO" are tested with Knoppix V7.0.4CD. You cannot use this HowTo for Knoppix DVD.


Setting up for Remastering

  • Boot from the Knoppix CD
  • Open a terminal and type "su" to become root.
  • Configure your Internet connection. If you use DHCP, it should already be configured. ( Run ifconfig to check.)
  • Find the partition you will use to work on and change the variable "PFAD" within the scripts as you need. In this example it is called /media/sda1. The partition should have a minimum of 5 GB free space for CD remaster and 20 GB for DVD remaster.
  • Make sure the partition is mounted!! (Run mount or df to check.)
  • The first script makes all needed preparations:
#! /bin/sh
# krhowto_1
# Path to partition you will work on
START=$(date +'%s')
# Disable screensaver
xscreensaver-command -exit
# One sub-directory will be used for the Master-CD
mkdir -p $PFAD/knx/master
cd $PFAD/knx
# You will need a swapfile
dd if=/dev/zero of=swapfile bs=1M count=500
mkswap swapfile ; swapon swapfile
# Make a sub-directory for the source
mkdir -p $PFAD/knx/source/KNOPPIX
echo "Copy the KNOPPIX files to your source directory."
echo "This will take a long time!"
cp -rp /KNOPPIX/* $PFAD/knx/source/KNOPPIX
# Additionally, copy the files to build the ISO later
rsync -aH --exclude="KNOPPIX/KNOPPIX*" /mnt-system/* $PFAD/knx/master
# gunzip inital RAM-disk
mkdir -p $PFAD/knx/minirt/minirtdir
cp $PFAD/knx/master/boot/isolinux/minirt.gz $PFAD/knx/minirt/
cd $PFAD/knx/minirt/
gunzip minirt.gz
cd minirtdir
cpio -imd --no-absolute-filenames < ../minirt
# Enable screensaver
su knoppix -c "xscreensaver -nosplash &"
echo -e "\nFinished! Used time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
  and $(expr $(expr $(date +'%s') - $START) % 60) sec."

Setup the environment for chroot

  • Use this script to build the chroot environment:
#! /bin/sh
# krhowto_2
# Path to partition you will work on
# To use the Internet add your nameserver into the chroot folder
cp /etc/resolv.conf $PFAD/knx/source/KNOPPIX/etc/resolv.conf
# Allow X-based programs in chroot
[ -e $PFAD/knx/source/KNOPPIX/home/knoppix/.Xauthority ] \
   && rm $PFAD/knx/source/KNOPPIX/home/knoppix/.Xauthority
cp /home/knoppix/.Xauthority $PFAD/knx/source/KNOPPIX/home/knoppix
chown knoppix:knoppix $PFAD/knx/source/KNOPPIX/home/knoppix/.Xauthority
# prepare enviroment for chroot
mount --bind /dev $PFAD/knx/source/KNOPPIX/dev
mount -t proc proc $PFAD/knx/source/KNOPPIX/proc
mount -t sysfs sysfs $PFAD/knx/source/KNOPPIX/sys
mount --bind /dev/pts $PFAD/knx/source/KNOPPIX/dev/pts
mount --bind /tmp $PFAD/knx/source/KNOPPIX/tmp

Working in the Chroot Environment

  • Now you can "chroot" into the copied KNOPPIX:
 chroot /media/sda1/knx/source/KNOPPIX
  • Remember that anything you do or create in the chrooted environment will get burned to the CD.
  • Within the chroot you can also start X-based programs from command line of the terminal.
  • Type "su knoppix" to become user knoppix; use "Strg D" to be root again.
  • Update your package list with: apt-get update
    • Warning: apt-get upgrade is a BAD IDEA. It will, quite probably, render your KNOPPIX remaster unbootable, or broken in some way. A far safer method is to only upgrade packages as necessary.
    • Before you can add stuff, you will probably need to remove some packages.
  • To get a list of packages installed, you can use kn-what to get lists sorted by size etc.

Leaving the Chroot

  • Press CTRL+D to leave being chrooted; then use this schript:
#! /bin/sh
# krhowto_3
# Path to partition you will work on
for i in dev/pts proc sys dev tmp; do
  umount $PFAD/knx/source/KNOPPIX/$i
sed -i '2,$d' $PFAD/knx/source/KNOPPIX/etc/resolv.conf

Changes outside from chroot enviroment

  • If you want another way to start with Knoppix, make changes in '/media/sda1/knx/master/boot/isolinux/isolinux.cfg':
    • for example replace all 'tz=localtime' with 'tz=America/New_York'
  • You can append in this file cheatcodes, which you need all the time:
    • for example write 'no3d' (without ' ') to each Append line, if you don't like compiz 3d
  • Read knoppix-cheatcodes.txt. You can find the newest version of this file on the Mirrors.
  • In '/media/sda1/knx/source/KNOPPIX/etc/X11/Xsession.d/45knoppix' you can find, which wallpaper Knoppix uses or which startup-sound.
  • In '/media/sda1/knx/source/KNOPPIX/etc/init.d/knoppix-halt' you'll find which sound you hear during shutdown.
  • Create a file '/media/sda1/knx/master/KNOPPIX/' in order to start additional services.

Remastering the ISO

  • We've finished customizing and ready to burn!
#! /bin/sh
# krhowto_4
# Path to partition you will work on
START=$(date +'%s')
# Disable screensaver
xscreensaver-command -exit
# Build new inital RAM-disk
cd $PFAD/knx/minirt/minirtdir/
find . | cpio -oH newc | gzip -9 > ../minirt.gz
cp $PFAD/knx/minirt/minirt.gz $PFAD/knx/master/boot/isolinux/
# Make the big  compressed filesystem KNOPPIX
genisoimage -input-charset ISO-8859-15 -R -l -D -V KNOPPIX_FS -quiet \
  -no-split-symlink-components -no-split-symlink-fields \
  -hide-rr-moved -cache-inodes $PFAD/knx/source/KNOPPIX \
  | /usr/sbin/create_compressed_fs -q -B 65536 -t 8 -L 9 \
  -f $PFAD/knx/isotemp - $PFAD/knx/master/KNOPPIX/KNOPPIX
# Update the file hashes used by the "testcd" boot option
cd $PFAD/knx/master ; find -type f -not -name \
  sha1sums -not -name -not \
  -name isolinux.bin -exec sha1sum '{}' \; > KNOPPIX/sha1sums
# Create new Knoppix ISO
genisoimage -l -r -J -V "KNOPPIX" \
  -b boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
  -boot-info-table -c boot/isolinux/ \
  -o $PFAD/knx/remastered.iso $PFAD/knx/master
# Enable screensaver
su knoppix -c "xscreensaver -nosplash &"
echo -e "\nFinished! Used time: $(expr $(expr $(date +'%s') - $START) / 60) min. \
  and $(expr $(expr $(date +'%s') - $START) % 60) sec. \
  \n\nThe new ISO is stored in '$PFAD/knx/remastered.iso' "

Test CD Image Without Burning a CD

  • kvm-qemu

If your processor supports virtualization and it is enabled by the BIOS you can test the new ISO by kvm-qemu. Check for support by:

egrep '(vmx|svm)' --color=always /proc/cpuinfo

If you get the result "vmx" type

modprobe kvm-intel

otherwise if you get the result "svm" type

modprobe kvm-amd

to load the kvm module. Now you can test the new ISO by

kvm -m 512 -cdrom $PFAD/knx/remastered.iso
  • VirtualBox

VirtualBox can be used to test a newly generated ISO as well.

See also:


Return to Main Page of the Wiki.