Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (8) </ [1] 2 3 4 5 6 ... >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: HOWTO Remaster DSL From An Existing HD Install, step-by-step procedure< Next Oldest | Next Newest >
noclobber Offline





Group: Members
Posts: 75
Joined: Sep. 2004
Posted: Nov. 07 2004,10:26 QUOTE

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!


--------------
Don't say "No" to Digital Restrictions Management, say "HELL, NO!!!".
Back to top
Profile PM 
Rapidweather Offline





Group: Members
Posts: 375
Joined: Jan. 2004
Posted: Nov. 07 2004,13:22 QUOTE

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


--------------
Rapidweather Remaster of DSL:
http://www.angelfire.com/ms/telegram/getting_started.html
Rapidweather Remaster of Knoppix Linux:
http://www.geocities.com/rapidweather/getting_started.html
Screenshots:
http://www.rapidweather.com/linuxcdsales.html
Back to top
Profile PM WEB 
hasty Offline





Group: Members
Posts: 280
Joined: Oct. 2003
Posted: Nov. 07 2004,17:58 QUOTE

Thanks for your hard work and clear exposition.
Much appreciated.
Back to top
Profile PM 
noclobber Offline





Group: Members
Posts: 75
Joined: Sep. 2004
Posted: Nov. 08 2004,17:36 QUOTE

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?).


--------------
Don't say "No" to Digital Restrictions Management, say "HELL, NO!!!".
Back to top
Profile PM 
Phormix
Unregistered






Posted: Nov. 10 2004,22:36 QUOTE

Note that you've got a bit of a typo on the mkdslcd script.

Try changing line 6 to

if [ "x$volid" = "x" ]; then
Back to top
38 replies since Nov. 07 2004,10:26 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (8) </ [1] 2 3 4 5 6 ... >/
reply to topic new topic new poll
Quick Reply: HOWTO Remaster DSL From An Existing HD Install

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code