Knoppix Remastering

From LVL1
Jump to navigation Jump to search

Remastering Knoppix Basic Steps:

1. Build Build Enviroment

mkdir /remaster
cd /remaster
mkdir -p ramdisk/KNOPPIX
cp -a /KNOPPIX/* ramdisk/KNOPPIX
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
mkdir iso
rsync -a --exclude “/KNOPPIX/KNOPPIX” /cdrom/ iso/

2. chroot into ramdisk and install/remove programs

cp /etc/resolv.conf ramdisk/KNOPPIX/etc/resolv.conf
mount -o bind /proc ramdisk/KNOPPIX/proc
#mount -o remount,dev / #optional, use only if you get a bunch of permission denieds
chroot ramdisk/KNOPPIX

#list of biggest packages:
dpkg-query -W --showformat=’${Installed-Size} ${Package\n}’ | sort -n
#remove package
apt-get --purge remove package_name
#search for a package to install
apt-get update
apt-get search package_name
#look at package info
apt-cache show package_name
#install package
apt-get install package_name
#clean up downloaded packages (always do then when you’re done with apt-get in Knoppix)
apt-get clean

#exit chroot

3. copy over files/configs

Be sure to preserve permissions, if in doubt use sudo cp -p to preserve permissions.
/etc/skel is no longer used, instead use /home/knoppix (ramdisk/KNOPPIX/home/knoppix) for the home directory
/etc/X11/Xsession.d/45knoppix is where a lot of Knoppix specific scripts are launched.  For example, the KNOPPIX directory put on the Desktop is created in here.  This script is also a good place to launch X programs. Just remember to use sudo -u knoppix or it will be run as root.

If you can’t find the configs for a program sometimes it is easier just to copy the entire knoppix home directory.  Just make sure to keep everything clean!
rm remaster/KNOPPIX/home/knoppix/ -rf
cp -rp /home/knoppix remaster/KNOPPIX/home/

4. build ramdisk

umount ramdisk/KNOPPIX/proc
rm ramdisk/KNOPPIX/etc/resolv.conf
mkisofs -R -U -V "My Version of Knoppix" -publisher "Me" -hide-rr-moved -cache-inodes -no-bak -pad ramdisk/KNOPPIX | nice -5 /usr/bin/create_compressed_fs -m -B 131072 - iso/KNOPPIX/KNOPPIX

5. customize iso

There are a few files in here that might be of interest; the default desktop background is here and the web page that is displayed when the disc is put into a Windows machine is also here.

6. build iso
rm knoppix.iso
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/ -o knoppix.iso iso

7. Test iso without burning
Reboot, at Knoppix boot prompt run:
knoppix bootfrom=/dev/sda1/remaster/knoppix.iso

Updated Version

  • Download latest knoppix iso
  • Create temp disk
qemu-img create -f raw knoppix_localdrive.raw 20G
qemu-system-i386 -enable-kvm -cdrom KNOPPIX_V7.0.5CD-2012-12-21-EN.iso -m 1.5G -boot d knoppix_localdisk.raw
  • In Knoppix:
    • Format disk to ext4 something
    • Mount it
  • Copy in ramdisk files
cp -a /KNOPPIX/* ramdisk/KNOPPIX
  • Copy the iso files
mkdir iso
rsync -a --exclude “/KNOPPIX/KNOPPIX” /mnt-system/ iso/
  • Close VM
  • Mount