ARTICLE

Remastering DSL: A Short HOWTO with a Long Preamble
Contributed by Simon Gerber in Desktop on 2006-05-27 04:36:11

This is a short, simple HOWTO explaining how to Remaster Damn Small Linux...

Long Preamble

Acknowledgements: I mastered remastering by following a guide posted on the DSL forums. I recently discovered the guide is also available here. It is, however, very compact, and does not readily show up on Google searches. My purpose in writing this article is to offer additional instructions for those who find a raw list of terminal commands intimidating, to demonstrate why remastering CDs is useful, and to partially explain what those console commands are actually doing. If all you want to know is how to remaster a DSL CD, skip to the last section, or just click on the link above. You don't need to hear me blather on about things that are, for the most part, inconsequential trivialities. On the other hand, maybe you have never encountered DSL before. Or perhaps you have, but are not sure what the benefits of remastering a CD are. Or maybe, just maybe, I'm itching for an excuse to wax lyrical about my new-found pride and joy. But you know, context is important.

And now we begin...

I am studying post-graduate Computer Science. We are expected, encouraged and graded on our ability to understand and work with Unix systems. However, many of the labs run Windows, and although they do provide an X server, it chugs along painfully slow. Those of us who wish to use Linux with any degree of speed and stability are expected to supply our own. So, for a time, I did. I borrowed my girlfriend's laptop and installed Ubuntu and Sun's JDK. That was me set, and for a time, all worked well. But the laptop was due for repairs, and when it was sent away I needed to find some other solution.

I thought about USB flash drives. I doubted the lab PCs would be able to boot from USB. And even if they could, I did not wish to trust my data to a flash drive. I've been burned before. I decided a live CD would be the way to go. I could boot up in the lab, or on my office PC during lunch, and work in my preferred environment. No need for a hard-drive, or even a flash drive. I could work on the RAM disk, then back up to the University's server via SSH.

There are many, many Live CD distributions. But I needed the Sun JDK, and as the licence1 makes redistribution a chore, it seemed I would have to roll my own. For that, I wanted something lightweight. Aside from the JDK, all I needed was GCC, Vim and a simple web-browser. I decided the way to go would be to start with the absolute basics, and add on what I needed. A Debian-based system would also be a bonus. When you're venturing into the unknown, it always helps to start the journey on familiar ground.

With these things in mind, I chose DSL as the basis for my new toy. For those unfamiliar with the Distro, DSL is a severely stripped down version of Debian/Knoppix. The distribution aims to include as many useful applications as possible while remaining under 50MB. It uses a 2.4 series kernel, busybox, a tiny little Xserver, Fluxbox as the default WM, and a host of other microscopic office, media and Internet applications. It is designed to be easily expandable by via a system called 'MyDSL'. MyDSL packages come in several flavours and formats.

By installing the 'dpkg' MyDSL package, you can basically convert DSL into Debian. However, the advantage of DSL packages is that any DSL package in the root directory of the boot CD will be installed at boot time. As of DSL 2.3, you can also place MyDSL packages into an /optional folder on the CD. These will not be installed, but menu entries will be created allowing you to activate them at will. DSL now also contains a script that lets you remaster a CD with your chosen MyDSL extensions. Or you can leave the CD alone and specify at boot time where DSL should look to find your packages. So if the programs and libraries you want are in MyDSL, you're pretty much good to go. DSL does have a package for Sun's JRE. But it does not have one for the JDK. If you, too, wish to include a program on your DSL CD that there is no package for, we're going to need to do an old-fashioned remaster after all.

