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 7 ... >/

[ 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: Mar. 19 2005,04:44 QUOTE

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!


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





Group: Members
Posts: 3
Joined: Mar. 2005
Posted: Mar. 25 2005,00:31 QUOTE

extremely helpful, thanks! :cool:
Back to top
Profile PM 
Marco
Unregistered






Posted: Mar. 25 2005,18:53 QUOTE

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
Back to top
Rapidweather Offline





Group: Members
Posts: 375
Joined: Jan. 2004
Posted: Mar. 26 2005,01:30 QUOTE

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


--------------
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 
noclobber Offline





Group: Members
Posts: 75
Joined: Sep. 2004
Posted: Mar. 27 2005,00:05 QUOTE

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.


--------------
Don't say "No" to Digital Restrictions Management, say "HELL, NO!!!".
Back to top
Profile PM 
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 7 ... >/
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