HOWTO Remaster DSL From An Existing HD Install


Forum: Other Help Topics
Topic: HOWTO Remaster DSL From An Existing HD Install
started by: noclobber

Posted by noclobber on Nov. 07 2004,10:26
HOWTO Remaster DSL From An Existing Hard Drive Installation
version 1.1


INTRODUCTION

Okay, you've downloaded a DSL ISO image, burned it to CD, installed it from there onto your hard drive, and have spent the last two weeks or so installing additional software, customizing it, and tweaking it to your heart's content until you've got it working just the way you like it.  Now, you'd like to remaster your own live CD from your hard drive installation, but, to your dismay, you discover that all the available HOWTOs on remastering either DSL or Knoppix only describe remastering from an original live CD, and their procedures just don't quite seem to work when you attempt to remaster a CD from your hard drive.  Well, my friend, you've come to the right place.

This HOWTO is based rather loosely on both the official Knoppix Remastering HOWTO at
< http://www.knoppix.net/docs/index.php/KnoppixRemasteringHowto >
as well as meo's DSL Remastering HOWTO at
< http://damnsmalllinux.org/cgi-bin....;t=1806 >
with some significant additions.

So far, I have tried this myself only on a hard drive installation of DSL version 0.8.2.  Although I have included special instructions which *should* work for certain steps where earlier DSL versions differ, your mileage may vary.  Please keep in mind that I am *not* a Linux guru -- in fact, this HOWTO is probably about the most I've ever done with anything in Linux so far in my computing experience.  Comments, corrections, suggestions, and tales of your experiences with this HOWTO are welcome.

Have fun and good luck!
noclobber


REQUIREMENTS

You'll need the hard drive installation of DSL from which you wish to remaster your custom live CD (obviously), the original DSL live CD, and a separate ext2 hard drive partition with at least enough free space to hold your newly remastered CD three or four times over, depending on where you write the final ISO image.  You will also need an amount of free RAM + Swap space at least as large as the compressed KNOPPIX image you will be creating, since create_compressed_fs does all its work in memory before dumping the file to disk.

A CD-R or CD-RW disk and burner will be needed as well.  To be safe, you may want to burn your first remaster onto a rewriteable disk before committing to permanent CD.

I also highly recommend using the shell scripts which are provided below for two reasons:  1) You will get awfully tired of having to retype a boatload of mkisofs or sed options every time you remaster a CD, and 2) The scripts will minimize your chances of making typographical errors.


DEFINITIONS

For the purposes of this HOWTO, I shall use "hda7" to refer to the DSL hard drive partition which is being remastered, and "hda8" to refer to the ext2 free space partition.  Please substitute your own partition locations as necessary.  "dsl4me.iso" refers to your remastered CD image, which you can, of course, call whatever you like.


SCRIPTS

Boot your original DSL CD, then mount both hda7 and hda8.  Copy and save the following scripts into files named "findfiles", "mkdslcd", and "mkknoppix", respectively.  Place them all into /mnt/hda8 and give them root ownership and execute permissions.  Their usage will be explained as we proceed.

---------- cut here ----------

#!/bin/bash
# findfiles hd_installation_dir
# Locates files which need write access but do not have it on live CD
# Results are sent to stdout
# Boot from live CD before running this

if ls "$1" >/dev/null 2>&1 ; then
 od=$PWD
 cd $1
 find -newer $od/touchme | sed -n -e '1,$s/^.\//touch -c \//p' | /bin/bash 2>&1 | sed -n -e '1,$s/^touch: //p' | sed -n -e '1,$s/: .*//p' > /dev/stdout
 cd $od
else
 echo "Usage: findfiles hd_installation_dir"
 echo ""
 echo "Locates files which need write access but do not have it on live CD"
 echo "Results are sent to stdout"
 echo "Boot from live CD before running this"
fi

---------- cut here ----------

#!/bin/bash
# mkdslcd src_dir dest_file [vol_id]
# Creates a DSL remastered ISO image file

volid=$3
if $volid="" ; then
 volid="DSL"
fi
if ls "$1" >/dev/null 2>&1 ; then
 if ls "$1"/KNOPPIX/boot.cat >/dev/null 2>&1 ; then
   # We have DSL version 0.7.x or earlier
   mkisofs -r -J -V "$volid" -b KNOPPIX/boot.img -c KNOPPIX/boot.cat -o "$2" "$1"
 elif ls "$1"/boot/isolinux/boot.cat >/dev/null 2>&1 ; then
   # We have DSL version 0.8.x or later
   mkisofs -r -J -l -no-emul-boot -no-pad -boot-load-size 4 -boot-info-table -hide-rr-moved -V "$volid" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o "$2" "$1"
 else
   echo "Unrecognized DSL CD directory structure"
 fi
else
 echo "Usage: mkdslcd src_dir dest_file [vol_id]"
 echo ""
 echo "Creates a DSL remastered ISO image file"
fi

---------- cut here ----------

#!/bin/bash
# mkknoppix src_dir dest_file
# Creates a compressed KNOPPIX image file

if ls "$1" >/dev/null 2>&1 ; then
 mkisofs -R "$1" | create_compressed_fs - 65536 > "$2"
else
 echo "Usage: mkknoppix src_dir dest_file"
 echo ""
 echo "Creates a compressed KNOPPIX image file"
fi

---------- cut here ----------


FREE SPACE PREPARATION

Open emelfm as root, and make sure hidden files are visible in both panes.  In /mnt/hda8, create the subdirectories /cd, /mnt, and /source.  If you are running DSL version 0.7.x or earlier, also create the subdirectory /mnt7.  Mount /cdrom (your original DSL live CD) and copy everything except that big /cdrom/KNOPPIX/KNOPPIX file from /cdrom to /mnt/hda8/cd.  If you are remastering from DSL version 0.8.x or greater, the contents of /mnt/hda8 should now look like this:

/mnt/hda8
 /cd
 | /KNOPPIX
 | /boot
 | | /isolinux
 | |   boot.cat
 | |   boot.msg
 | |   f2
 | |   f3
 | |   german.kbd
 | |   isolinux.bin
 | |   isolinux.cfg
 | |   linux24
 | |   logo.16
 | |   minirt24.gz
 | /lost+found
 | index.html
 /mnt
 /source
 findfiles
 mkdslcd
 mkknoppix


and if you are remastering from DSL version 0.7.x or earlier, the contents of /mnt/hda8 should now look like this:

/mnt/hda8
 /cd
 | /KNOPPIX
 | | boot.cat
 | | boot.img
 | /lost+found
 | index.html
 /mnt
 /mnt7
 /source
 findfiles
 mkdslcd
 mkknoppix


Some additional files may exist, depending on the specific DSL version.


REWRITTEN FILE IDENTIFICATION

{Note:  This section may not, strictly speaking, be necessary.  I originally did this to locate all files needing write access, then edited the snot out of the Knoppix boot scripts to give them that.  Later, I discovered that modifying the directory structure of the DSL hard drive installation so that it more closely matched that of the original live CD (this is covered below) required less Knoppix boot script editing, and was, overall, a cleaner and more effective remastering solution.  Your feedback on this is encouraged.}

While still running DSL from an original live CD with hda8 mounted, as root, execute the following command:

touch /mnt/hda8/touchme


This creates a dummy file with a reference timestamp that we will use to identify which files in your DSL hard drive installation require write access.

Next, reboot DSL from your hard drive installation.  Run every program that you have added to DSL since installing it on the hard drive.  If necessary, connect to your DSL PC from another computer over a network to make sure all DSL server daemons are running properly.  The idea here is to get your DSL hard drive installation to write to any needed log, status, and temporary files so that we can make sure to give all of those files write access when DSL is later run from our remastered live CD.

When all appears well, reboot DSL again from the original live CD.  As root, mount both hda7 and hda8, then go to /mnt/hda8 and enter the command:

findfiles /mnt/hda7 > needwr


The file you have just created, /mnt/hda8/needwr, is a list of all files in your DSL hard drive installation which require write access (their timestamps are newer than that of /mnt/hda8/touchme) and either do not have that on the original DSL live CD, or their directories do not even exist on the original DSL CD.


DSL HARD DRIVE INSTALLATION PREPARATION

Now comes the messy part:  Cleaning up the copy of your DSL hard drive installation so that your remaster turns out as neat as possible.  First of all, depending on your intended use for your remastered CD, you may or may not want to remove any "proprietary" information from /mnt/hda8/source.  This includes things like web browser caches, cookies, and typed and visited histories; emails, email account, and login info; ppp phone numbers, login usernames, and passwords; any other passwords, such as for samba server or vnc server, as well as configuration files; any text files containing personal info; maybe even things like ethernet IP addresses and /etc/hosts computer names, if they are specific to your own network.  Deleting your .bash_history is also a good thing to do, especially if it contains any "sudo" commands.  You get the idea.  Some of these items are most easily cleaned up by booting your DSL hard drive installation and running the appropriate apps or configuration utilities.  In other cases, it may be easiest to simply delete files from /mnt/hda8/source as shown below.

Boot DSL from the original live CD, mount hda7 and hda8, and open emelfm as root.

Copy *everything* from /mnt/hda7 to /mnt/hda8/source.  You can then unmount hda7.

Delete all the files in the /mnt/hda8/source/tmp directory except for any *.uci compressed CD images which you use.

Whenever you empty out a directory, it's probably a good idea to put back into that directory whatever was in it on the original DSL CD, just to be safe.  A peek inside /KNOPPIX/tmp reveals a few files and directories, so I'd recommend copying those over to /mnt/hda8/source/tmp.

It soon became obvious to me why the creators of DSL omitted the Debian dpkg database from DSL.  It can be huge, and the apt extensions are being constantly updated on the Internet anyway, so we shall dispose of it.

Delete the /mnt/hda8/source/var/cache/apt directory.  Then copy the /KNOPPIX/var/cache/apt directory (this is from the original DSL live CD) to /mnt/hda8/source/var/cache/apt.

Likewise, delete the /mnt/hda8/source/var/lib/apt directory, then copy the /KNOPPIX/var/lib/apt directory to /mnt/hda8/source/var/lib/apt.

Delete the /mnt/hda8/source/var/lib/dpkg directory.  This concludes (almost) the removal of the dpkg database.

Next, delete the files, but not any subdirectories, in /mnt/hda8/source/var/run.

Delete the /mnt/hda8/source/var/locks directory.

Delete the files, but not any subdirectories, in /mnt/hda8/source/etc/sysconfig.

Delete all files except those named System.map* from /mnt/hda8/source/boot.

Delete the /mnt/hda8/source/lost+found directory.

Delete the symbolic link /mnt/hda8/source/linux24 (This may be different for other Linux kernel or DSL versions).

Delete the /mnt/hda8/source/mnt directory, then copy the /KNOPPIX/mnt directory to /mnt/hda8/source/mnt.

If the /mnt/hda8/source/home/dsl/mnt directory exists, delete everything inside it.

When booting DSL from live CD, the user settings in /home/dsl are actually copied over from /etc/skel, so we need to make the following adjustments:

Delete the file /mnt/hda8/source/home/dsl/dsl-dpkg.dsl (This is the last piece of the dpkg database).

Delete the directory /mnt/hda8/source/home/dsl/boot.

Delete the entire contents of the /mnt/hda8/source/etc/skel directory, then move everything that remains in the /mnt/hda8/source/home/dsl directory into /mnt/hda8/source/etc/skel.


DSL-KNOPPIX BOOT FILE MODIFICATION

If you are running DSL version 0.7.x or earlier, as root, go to /mnt/hda8/cd/KNOPPIX and enter the command:

mount boot.img /mnt/hda8/mnt7 -o loop


then go to /mnt/hda8/mnt7 and enter the commands:

gunzip miniroot.gz
mount miniroot /mnt/hda8/mnt -o loop


If you are running DSL version 0.8.x or later, as root, go to /mnt/hda8/cd/boot/isolinux and enter the commands:

gunzip minirt24.gz
mount minirt24 /mnt/hda8/mnt -o loop


For all DSL versions, go to /mnt/hda8/mnt and open the file linuxrc with scite.

Next, do a search for the string "Creating directories", followed by a search for the string "Done".  You should now be looking at a section of code that looks somewhat like the following:

# Extremely important, init crashes on shutdown if this is only a link
:> /etc/ioctl.save
:> /etc/pnm2ppa.conf
# Must exist for samba to work
[ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
# Diet libc bug workaround
cp -f /KNOPPIX/etc/localtime /etc/localtime
echo "${BLUE}Done.${NORMAL}"


To ensure write access for all necessary files on your remastered live CD, insert these lines immediately before the echo Done line:

# Added by [your_name_here] for remastering from HD installation
rm -f /var/cache/apt
cp -Rp /KNOPPIX/var/cache/apt /var/cache
rm -f /var/lib/apt
cp -Rp /KNOPPIX/var/lib/apt /var/lib


so the section of code in question now looks like this:

# Extremely important, init crashes on shutdown if this is only a link
:> /etc/ioctl.save
:> /etc/pnm2ppa.conf
# Must exist for samba to work
[ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
# Diet libc bug workaround
cp -f /KNOPPIX/etc/localtime /etc/localtime
# Added by noclobber for remastering from HD installation
rm -f /var/cache/apt
cp -Rp /KNOPPIX/var/cache/apt /var/cache
rm -f /var/lib/apt
cp -Rp /KNOPPIX/var/lib/apt /var/lib
echo "${BLUE}Done.${NORMAL}"


Save the file and close scite.  Then execute the command:

umount /mnt/hda8/mnt


If you are running DSL version 0.7.x or earlier, execute the command:

gzip /mnt/hda8/mnt7/miniroot


For DSL version 0.8.x or later, execute the command:

gzip /mnt/hda8/cd/boot/isolinux/minirt24


This would be a good place to tackle some of DSL's bootup annoyances.
If you are working with DSL version 0.7.x or earlier, open the file /mnt/hda8/mnt7/syslinux.cfg with scite.
For DSL version 0.8.x or later, open the file /mnt/hda8/cd/boot/isolinux/isolinux.cfg with scite.

Lilo is not used when booting DSL from live CD, but many lilo boot options also work in this file.  In the default APPEND line, I prefer "vga=normal" instead of "vga=791".  I also add the option "nodhcp" to the APPEND line to help avoid problems with initializing my eth0 interface, since I use static IP addresses on my local network.  In addition, I like to shorten the bootup message prompt timeout from 30 seconds (the "TIMEOUT 300" line) to more like 5-10 seconds.  Edit this as you wish, then save the file and close scite.

If you are running DSL version 0.7.x or earlier, execute the command:

umount /mnt/hda8/mnt7


LIVE CD IMAGE CREATION

Now, either in emelfm or from a root access terminal, go to /mnt/hda8 and enter the command:

mkknoppix /mnt/hda8/source /mnt/hda8/cd/KNOPPIX/KNOPPIX


When this finishes, enter this command, where vol_id is an optional volume label for your remastered CD:

mkdslcd /mnt/hda8/cd /mnt/hda8/dsl4me.iso [vol_id]


dsl4me.iso is your DSL remaster image, and its exact location is not critical.  If space on hda8 is limited or you wish to burn the image from Windows, you can mount a FAT partition and place dsl4me.iso there.


TESTING

Burn and boot your remastered CD.  No error messages should appear during bootup, your desktop should appear as it did when DSL was run from your hard drive, and all your apps should run well without errors (apt can be reenabled from the fluxbox menu).

That's it!

Posted by Rapidweather on Nov. 07 2004,13:22
What you ought to do is put this howto up on a website. I do that a lot myself.
Mostly, I use angelfire.com. That way, if any changes are needed, then you can make them.
Then, use the url for the howto in your signature on this forum.
The howto will live on, and not scroll down in the forum and vanish over time.
Very nice and thorough work. Those of us who do this sort of thing need to
keep the orginal distro in mind, and if we come up with something that might be
needed, as a change in the original DSL, then we need to bring it to light.
---
Occasionally, they will take our discovery, and put it in the distro, to the
benefit of all.
---
:D

Posted by hasty on Nov. 07 2004,17:58
Thanks for your hard work and clear exposition.
Much appreciated.

Posted by noclobber on Nov. 08 2004,17:36
I'd recommend that a number of people first give this a thorough testing before we carve it in stone somewhere.

Hey, has anybody tried this?  I remastered my DSL HD installation to a CD-RW, booted it up (everything runs great on the live CD, BTW), and tried a single-user HD install from that.  The new HD install boots up fine until it tries to start X, at which point it kicks me back out to a "root@tty1" prompt with this error message:

bash: [: unknown: integer expression expected

I'm guessing that a script somewhere is seeing a left square beacket where it expected a number.  Anyway, if I then login to "box" as user "dsl", the X desktop comes up normally, and everything works fine.

Perhaps some further modifications need to be made to what is written to a remastered CD to straighten this out (feedback, anyone?).

Posted by Phormix on Nov. 10 2004,22:36
Note that you've got a bit of a typo on the mkdslcd script.

Try changing line 6 to

if [ "x$volid" = "x" ]; then

Posted by noclobber on Mar. 19 2005,04:44
Debugged, cleaned up, and streamlined somewhat.  Enjoy!


HOWTO Remaster DSL From An Existing Hard Drive Installation
version 1.2


INTRODUCTION

Okay, you've downloaded a DSL ISO image, burned it to CD, installed it from there onto your hard drive, and have spent the last two weeks or so installing additional software, customizing it, and tweaking it to your heart's content until you've got it working just the way you like it.  Now, you'd like to remaster your own live CD from your hard drive installation, but, to your dismay, you discover that all the available HOWTOs on remastering either DSL or Knoppix only describe remastering from an original live CD, and their procedures just don't quite seem to work when you attempt to remaster a CD from your hard drive.  Well, my friend, you've come to the right place.

This HOWTO is based rather loosely on both the official Knoppix Remastering HOWTO at
< http://www.knoppix.net/docs/index.php/KnoppixRemasteringHowto >
as well as meo's DSL Remastering HOWTO at
< http://damnsmalllinux.org/cgi-bin....;t=1806 >
with some significant additions.

So far, I have tried this myself only on a hard drive installation of DSL version 0.8.2.  Although I have included special instructions which *should* work for certain steps where earlier DSL versions differ, your mileage may vary.  Please keep in mind that I am *not* a Linux guru -- in fact, this HOWTO is probably about the most I've ever done with anything in Linux so far in my computing experience.  Comments, corrections, suggestions, and tales of your experiences with this HOWTO are welcome.

Have fun and good luck!
noclobber


REQUIREMENTS

You'll need the hard drive installation of DSL from which you wish to remaster your custom live CD (obviously), the original DSL live CD, and a separate ext2 hard drive partition with at least enough free space to hold your newly remastered CD three or four times over, depending on where you write the final ISO image.  You will also need an amount of free RAM + Swap space at least as large as the compressed KNOPPIX image you will be creating, since create_compressed_fs does all its work in memory before dumping the file to disk.

A CD-R or CD-RW disk and burner will be needed as well.  To be safe, you may want to burn your first remaster onto a rewriteable disk before committing to permanent CD.

I also highly recommend using the shell scripts which are provided below for two reasons:  1) You will get awfully tired of having to retype a boatload of mkisofs or sed options every time you remaster a CD, and 2) The scripts will minimize your chances of making typographical errors.


DEFINITIONS

For the purposes of this HOWTO, I shall use "hda7" to refer to the DSL hard drive partition which is being remastered, and "hda8" to refer to the ext2 free space partition.  Please substitute your own partition locations as necessary.  "dsl4me.iso" refers to your remastered CD image, which you can, of course, call whatever you like.


SCRIPTS

Boot your original DSL CD, then mount both hda7 and hda8.  Copy and save the following scripts into files named "findfiles", "mkdslcd", and "mkknoppix", respectively.  Place them all into /mnt/hda8 and give them root ownership and execute permissions.  Their usage will be explained as we proceed.

---------- cut here ----------

#!/bin/bash
# findfiles hd_installation_dir
# Locates files which need write access but do not have it on live CD
# Results are sent to stdout
# Boot from live CD before running this

if ls "$1" >/dev/null 2>&1 ; then
 od=$PWD
 cd $1
 find -newer $od/touchme | sed -n -e '1,$s/^.\//touch -c \//p' | /bin/bash 2>&1 | sed -n -e '1,$s/^touch: //p' | sed -n -e '1,$s/: .*//p' > /dev/stdout
 cd $od
else
 echo "Usage: findfiles hd_installation_dir"
 echo ""
 echo "Locates files which need write access but do not have it on live CD"
 echo "Results are sent to stdout"
 echo "Boot from live CD before running this"
fi

---------- cut here ----------

#!/bin/bash
# mkdslcd src_dir dest_file [vol_id]
# Creates a DSL remastered ISO image file

volid="$3"
if test -z $volid ; then
 volid="DSL"
fi
if ls "$1" >/dev/null 2>&1 ; then
 if ls "$1"/KNOPPIX/boot.cat >/dev/null 2>&1 ; then
   # We have DSL version 0.7.x or earlier
   mkisofs -r -J -V "$volid" -b KNOPPIX/boot.img -c KNOPPIX/boot.cat -o "$2" "$1"
 elif ls "$1"/boot/isolinux/boot.cat >/dev/null 2>&1 ; then
   # We have DSL version 0.8.x or later
   mkisofs -r -J -l -no-emul-boot -no-pad -boot-load-size 4 -boot-info-table -hide-rr-moved -V "$volid" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o "$2" "$1"
 else
   echo "Unrecognized DSL CD directory structure"
 fi
else
 echo "Usage: mkdslcd src_dir dest_file [vol_id]"
 echo ""
 echo "Creates a DSL remastered ISO image file"
fi

---------- cut here ----------

#!/bin/bash
# mkknoppix src_dir dest_file
# Creates a compressed KNOPPIX image file

if ls "$1" >/dev/null 2>&1 ; then
 mkisofs -R "$1" | create_compressed_fs - 65536 > "$2"
else
 echo "Usage: mkknoppix src_dir dest_file"
 echo ""
 echo "Creates a compressed KNOPPIX image file"
fi

---------- cut here ----------


FREE SPACE PREPARATION

Open emelfm as root, and make sure hidden files are visible in both panes.  In /mnt/hda8, create the subdirectories /cd, /mnt, and /source.  If you are running DSL version 0.7.x or earlier, also create the subdirectory /mnt7.  Mount /cdrom (your original DSL live CD) and copy everything except that big /cdrom/KNOPPIX/KNOPPIX file from /cdrom to /mnt/hda8/cd.  If you are remastering from DSL version 0.8.x or greater, the contents of /mnt/hda8 should now look like this:

/mnt/hda8
 /cd
 | /KNOPPIX
 | /boot
 | | /isolinux
 | |   boot.cat
 | |   boot.msg
 | |   f2
 | |   f3
 | |   german.kbd
 | |   isolinux.bin
 | |   isolinux.cfg
 | |   linux24
 | |   logo.16
 | |   minirt24.gz
 | /lost+found
 | index.html
 /mnt
 /source
 findfiles
 mkdslcd
 mkknoppix


and if you are remastering from DSL version 0.7.x or earlier, the contents of /mnt/hda8 should now look like this:

/mnt/hda8
 /cd
 | /KNOPPIX
 | | boot.cat
 | | boot.img
 | /lost+found
 | index.html
 /mnt
 /mnt7
 /source
 findfiles
 mkdslcd
 mkknoppix


Some additional files may exist, depending on the specific DSL version.


REWRITTEN FILE IDENTIFICATION

{Note:  This section may not, strictly speaking, be necessary.  I originally did this to locate all files needing write access, then edited the snot out of the Knoppix boot scripts to give them that.  Later, I discovered that modifying the directory structure of the DSL hard drive installation so that it more closely matched that of the original live CD (this is covered below) required less Knoppix boot script editing, and was, overall, a cleaner and more effective remastering solution.  Your feedback on this is encouraged.}

While still running DSL from an original live CD with hda8 mounted, as root, execute the following command:

touch /mnt/hda8/touchme


This creates a dummy file with a reference timestamp that we will use to identify which files in your DSL hard drive installation require write access.

Next, reboot DSL from your hard drive installation.  Run every program that you have added to DSL since installing it on the hard drive.  If necessary, connect to your DSL PC from another computer over a network to make sure all DSL server daemons are running properly.  The idea here is to get your DSL hard drive installation to write to any needed log, status, and temporary files so that we can make sure to give all of those files write access when DSL is later run from our remastered live CD.

When all appears well, reboot DSL again from the original live CD.  As root, mount both hda7 and hda8, then go to /mnt/hda8 and enter the command:

findfiles /mnt/hda7 > needwr


The file you have just created, /mnt/hda8/needwr, is a list of all files in your DSL hard drive installation which require write access (their timestamps are newer than that of /mnt/hda8/touchme) and either do not have that on the original DSL live CD, or their directories do not even exist on the original DSL CD.


DSL HARD DRIVE INSTALLATION PREPARATION

Now comes the messy part:  Cleaning up the copy of your DSL hard drive installation so that your remaster turns out as neat as possible.  First of all, depending on your intended use for your remastered CD, you may or may not want to remove any "proprietary" information from /mnt/hda8/source.  This includes things like web browser caches, cookies, and typed and visited histories; emails, email account, and login info; ppp phone numbers, login usernames, and passwords; any other passwords, such as for samba server or vnc server, as well as configuration files; any text files containing personal info; maybe even things like ethernet IP addresses and /etc/hosts computer names, if they are specific to your own network.  Deleting your .bash_history is also a good thing to do, especially if it contains any "sudo" commands.  You get the idea.  Some of these items are most easily cleaned up by booting your DSL hard drive installation and running the appropriate apps or configuration utilities.  In other cases, it may be easiest to simply delete files from /mnt/hda8/source as shown below.

Boot DSL from the original live CD, mount hda7 and hda8, open a root terminal, and also open emelfm as root.

First, let's copy *everything* from /mnt/hda7 to /mnt/hda8/source while preserving file ownership and permissions as follows:  From the root terminal, issue the command cp -Rp /mnt/hda7 /mnt/hda8, then in emelfm, rename /mnt/hda8/hda7 to /mnt/hda8/source.  You can then unmount hda7.
Note:  Copying in emelfm as root gives everything copied root ownership, which is *not* what we want here.

Delete all the files in the /mnt/hda8/source/tmp directory except for any *.uci compressed CD images which you use.

Whenever you empty out a directory, it's probably a good idea to put back into that directory whatever was in it on the original DSL CD, just to be safe.  A peek inside /KNOPPIX/tmp reveals a few files and directories, so I'd recommend copying those over to /mnt/hda8/source/tmp.
You could also use a symbolic link for tmp which points to var/tmp as in /KNOPPIX and put the tmp files in var/tmp.

It soon became obvious to me why the creators of DSL omitted the Debian dpkg database from DSL.  It can be huge, and the apt extensions are being constantly updated on the Internet anyway, so we shall dispose of it.

Delete the /mnt/hda8/source/var/cache/apt directory.  Then copy the /KNOPPIX/var/cache/apt directory (this is from the original DSL live CD) to /mnt/hda8/source/var/cache/apt.

Likewise, delete the /mnt/hda8/source/var/lib/apt directory, then copy the /KNOPPIX/var/lib/apt directory to /mnt/hda8/source/var/lib/apt.

Delete the /mnt/hda8/source/var/lib/dpkg directory.  This concludes (almost) the removal of the dpkg database.

Next, delete the files, but not any subdirectories, in /mnt/hda8/source/var/run.
Alternatively, you could copy the subdirectories from /KNOPPIX/var/run.

Delete the /mnt/hda8/source/var/locks directory.

Delete the files, but not any subdirectories, in /mnt/hda8/source/etc/sysconfig.

Delete all files except those named System.map* from /mnt/hda8/source/boot.

Delete the /mnt/hda8/source/lost+found directory.

Delete the symbolic link /mnt/hda8/source/linux24 (This may be different for other Linux kernel or DSL versions).

Delete the /mnt/hda8/source/mnt directory, then copy the /KNOPPIX/mnt directory to /mnt/hda8/source/mnt.

If the /mnt/hda8/source/home/dsl/mnt directory exists, delete everything inside it.

When booting DSL from live CD, the user settings in /home/dsl are actually copied over from /etc/skel, so we need to make the following adjustments:

Delete the file /mnt/hda8/source/home/dsl/dsl-dpkg.dsl (This is the last piece of the dpkg database).

Delete the file /mnt/hda8/source/home/dsl/ndiswrapper.readme.

Delete the directory /mnt/hda8/source/home/dsl/boot.

Delete the /mnt/hda8/source/etc/skel directory, then from the root terminal, enter these two commands:
mv /mnt/hda8/source/home/dsl /mnt/hda8/source/etc/skel
cp -Rp /KNOPPIX/home /mnt/hda8/source


DSL-KNOPPIX BOOT FILE MODIFICATION

If you are running DSL version 0.7.x or earlier, as root, go to /mnt/hda8/cd/KNOPPIX and enter the command:

mount boot.img /mnt/hda8/mnt7 -o loop


then go to /mnt/hda8/mnt7 and enter the commands:

gunzip miniroot.gz
mount miniroot /mnt/hda8/mnt -o loop


If you are running DSL version 0.8.x or later, as root, go to /mnt/hda8/cd/boot/isolinux and enter the commands:

gunzip minirt24.gz
mount minirt24 /mnt/hda8/mnt -o loop


For all DSL versions, go to /mnt/hda8/mnt and open the file linuxrc with scite.

Next, do a search for the string "Creating directories", followed by a search for the string "Done".  You should now be looking at a section of code that looks somewhat like the following:

# Extremely important, init crashes on shutdown if this is only a link
:> /etc/ioctl.save
:> /etc/pnm2ppa.conf
# Must exist for samba to work
[ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
# Diet libc bug workaround
cp -f /KNOPPIX/etc/localtime /etc/localtime
echo "${BLUE}Done.${NORMAL}"


To ensure write access for all necessary files on your remastered live CD, insert these lines immediately before the echo Done line:

# Added by [your_name_here] for remastering from HD installation
rm -f /var/cache/apt
cp -Rp /KNOPPIX/var/cache/apt /var/cache
rm -f /var/lib/apt
cp -Rp /KNOPPIX/var/lib/apt /var/lib


so the section of code in question now looks like this:

# Extremely important, init crashes on shutdown if this is only a link
:> /etc/ioctl.save
:> /etc/pnm2ppa.conf
# Must exist for samba to work
[ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
# Diet libc bug workaround
cp -f /KNOPPIX/etc/localtime /etc/localtime
# Added by noclobber for remastering from HD installation
rm -f /var/cache/apt
cp -Rp /KNOPPIX/var/cache/apt /var/cache
rm -f /var/lib/apt
cp -Rp /KNOPPIX/var/lib/apt /var/lib
echo "${BLUE}Done.${NORMAL}"


Save the file and close scite.  Then execute the command:

umount /mnt/hda8/mnt


If you are running DSL version 0.7.x or earlier, execute the command:

gzip /mnt/hda8/mnt7/miniroot


For DSL version 0.8.x or later, execute the command:

gzip /mnt/hda8/cd/boot/isolinux/minirt24


This would be a good place to tackle some of DSL's bootup annoyances.
If you are working with DSL version 0.7.x or earlier, open the file /mnt/hda8/mnt7/syslinux.cfg with scite.
For DSL version 0.8.x or later, open the file /mnt/hda8/cd/boot/isolinux/isolinux.cfg with scite.

Lilo is not used when booting DSL from live CD, but many lilo boot options also work in this file.  In the default APPEND line, I prefer "vga=normal" instead of "vga=791".  I also add the option "nodhcp" to the APPEND line to help avoid problems with initializing my eth0 interface, since I use static IP addresses on my local network.  In addition, I like to shorten the bootup message prompt timeout from 30 seconds (the "TIMEOUT 300" line) to more like 5-10 seconds.  Edit this as you wish, then save the file and close scite.

If you are running DSL version 0.7.x or earlier, execute the command:

umount /mnt/hda8/mnt7


LIVE CD IMAGE CREATION

Now, either in emelfm or from a root access terminal, go to /mnt/hda8 and enter the command:

mkknoppix /mnt/hda8/source /mnt/hda8/cd/KNOPPIX/KNOPPIX


When this finishes, enter this command, where vol_id is an optional volume label for your remastered CD:

mkdslcd /mnt/hda8/cd /mnt/hda8/dsl4me.iso [vol_id]


dsl4me.iso is your DSL remaster image, and its exact location is not critical.  If space on hda8 is limited or you wish to burn the image from Windows, you can mount a FAT partition and place dsl4me.iso there.


TESTING

Burn and boot your remastered CD.  No error messages should appear during bootup, your desktop should appear as it did when DSL was run from your hard drive, and all your apps should run well without errors (apt can be reenabled from the fluxbox menu).

That's it!

Posted by powerglove on Mar. 25 2005,00:31
extremely helpful, thanks! :cool:
Posted by Marco on Mar. 25 2005,18:53
Hi !
Thanx for your good work!

1.I doest undestand where and when you use the file needwr!

2.for make the CD i used


 mkisofs -r -J -l -no-emul-boot -no-pad -boot-load-size 4
-boot-info-table -hide-rr-moved -V DSL -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o "$2" "$1"

where $2 and $1 are from your scipt !


3.find /mnt/hda7 -atime -1 > \mnt\hda8\needwr  

for create the needwr (whit the first script the file is empty for me)

The fiirst try doest go to X11 mode .. but now I have correct neewr and I wait to undestand where I can use It !

thanx

Posted by Rapidweather on Mar. 26 2005,01:30
Very good work. I did not see anything about the logo.16 file. As many of you know, the original Knoppix has pale white boot: prompt generated by logo.16, and this is hard to see, and enter complex knoppix cheatcodes on, especially on laptop screens. I have remastered both DSL 6.2, and Knoppix 3.4, and have a bright yellow boot: prompt, and that looks good against the black background.
I have some screenshots of my Knoppix remaster here:
< http://www.rapidweather.com/linuxcdsales.html >
These screenshots, however do not show the cursor themes (4) that I have available in the remaster. I did not like the small cursor in Knoppix 3.4, almost impossible to see on a laptop, so all of my themes, from kde-look.org, are big cursors, real easy to work with. One of the screenshots shows emelfm open to the cursors directories, with the many scripts necessary to install each one when the system is running. My default window manager is icewm, but I also have fluxbox, like DSL, but with my own Rapidweather style file. Several screenshots of the fluxbox menu, taken apart. Also included in the remaster is a file "remaster_command" which provides the command lines necessary for each build, and makes it easy on me to do the remaster .iso once the various changes and additions to the master is made, and I am ready to go to press. Knoppix allows the cheatcode "bootfrom" which allows one to run off the .iso, prior to making a cd, as a test to see if everything works. I save cd's that way.
  :D

Posted by noclobber on Mar. 27 2005,00:05
You're welcome, powerglove.

Quote (Guest @ Mar. 25 2005,13:53)
I doest undestand where and when you use the file needwr!

Hello Marco,

You're right.  I've failed to explain how the needwr file is used.  Apparently when I said, "Debugged, cleaned up, and streamlined somewhat," the key word in there was "somewhat". :D

After performing a HD install of DSL, I added in *tons* of extra goodies via apt-get, DSL extensions, a couple UCIs, and even some DEBs unavailable thru apt.  Coming from a Windows world where programs often write data into temp dirs, their own dir, the Windows directory tree, the system registry, user profile directories, ad nauseum, I was quite concerned that remastering from my DSL HD installation might render as read-only on the remastered CD some files that required write access.

As it turned out, most of the files that appeared in my needwr file were in the temp directory, which is already copied to ramdisk when booting DSL from LiveCD.  I also discovered that some other files in needwr didn't really *require* write access in order for their particular programs to run properly.  Those programs probably read something from certain files when they start, write something back to those files, but continue to run with whatever info they tried to write back to disk in memory anyway.

The one set of files in needwr for which I absolutely had to allow write access was the one associated with apt.  Although I failed to specifically mention where needwr is actually used, it came into play where the linuxrc file is edited as follows:

To ensure write access for all necessary files on your remastered live CD, insert these lines immediately before the echo Done line:

Quote
# Added by [your_name_here] for remastering from HD installation
rm -f /var/cache/apt
cp -Rp /KNOPPIX/var/cache/apt /var/cache
rm -f /var/lib/apt
cp -Rp /KNOPPIX/var/lib/apt /var/lib

Both the /var/cache/apt and the /var/lib/apt directories needed to be made writeable in order for apt to work.

Apparently Linux - or at least the Debian distro - generally doesn't try to write to places sprinkled willy-nilly throughout your hard drive as does Windows.

Sooooo..... the short answer to all this is that it *may* not be necessary to create the needwr file, however I have an uneasy feeling that some unknown added-on program might require write access in unforseen places, so I was reluctant to remove the needwr stuff from the HowTo prior to getting more feedback from DSL remastering gurus.

Quote (Guest @ Mar. 25 2005,13:53)
for make the CD i used

mkisofs -r -J -l -no-emul-boot -no-pad -boot-load-size 4
-boot-info-table -hide-rr-moved -V DSL -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o "$2" "$1"

where $2 and $1 are from your scipt !

In the mkdslcd script, the $1 and $2 respectively represent the source_directory and destination_file command line parameters that are passed to the script.  If you are entering the mkisofs command manually, substitute your own src_dir and dest_file for the $1 and $2.

Greetings Rapidweather!

I've never tried remastering Knoppix proper or even entering some of the more esoteric Knoppix bootup cheatcodes like < Knoppix Bootup Cheatcodes > when booting DSL, so I can't comment too much on those.

After viewing your ladies - er, screenshots :cool: - it's obvious that you've put some significant efforts into remastering Knoppix.

I *may* have avoided any logo.16 file viewing problems by booting DSL in vga=normal mode - one of my DSL bootup "annoyances" fixes.  IMHO, the "lowest common denominator" plain old 80 x 25 char bootup text works best on any PC.

As per your earlier suggestion, I have web space available where this remastering howto could be posted permanently, but I think it first needs some more cleaning up.  I actually haven't done much more with this myself in the last two months, as I'm reading up on and working up the nerve to try a DSL frugal install on two of my PCs.  One is a P1 desktop with 128MB RAM, but the other is a 486DX laptop with no CD and only 32MB RAM.  Getting all the extra desired goodies into that one may be a challenge.

Posted by Marco on Mar. 27 2005,12:45
HI!
An other question !
In the last remaster version I made the xterm doesn work and I dont know how..

Maybe where I try to use all program in the step of needwr I never used xterm ...

Sombody have an other idea ?

ThanKs !

Posted by noclobber on Mar. 28 2005,21:54
I had nothing from xterm show up in needwr when I remastered, so that shouldn't be the problem.
Posted by Marco on Mar. 31 2005,08:38
For the terminal , I just reinstalled it and now it work.

I have an other problem :

Only whit sudo startx in the cd I can startx, the normal user cant start X server ..

Here is an image of my dls ;-)
< My screenshot >

I add :

ace_ card games

captive

icewm xp theme

freeciv

and I am very over 50 megabyte :-//

Thanks for the help and for make this possible!!

Marco

Posted by noclobber on April 01 2005,19:46
Glad you like the results!

Quote (Marco @ Mar. 31 2005,03:38)
whit sudo startx in the cd I can startx, the normal user cant start X server ..

Make sure that all the files in the /home/dsl directory are owned by and have read permissions for user dsl.

If that's not the problem, a forum search might reveal the cause.

Posted by STL-Drock on April 25 2005,23:20
if ls "$1" >/dev/null 2>&1 ; then
od=$PWD
cd $1
find -newer $od/touchme | sed -n -e '1,$s/^.\//touch -c \//p' | /bin/bash 2>&1 | sed -n -e '1,$s/^touch: //p' | sed -n -e '1,$s/: .*//p' > /dev/stdout[QUOTE]

Could someone help with this scripting.  Perhaps give me a some ideas of what's going on here.  Specifically, what makes this ls command go recursive?  Everytime I try to find files it only looks in the root of my partition (i.e. /mnt/hda1).

Thank,
-derek

Posted by noclobber on April 26 2005,18:16
The ls command only verifies that you passed a valid HD installation directory to the findfiles command.  The recursive search is actually done by the find command.
Posted by ivanh on May 01 2005,11:20
how does one accomplish this cd remastering from an existing hd install with a 1.0.1 version of DSL? the directory structure of the cd looks quite different
Posted by noclobber on May 04 2005,19:29
I have not yet downloaded version 1.x of DSL, so I am unable to comment on that at this time.
Posted by eset on May 06 2005,05:47
BIG thanks to noclobber for this how to on the 1.1!!!

I have followed it closely but I seem to get a problem starting the xserver...it stops at startup (after getting so close...) with the error:
cp: cannot stat 'KNOPPIX/.bash_profile' : No such file or directory

then when i type 'startx' i get:
xauth: creating new authoring file //.Xauthority

and then:
xinit: No such file or directory (errno 2): no program named "//.xinitrc" in PATH

any hints???

Posted by eset on May 06 2005,20:22
hi,

I just followed the very clear and great remastering steps from noclobber again to make sure i was doing everything right...i still get a xinit problem (although i ahve solved my PATH problem....

i get :
xinit: No such file or directory (errno 2) : unable to connect to X server
xinit : No such process (errno 3) : Server error


it seems X isnt starting and I get left with a prompt which i cant sudo on...it replies (to sudo su):

Sorry, sudo must be setuid root.

I'm using DSL 1.1

so close......

Posted by eset on May 06 2005,21:03
ok...sorry, i'm a dummy...i see the version i am using is 1.0.1 and the remastering is tested on 0.8.2...downloading now...still, it seems if the xinit prob can be solved then 1.0.1 remastering cant be too far away...will tinker with it anyway and post any progress
Posted by noclobber on May 06 2005,21:56
Haven't had much time lately to play with DSL, but I am now downloading both the isolinux and syslinux versions of v1.1.

After I get a chance to try out some installs and remastering with both of them, I'll be updating this HowTo.  :blues:

Posted by eset on May 06 2005,23:45
hmmm...actually i double checked the procedure with remastering 0.8.2 and i get them same result with an xinit error....hmmm....
Posted by eset on May 07 2005,01:35
ok...got it...it was a permissions prob w using emelfm...will try 1.0.1 again in the next days
Posted by noclobber on May 07 2005,21:12
Oh yes.  Copying files in emelfm as root gives the copied files root ownership, meaning that user "dsl" can't access them. :angry:

Don't feel so bad.  I learned that one myself the hard way.

Posted by nbla on May 09 2005,14:56
any news with this and dsl 1.0.1?
thanks

/nbla

Posted by nbla on May 16 2005,13:28
Still very interested in this for the 1.0.1 :)

thanks

Posted by Heinrich on May 20 2005,16:22
hi
i ve done the remastering like written above.. but i get this kind of errors:
error message: /etc/sysconfig/progress: Read-only file system
it takes a few minutes .bash_profile gets executed but X doesnt start right.. i can see the X starting in tty 3 but very fast it quits

could someone help? i m using DSL 1.1 on a USB-stick (it worked with the original Damnsmalllinux 1.1)

thx to all
Heinrich

Posted by Heinrich on May 29 2005,20:35
im still waiting, tryied many things.. nothing solved it (mkwriteable and so on..)
i also get some kernel-module errors.. but i dont think it has something to do with that..

pls help

Posted by abattoir on June 27 2005,11:50
I remastered the latest version of dsl with this guide, and everything works fine.
Thanks a lot noclobber :)  Like Rapidweather said, this excellent how-to has slipped into oblivion(almost, it is in page 6 as i type). Please forum admins, please make this a sticky, along with the original remasering guide by meo.

Posted by gjhicks on June 28 2005,02:06
Hi,

Not sure if 'noclobber' is still following this post?

Have used the above fulsome instructions to prepare a new ISO from my HD installation, based on DSL 1.2.1.

Strangely enough, I think that this is the only post on preparation of a new DSL CD from a HD install.  Many thanks to 'noclobber'.

Aside from a couple of changes to the scripts - only changed by reference to the 'mkmydsl' script, not because I actually understand what I am doing!

To the 'mkdslcd' script, in the mkisofs command, added '-v', changed '-no-pad' to '-pad' and changed  '-boot-load-size 4' to '-boot-load-size 32'.

To the 'mkknoppix' script, in the mkisofs command, added '-b' to the 'create_compressed_fs' instruction.

All went well and a nice 'dsl4me.iso' was written.

Booted with the newly written CD and the machine booted fine, except a series of 'read only file' errors went past.  For example, when processing the 'knoppix-autoconfigure' script.

Clearly a problem with what is marked read-only.

Any suggestions gratefully received.

Regards,

Geoff.

Posted by zippy on June 30 2005,08:25
nick work! good boy!!:p :p
Posted by shevegen on July 10 2005,03:44
oh god you guys have minor problems and i have the problem that I have not even the slightest idea what those magical scripts do
i think pure command line would be better, and using
export variables like $DSL_LIVE_CD_MOUNT or $DSL_PARTITION would be helpful too ... anyway i will soon give it a try :D

Posted by gjhicks on July 10 2005,07:53
Actually, I don't really know what the scripts do!  It just a case of trial and error - rather like figuring out what the scripts don't do!

Look forward to your success and report on same!

Posted by clivesay on July 23 2005,05:16
Hi, noclobber.

I just tried this today for fun and it appears to have worked flawlessly. I see no boot time errors and the apps I added run fine. I do alot of remastering the old fashioned way so this was fun to try.

I think once you make a live cd of a HD install you cannot go back and do a HD install again. That is why you were getting errors I believe. Still this makes a great CD or Frugal install.

The only thing I suggest to people is to not make a bunch of coasters. After creating the compressed image, just put it at /mnt/hda8/KNOPPIX/KNOPPIX. Then boot the live CD and enter 'dsl fromhd=/dev/hda8'. That allows you to test the image before creating an iso.

Nice work

Chris

Posted by Syl on Aug. 10 2005,07:45
Hi!
I have to remaster DSL 1.3.1. I have to add some new programs, to set-up the networking and, most of all, I have to add a custom kernel. Is there a howto that I can follow ?

Posted by frankseu on Nov. 28 2005,14:45
Hello,

does one have a updated howto for the 2.0 version ?

regards
Frank

Posted by Gatu on Dec. 10 2005,10:01
Quote (Syl @ Aug. 10 2005,03:45)
Hi!
I have to remaster DSL 1.3.1. I have to add some new programs, to set-up the networking and, most of all, I have to add a custom kernel. Is there a howto that I can follow ?


Hi,

I want to bring up again this question. I basicly need to recompile the kernel for an attempt to get rid of my dma problem. (I need to have cs5530 support as module and not compiled into kernel).

I think that mkmydsl cannot cover this and most other imformation which I found is based on older versions of dsl.

Some idea how to do this in the easiest way? I need to replace the kernel and add one module.... the module is not necesary for booting but for enabling dma-access to the harddisk later.

Br,
Gatu

Posted by netguru1959 on Jan. 05 2006,22:57
When I completed the instructions, I discovered that copying in the emelFM window using the copy button caused the source files to inherit root:root ownership.  The correct procedure is to use cp -Rp <source> <destination> in the command line box at the bottom of the emelFM GUI interface.

Second item:  Once I completed the CD, I discovered that fluxbox came up fine when logging in as dsl but root only got command line.
I solved this by editing the linuxrc file (from the mounted minirt24) creating /root on the ramdrive and linking it. There is an existing line that does this with 2 other directories: search for ramdrive.  In the "Copying directories" section, I then copied root's files from /KNOPPIX/root to  /ramdrive/root
Copying hidden files was a problem when using <path>/.* so I solved it with multiple cp lines <path>/.b* and so on.  I could probably have used a regular expression for dot+<any alphanumeric>*

I also did not get installed apps in my fluxbox menu.  Entries can be added in the user's <user_dir>/.fluxbox/menu file.

Final note, I needed reboot to complete without user intervention.  The reboot script is /etc/init.d/knoppix-reboot and uses 2 variables $NOPROMPT and $NOEJECT both of which I set to "yes"

Any comments would be great.  Maybe I made some mistake when following the instructions above, and feedback may help someone else.  

BTW, I remastered DSL 2.0

Best regards,

NetGuru
(but sadly not yet a Linux Guru).

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.