Short HOWTO:

  1. You will need:

    • A reasonably decent machine. 512MB RAM recommended, less may not work, and obviously a CD burner. OS does not matter, but you will need a Linux-writeable partition. I.e. Ext2/3, FAT32... whatever.

    • A working DSL CD. I used DSL 2.3, but this HOWTO should also work fine with 2.4

    • Patience... and preferably some CD-RWs. You probably won't get it right the first time.

    • Basic Linux knowledge. I'm going to cover remastering, and installed the JDK, but assume if you want to something like change the default background or Firefox bookmarks, that you either know how to or can find out.

  2. Boot off the DSL CD and do whatever you want to it. Add themes, customise your .vimrc, download extensions. You know... have fun. Whatever you want to work, get it working. It's a good idea to take note of where any MyDSL packages you are downloading are ending up. If you use the MyDSL GUI to grab your packages, the default is /tmp. So that's what I'll be using in my examples. Installing the GNU system utilities (to replace Busybox) might be a good idea. . I also included vim, dpkg, the broadcom57xx network drivers (needed on Dell computers among others), a bunch of themes and a few small games.

  3. For Sun's JDK, download the .bin version, not the RPM. Run the .bin file and then copy the extracted folder somewhere. I put it under /usr/java. But whatever works for you. Then either set up symlinks, or add the Java directory to your path. E.g.

    $ echo 'PATH=$PATH:/usr/java/jdk1.5.0_06/bin/' >> ~/.bashrc
    

    Then open a new terminal window and type 'java' and 'javac' to make sure it's working.

  4. From the terminal, mount a local partition. In my case, I had a partition on a second HDD I'd used to play around with Gentoo. DSL will automatically create directories in /mnt and fstab entries for partitions it detects, but does not mount them automatically. So from the terminal, type:

    $ sudo mount /mnt/hdb5
    
    ...where 'hdb5' is whatever partition you are going to use temporary storage.

  5. Hop onto that drive, and create the directories we'll need to remaster the CD. I was using the root partition of a Linux install, so I put these directories in /tmp. Please adapt these instructions to suit your needs:

    $ sudo su
    # cd /mnt/hdb5/tmp
    # mkdir source newcd newcd/KNOPPIX
    

  6. Now we copy the liveCD 'scaffolding' and other needed files into the appropriate directories. You need to have the DSL CD mounted for this step. Keep in mind that the 'newcd' directory we created is going to become the top level directory of the remastered CD, not the root directory of the Linux system you'll see after you boot the CD.

    # cp -Rp /cdrom/boot newcd
    # cp -Rp /cdrom/lost+found newcd
    # cp -Rp /cdrom/index.html newcd
    

    Next step is to copy the actual Linux system into the source directory.

    # cp -Rp /KNOPPIX/* source
    # cp -Rp /KNOPPIX/.bash_profile source
    

  7. Everything under 'source' will be the new '/' when you boot off the remastered CD. At the moment your remastered CD is identical to the old one. So now we have to set up the file system just the way we want. This is the trickiest step, and the one where the most errors will occur. The actual steps involved depend on how you want to customise your CD. Here are the instructions for Sun JDK, and some general guidelines and tips:

    • Many MyDSL packaged programs install themselves in /opt. For example, vim63 and Python. So you can type:

      # cp -Rp /opt/* source/opt/
      
      

      to dump recreate your current /opt/ on your remastered CD. However, you'll also need to make sure there are symlinks in /usr/bin/ pointing to the right places. E.g. For 'vim63'

      # ln -si source/opt/vim63/bin/vim source/usr/bin/ 
      # ln -si source/opt/vim63/bin/vim source/usr/bin/vi 
      

      This will save you some time during the boot process, as DSL will not have to search for and extract the packages at boot-time.

    • MyDSL packages that don't put themselves in completely in /opt/ are probably not self-contained, and will have files all over the place. If you're not sure what it's put where, or how it works, you're probably better off just copying the package to the root directory of the CD, and letting DSL do the hard work for you. For example, you can make sure the broadcom57xx drivers are installed on boot by downloading bcm5700.tar.gz using MyDSL and then:

      # cp /tmp/bcm5700.tar.gz newcd
      

    • If you have a DSL extension that might be useful on some machines, but don't want to waste time installing it on every machine (for example, the game nethack), make an 'optional' directory on your CD and copy the package there.

      # mkdir newcd/optional
      # cp /tmp/nethack.dsl newcd/optional
      

    • Most programs that can be personalised will have their configuration file in your home directory, prefixed by a '.' e.g. .vimrc for Vim. If you're planning to use DSL as a single user system, then it's fine to just copy all those '.' files into source/etc/skel/

      # cp -Rp /home/dsl/.* source/etc/skel/
      

    • For the Java SDK, (assuming you installed it in /usr/java):

      # cp -Rp /usr/java source/usr/
      

      Then make sure your remastered PATH variable will point to the JDK directory. One way to do that would be to edit /etc/skel/.bashrc and add the following lines at the bottom

      JAVA_HOME=/usr/java/jdk1.5.0_06
      PATH=$PATH:/usr/java/jdk1.5.0_06/bin/
      

    • I hope you have CD-RWs, because there's a very good chance you made a mistake somewhere during the previous step. But don't worry, plough on regardless, and you can easily go back and clear up anything you missed later.

  8. Now we need to turn our source directory into a compressed file system

    # mkisofs -R source | create_compressed_fs – 65536 > newcd/KNOPPIX/KNOPPIX
    

  9. Now we create the complete iso file:

    # mkisofs -no-pad -l -r -J -no-emul-boot -boot-load-size 4 – boot-info-table -b
    boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o mydsl.iso
    newcd
    

  10. After that's done, we'll have a 'mydsl.iso' file ready for burning. You might not be able to burn it from MyDSL unless you used the 'dsl toram' boot option, or have a second CD drive. But hopefully you can access whichever partition you created the .iso on from an OS with a good CD-burning program. Just make sure you choose 'burn CD from ISO', or a similarly named function. Otherwise, you'll just end up with the .iso file sitting uselessly on a data CD.

  11. Now try it out! Boot off your newly remastered CD, and see what works, and what doesn't. Take note of what isn't working, what you forgot to do, then go back to step 9 and fix it up. Note that you don't have boot off the original DSL CD at this point. Steps 8 to 10 will work fine off your remastered CD, so long as it actually boots.

