Remaster Knoppix without Remastering

Why go through complicated steps to remaster Knoppix, when there are a number of methods to get the most of the functionality without the fuss?
Tweak initrd

Along with the other boot files, under boot/isolinux/ is the default Knoppix initrd file called minirt.gz. This file is the initial root image that Knoppix mounts. Within the image are essential files for the boot process, including the init executable, but the file of most interest to Knoppix hackers is the linuxrc file, which acts as Knoppix's general startup script. First, make a copy of the minirt.gz file (in my example, I assume it was mounted under /cdrom), uncompress it and then mount the filesystem:

# cp /cdrom/boot/isolinux/minirt.gz .
# gunzip minirt.gz
# mkdir temp
# mount -t ext2 -o loop minirt ./temp

Now, if you look in the top-level directory of that mounted filesystem, you will see the linuxrc file. A lot of the script defines default settings, such as which filesystems are built in to Knoppix and the process Knoppix uses to mount them, but you also can see where Knoppix defines system-wide defaults and also allows you to override them. For instance, the following lines define the default Knoppix directory and cloop file and the ability to overwrite them via a cheat code:

case "$CMDLINE" in *knoppix_dir=*) KNOPPIX_DIR="$knoppix_dir"; ;; esac
case "$CMDLINE" in *knoppix_name=*) KNOPPIX_NAME="$knoppix_name"; ;; esac

If you want to add some extra functions to the boot process, read through the script to identify where would be best. For instance, at some points of the script, the KNOPPIX cloop filesystem isn't loaded yet, nor are many common modules. If you aren't sure where to add your changes, just add them to the end of the script before the comment #Give control to the init process. At that point, Knoppix should have major modules and filesystems loaded and mounted.

Once you are finished with your tweaks, unmount the minirt filesystem and recompress it. Then, you can overwrite the default version with your custom edition:

umount temp
gzip -9 minirt

These are only a few examples of how to remaster Knoppix without remastering. One of the great things about these methods is that they are typically easy to try, so if you make a mistake, you can fix it quickly. Plus, most of these methods lend themselves well to migration from one Knoppix disc to the next for when the next version of Knoppix is released. Finally, because most of your custom tweaks can be self-contained, if you want to share them with friends, you simply can share your and configs.tbz files, for instance, instead of an entire ISO image.

Kyle Rankin is a Senior Systems Administrator in the San Francisco Bay Area and the author of a number of books, including Knoppix Hacks and Ubuntu Hacks for O'Reilly Media. He is currently the president of the North Bay Linux Users' Group.


Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Persistent Disk Image

Adel Afsharipour's picture

Hi Dear Kyle
Thanks for the info. Currently I'm using Knoppix version 6 and as it has switched to LXDE, the instruction for the creating persistent disk image, as you said by selecting from menu ... is not available.
I have two questions:
1) How can I create the disk imgae from the terminal ?
2) After creating a disk can I resize it ?
Thanks a lot.
Best regards

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState