Remaster Knoppix without Remastering
If you have used Knoppix for any extended period of time, chances are you eventually thought about customizing it. You might have simply wanted to make cosmetic changes with a new background and a different theme, or you might have wanted to add programs, change what happens at startup, or make any number of more-intensive changes. Well, you aren't alone. There are more than a hundred different Knoppix-based live CDs in existence. Some have changed only a few tools, and others have performed a complete overhaul of the programs, the themes and even the file structure.
If you had decided to change Knoppix, you quickly would become acquainted with some of the guides both on-line and in print about Knoppix remastering. At that point, some of you would have read the complicated set of steps and decided it just wasn't worth it. Knoppix fits all of its software within a compressed loopback filesystem on the disc. To remaster Knoppix, you must make a copy of the uncompressed contents of that filesystem, use chroot to access the copy as though it were the root filesystem, make any changes you want to make, and then re-create the new cloop filesystem and ISO image with a few gigantic commands on the command line.
Of course, I oversimplified and excluded a few steps there. Besides some of the more technical steps, I also left out that minor bug you undoubtedly introduced but didn't notice until you booted. That means you get to go through the remastering process (especially the time-consuming steps of creating a new cloop filesystem) all over again. I also left out the step where you notice that even though you made minor changes, your ISO inexplicably is much larger than it was before and won't fit on a CD, so back to the remastering process you go to free up more space.
The fact is, traditional Knoppix remastering is a time-consuming, error-prone, complex process full of trial and error, but there is a better way. There are a few different methods you can use to tweak the default Knoppix disc without using the remastering process. I like to refer to these methods as “remastering Knoppix without remastering”, because the default Knoppix cloop filesystem stays the same throughout the entire process.
I first became interested in low-impact Knoppix tweaks when I had to create a custom CD to include with my book, Knoppix Hacks. I didn't want to do much—just change the default background and add a few links to the desktop. Although I could have remastered the CD, I was concerned about introducing bugs, even with minor changes. Imagine if I had discovered a bug after the CD was printed and shipped around the country with the book! I figured if I could tweak Knoppix but leave the compressed image alone, I would reduce the risk considerably.
Ever since my first attempt to remaster Knoppix without remastering, I've used these methods so much that I actually prefer them and find them superior to remastering for most people's needs. Not only is the process much quicker and less complex, it's also simpler to migrate your changes once the next version of Knoppix is released.
The first method you can use to change Knoppix involves a classic Knoppix tool called saveconfig. This tool creates and lets you choose a number of different files and settings from your user's configuration files, all of the files on the desktop, and network, graphics and other settings. saveconfig then creates a tarball called configs.tbz out of the files and stores it on a USB key, hard drive or other writeable media of your choice along with a custom knoppix.sh script.
To run saveconfig, click K→Knoppix→Configure→Save Knoppix Configuration or type saveconfig in a terminal. Then, you can choose which settings to save and to which hard drive to save them. The next time you boot your computer, type myconfig=/dev/sda1/ to point Knoppix to a particular saved config, or type myconfig=scan, and Knoppix will scan all available drives for you. At the end of the boot process, Knoppix will run the knoppix.sh script on the drive, which will extract the tarball and restore your settings.
For minor, mostly cosmetic changes, the standard saveconfig script might serve all your needs. Simply make your changes, and then tell saveconfig to back up your personal configuration. This is useful, but you might want to back up only a few files, or you might want to add files that saveconfig doesn't save by default. To do that, you can tweak either the configs.tbz or knoppix.sh file. First, run saveconfig to create a configs.tbz and knoppix.sh file. Then, uncompress the configs.tbz file:
$ bunzip2 configs.tbz
Now, use tar to add new files to the tarball:
$ tar -rpPf configs.tar /path/to/file
You also can use tar to delete files:
tar --delete -pPf configs.tar /path/to/file
Once you are finished with your changes, you can recompress the tarball:
$ BZIP2=-9 bzip2 configs.tar $ mv configs.tar.bz2 configs.tbz
Another way to tweak saveconfig (or even bypass it altogether) is to realize that when you tell Knoppix to use a particular saved configuration, all it really does is execute the knoppix.sh file, which is a standard shell script. That shell script contains the tar commands to extract the file. This means anything you put in the knoppix.sh file will be executed at the end of the boot process. What's more, if you create a new Knoppix disc and place the knoppix.sh in the KNOPPIX/ directory on the disc, it will be executed automatically every time Knoppix boots. So, if there's an extra program you'd like Knoppix to have, just track down the .deb file for it and any of its dependencies, and add them to the disc. Then, in the knoppix.sh script you can put:
dpkg -i /cdrom/*.deb
Knoppix will install all of those programs at the end of the boot process. If you want to run any other commands or start any services, you also could put them in this script.
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.
|Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform||Jan 23, 2015|
|Designing with Linux||Jan 22, 2015|
|Wondershaper—QOS in a Pinch||Jan 21, 2015|
|Ideal Backups with zbackup||Jan 19, 2015|
|Non-Linux FOSS: Animation Made Easy||Jan 14, 2015|
|Internet of Things Blows Away CES, and it May Be Hunting for YOU Next||Jan 12, 2015|
- Designing with Linux
- Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform
- Wondershaper—QOS in a Pinch
- Internet of Things Blows Away CES, and it May Be Hunting for YOU Next
- Ideal Backups with zbackup
- Slow System? iotop Is Your Friend
- New Products
- Hats Off to Mozilla
- Non-Linux FOSS: Animation Made Easy
- diff -u: What's New in Kernel Development
Editorial Advisory Panel
Thank you to our 2014 Editorial Advisors!
- Jeff Parent
- Brad Baillio
- Nick Baronian
- Steve Case
- Chadalavada Kalyana
- Caleb Cullen
- Keir Davis
- Michael Eager
- Nick Faltys
- Dennis Frey
- Philip Jacob
- Jay Kruizenga
- Steve Marquez
- Dave McAllister
- Craig Oda
- Mike Roberts
- Chris Stark
- Patrick Swartz
- David Lynch
- Alicia Gibb
- Thomas Quinlan
- Carson McDonald
- Kristen Shoemaker
- Charnell Luchich
- James Walker
- Victor Gregorio
- Hari Boukis
- Brian Conner
- David Lane