And that's Remastering DSL in, as they say, a nutshell. Remastering might become a something of a lost art over the next few years, with the decreasing cost of solid-state storage and PCs that can boot from USB drives. But if you're a little paranoid about running down a flash-drive by running an OS off it, or you're working with slightly older hardware that will not easily boot off a flash-drive, there's nothing like your very own remastered CD, a custom set of applications and tools that you can carry wherever you go.


 
Discussion(s)
dpkg --root
Written by Norman on 2006-05-27 14:08:51
If you ran dpkg with the --root=/mnt/hdb5/tmp/source option then shouldn't it be able to install the .deb's into the newcd automagically?
Discuss! Reply!

nice but why?
Written by Konstantin on 2006-05-29 02:45:36
why you have to remaster DSL, when you can remaster customized PCLinuxOS only by
mklivecd...for me this sounds like inventing the wheel after BMW 7 ;)
Discuss! Reply!

dd
Written by ff on 2006-11-07 15:42:36
Quote:

why you have to remaster DSL, when you can remaster customized PCLinuxOS only by
mklivecd...for me this sounds like inventing the wheel after BMW 7 ;)






poopy woopy kiddy widdy barbera streisand
Discuss! Reply!

Good point
Written by Logan on 2007-05-13 00:26:16
Quote:

why you have to remaster DSL, when you can remaster customized PCLinuxOS only by
mklivecd...for me this sounds like inventing the wheel after BMW 7 ;)





You've got a point. It should be possible to make a good script that automates most of this. There is now a remaster option included with DSL but it fails to include most of the changes I make. Basically I remastered manually by copying the /ramdisk directory over to the hard disk drive. This directory conatins only the changes overlayed on the read only filesystems below it. In this manner you can get a complete copy of everything you added. Minus the underlying read only filesystems. After stripping out some unionfs metadata (certain files containing "WH" "~" and "opaque" tags) from your copied /ramdisk directory, you now have just the filesystem changes you want to apply. Recursively copy this over your "source" directory and your changes are permanently applied.

This is exactly what the SLAX livecd distro does for you in a scripted manner. (Saving you the need for a howto article like this.) But bear in mind DSL is a work in progress and does many things VERY well. This aspect of minutiae will likely be addressed in due time.

Thank you very much for the article Simon! A much needed shortcut.
Discuss! Reply!

why? because ...
Written by Steve on 2006-06-15 15:13:49
I'm being nice and assuming your asking why not use PCLinuxOS is NOT a troll...

PCLinuxOS is a huge distro: DSL is small (50 megabyte .iso) and fits on a credit card / business card size CD ... so remastering it with customizations makes it a perfect carry in your wallet distro for emergency rescues and impressing folks with how small Linux can be and still be useful...

DSL works fine as it is, but since I use it as a rescue disk on a business card size CD-R that I carry with me, I want it to be set up "my way" when I boot, not after 10 minutes of fiddling.

Steve

P.S. Thanks to Simon for the remastering article. Very helpful.
Discuss! Reply!

Why? Because...
Written by chris on 2006-07-27 16:45:51
I'll tell you why. I like how fast and small DSL is. (It's truly amazing) But what I need it for is to use one app (PartImage). I can give this to them on a 4gig USB Thumbdrive and they can use it to make whole backups of their Laptops, or to restore from that image if Windows get Hosed.

Thanks for the tutorial, I'm giving it a shot tomorrow.
Discuss! Reply!

remaster
Written by shiva on 2006-11-07 02:57:05
Quote:

I'll tell you why. I like how fast and small DSL is. (It's truly amazing) But what I need it for is to use one app (PartImage). I can give this to them on a 4gig USB Thumbdrive and they can use it to make whole backups of their Laptops, or to restore from that image if Windows get Hosed.

Thanks for the tutorial, I'm giving it a shot tomorrow.




Discuss! Reply!

my
Written by shiv on 2006-11-29 00:43:13
Quote:

I'll tell you why. I like how fast and small DSL is. (It's truly amazing) But what I need it for is to use one app (PartImage). I can give this to them on a 4gig USB Thumbdrive and they can use it to make whole backups of their Laptops, or to restore from that image if Windows get Hosed.

Thanks for the tutorial, I'm giving it a shot tomorrow.




Discuss! Reply!

Perfect!
Written by Denizz on 2006-08-02 12:54:52













Discuss! Reply!

remastring DSL
Written by kumar on 2006-10-31 06:19:29
Hi!
I installed DSL linux in harddisk,then i installed some application on DSL,So i want to rewrite that harddisk image(modified) to CD.So pls help me about this.

ram
Discuss! Reply!

Written by Darrell Bosch on 2006-12-15 04:51:00
Thanks Simon! Great help to a deeper understanding of DSL. At a more superficial level, however, re-mastering is not necessary to add an application that is not in the myDSL downloads. You can use myconfig.tar.gz.
I recently installed Apache Tomcat (tar -xvvz etc...) to the opt folder and rename it to tomcat-5.5 Then edited .filetool.lst to include only 1 line: opt/tomcat-5.5, then did backup from DSLpanel, rename the resulting backup.tar.gz to tomcat-5.5.tar.gz and moved it to the mydsl/optional.folder. On reboot, tomcat-5.5 shows up in the myDSL menu as an optional install item.

Thanks again Simon
Darrell Bosch
Discuss! Reply!

Don't really get the # cp -Rp /KNOPPIX/
Written by aryz28 on 2007-06-25 22:22:53
People gave good review on this, so I guess it's worrking perfectly.
but I still didn't get it fully the part:
Next step is to copy the actual Linux system into the source directory.

# cp -Rp /KNOPPIX/* source
# cp -Rp /KNOPPIX/.bash_profile source

because there's no /KNOPPIX folder to copy from. Can someone explain about this? Hope to hear from you Simon Gerber or anyone else who hv tried it out.

Your help is very much appreciated.thanks.
Discuss! Reply!

KNOPPIX
Written by jj on 2007-06-25 23:04:06
#
Next step is to copy the actual Linux system into the source directory.

# cp -Rp /KNOPPIX/* source
# cp -Rp /KNOPPIX/.bash_profile source



Actually I dont understand where to get the KNOPPIX file..it seems like it is not in hd but in cdrom.Is it copied from cdrom?
Discuss! Reply!

PHP server
Written by kumar on 2007-08-25 02:19:19
how to install php,apache server in DSL
Discuss! Reply!

crystal reports
Written by kumar on 2007-08-25 02:21:27
like crystal reports is there any one for
sqlite3 database in damn small linux
Discuss! Reply!

Linux Learners
Written by folks on 2007-10-04 01:01:59
Winners never quits Lossers always win
Discuss! Reply!

Don't have to burn CDs (or even wait for
Written by Hans on 2008-01-07 23:43:46
Just set up QEMU (or a free version of VMware), set up a virtual machine that loads GRUB (eg a floppy image) and then use that to boot the vm from any ISO you like.

Much quicker testing cycle, and cheaper too. . .
Discuss! Reply!

this is a good guide
Written by Lorence B. on 2008-02-08 15:35:56
thanks for the good guide.

heres another good guide for remastering debian distributions like a pro
www.cyberpunkcafe.com
Discuss! Reply!

FART
Written by Charlie on 2008-03-10 17:13:22
SheiitdiggityQuote:

thanks for the good guide.

heres another good guide for remastering debian distributions like a pro
www.cyberpunkcafe.com




Discuss! Reply!

mkisofs
Written by Johan Thelin on 2008-04-04 08:40:20
Thanks for a great article. I found one little mishap, the "– boot-info-table" should be "–boot-info-table".
Discuss! Reply!