Difference between revisions of "Knoppix Remastering Howto Italiano"


From Knoppix Documentation Wiki
Jump to: navigation, search
(Editing floppy and CD-ROM use or adding a custom script)
(Replacing page with '{{delete|out of date}}--~~~~')
 
(42 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Questa e una guida che illustra come eseguire il remaster della KNOPPIX. (Note: I comandi appaiono in  una riga, massimalizate il Vs. Browser per una corretta lettura. Se avete commenti/suggerimenti uaset il post sotto.)
+
{{delete|out of date}}--[[User:Werner P. Schulz|Werner P. Schulz]] 10:58, 16 February 2012 (MST)
 
+
Potete intanto cominciare da una versione di Knoppix già su misura, in modo da non dovete fare tan lavoro (vedendo quali programmi rimuovere). In caso affermativo, vedete [[Knoppix Customizations]].
+
 
+
=Sistema Richiesto=
+
*CD-ISO
+
** Almeno 1 GB di RAM+Swap liberi (esempio: 256M RAM, and 750M SWAP Disponibili) (unless you use a different compression program - look in this page for compressloop)
+
** 3 GB di filesystem  '''Linux filesystem (ext2/3, xfs, etc.)''' liberi in una partizione formatata
+
*DVD-ISO
+
** 5 GB RAM + swap libera (per un DVD a dimensione completa)
+
** 15 GB di filesystem '''Linux filesystem (ext2/3, xfs, etc.)''' liberi in una partizione formatata
+
 
+
=Istruzioni=
+
==Settaggio per il Remastering==
+
# Boot di una qualunque ''Knoppix CD''
+
# aprite un terminale e andate in root o aprite un terminale in root shell:
+
#* Menu: Kmenu->Knoppix->Root Shell
+
#* Note: tutti i comandi sotto vanno eseguiti in root shell.
+
# Configurate la vostra connessione Internet (ne avremo bisogno sucessivamente). se usate il DHCP, dovete avere una rete che vi da tale supporto ( router, DHCP server,ecc....).
+
#* Note: Eseguite il comando '''ifconfig''' per una verifica.
+
# Trovate la partizione che volete usare per lavorare. In questo esempio si usa un disco '''hda1''' .  La partizione deve avere un minimo di 3 GB  di spazio libero
+
# Mountare la partizione con il comando:
+
#*<pre>mount -rw /dev/hda1 /mnt/hda1</pre>
+
#* Note: accertatevi che sia in read/write oppure incorrete in errore quando dopo usate la chroot. Per Verificare: eseguite '''mount'''
+
# Create una root directory per lavorare -- Se voi mettere qui i vostri file poi potete cancellarli facilmente
+
#* <pre>mkdir /mnt/hda1/knx</pre>
+
# Se il Vs.PC non ha almeno 1 GB RAM (  '''egrep "(MemTotal|SwapTotal)" /proc/meminfo && echo "(physical+swap)"''' ) Allora avete bisogno di una SWAP creata su un swapfile:
+
<code>cd /mnt/hda1/knx
+
dd if=/dev/zero of=swapfile bs=1M count=750
+
mkswap swapfile
+
swapon swapfile</code>
+
# Costruite 2 directori, uno per il vostro nuovo Master CD, uno per sourgente, nella vostra partizione. Create le directori come sotto con il nome KNOPPIX:
+
#* <pre>mkdir -p /mnt/hda1/knx/master/KNOPPIX</pre>
+
#* <pre>mkdir -p /mnt/hda1/knx/source/KNOPPIX</pre>
+
# Ora, copiate i KNOPPIX del vostro live CD nella directori sorgente :
+
#* <pre><nowiki>cp -Rp /KNOPPIX/* /mnt/hda1/knx/source/KNOPPIX</nowiki></pre>
+
#* Note: Questo richiede un lungo tempo (state copiando circa 2GByte).  ATTENZIONE: sarete tentati di sostituire questo ordine di copia con una procedura molto più veloce: il risultato genera un indice vuoto. Tuttavia, a partire da Knoppix 4.0.2, vi è un bug nei unionfs che rende questa procedura più veloce si ma con perdita di dat. Per ora, copiate il comando ed usatelo cosi come si trova.
+
# In Aggiunta, copiare la cartella di 'boot' dal vostro cdrom - abbiamo bisogno di queste informazioni per creare la ISO image del CDROM verso la fine.
+
#* <pre><nowiki>cp -ar /cdrom/boot /mnt/hda1/knx/master/boot</nowiki></pre>
+
# Per la Knoppix 5.0.1 dovete avere la copia della cartella che contiene i 'modules':
+
#* <pre><nowiki>cp -ar /cdrom/KNOPPIX/modules /mnt/hda1/knx/master/KNOPPIX/.</nowiki></pre>
+
# Copia le main page HTML dello startup:
+
#* <pre><nowiki>cp /cdrom/index.html /mnt/hda1/knx/master/</nowiki></pre>
+
# Copiare tuuto il resto dei file circa ~700 Mb di KNOPPIX file.
+
#* < 3.4:
+
#** <pre><nowiki>cd /cdrom/KNOPPIX && find . -size -10000k -type f -exec cp -p --parents '{}' /mnt/hda1/knx/master/KNOPPIX/ \;</nowiki></pre>
+
#* >= 3.4:
+
#** <pre><nowiki>cd /cdrom && find . -size -10000k -type f -exec cp -p --parents '{}' /mnt/hda1/knx/master/ \;</nowiki></pre>
+
#* Per la versione in DVD usete -size -15000k e copiate la cartella KNOPPIX2 come sotto qui:
+
#** <pre>cp /KNOPPIX2 /mnt/hda1/knx/source/KNOPPIX</pre>
+
# Preparate gli environment di ambiente per attivare il chroot
+
#* <pre>mount --bind /dev /mnt/hda1/knx/source/KNOPPIX/dev</pre>
+
#* <pre>mount --bind /proc /mnt/hda1/knx/source/KNOPPIX/proc</pre>
+
# Ora potete entare in "chroot" nella copia di KNOPPIX:
+
#* <pre><nowiki>chroot /mnt/hda1/knx/source/KNOPPIX</nowiki></pre>
+
# Se vedete errori dei  <tt>/dev/null</tt>, datte uno sguardo alla guida [[#Common Problems|common problems]] nella apposita sezione
+
Ora siete in chroot . "/" che si trova in "/mnt/hda1/knx/source/KNOPPIX"
+
 
+
==Lavorare in Chroot Environment==
+
Ricodate che qualunque cosa voi facciate o modficate in chroot viene concretizzato nel CD. Se fate cambiamenti fatevi una nota che vi aiuta a capire quale variazioni avete apportato ( configurazione, desktop, file di sistema, script, eccc...) prima della masterizzazione.
+
===Accesso a Internet===
+
To use the Internet you need to edit <tt>/etc/resolv.conf</tt> to add your nameserver or exit the chroot and copy the outer <tt>resolv.conf</tt> into the chroot folder:
+
cp /etc/dhcpc/resolv.conf /mnt/hda1/knx/source/KNOPPIX/etc/dhcpc/resolv.conf
+
(proxies (a.k.a. doing it at work): you can type "export http_proxy=http://your.proxy.com:<port>")<BR>
+
To check your chrooted internet connection,
+
ping google.com
+
(if ICMP is barred at some corporate firewall or something then try "lynx http://www.google.com" and see if you get the page -after a cookie "allow")
+
 
+
===Accesso SMB (Samba o Domini Windows)===
+
Also change smb.conf to your MS group if you want smbd support (MSHOME is XP Home ed. usually, and WORKGROUP is 9x Windows)
+
===Accesso APT ( repositor di aggiornamento e upload pachage)===
+
Update your package list with '''apt-get update'''.
+
<blockquote>Note: If ''''apt-get update''' fails with "FATAL -> Could not set non-blocking flag Bad file descriptor", you need to make sure your chrooted environment is mounted without the "nodev" option. (see above where it talks about the /dev/null errors when entering the chroot environment for the first time)</blockquote>
+
<blockquote>'''Warning''': apt-get upgrade is a ''BAD IDEA''. It will, quite probably, render your KNOPPIX remaster unbootable, or broken in some way. A far safer method is to only upgrade packages as necessary.</blockquote>
+
 
+
'''Note: If apt-get fails with "Dynamic NMap ran out of room" ''' you might try this little gem, which fixed the problem for me:
+
#echo 'APT::Cache-Limit "25168524";'>> /etc/apt/apt.conf
+
(I did this while chrooted as described above.)
+
 
+
Before you can add stuff, you will probably need to remove some packages.  To get a list of packages installed, type this:
+
dpkg-query -l
+
If you are looking for big installed packages then the command
+
dpkg-awk "Status: .* installed$" -- Package Installed-Size | \
+
  awk '{print $2}' | egrep -v '^$' | xargs -n2 echo | \
+
  perl -pe 's/(\S+)\s(\S+)/$2 $1/' | sort -rg
+
will list the  packages  with size in descending order.
+
 
+
At least ten times faster is the command
+
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n
+
and you don't need dpkg-awk or awk or perl; however it does not exclude packages that are not installed.  If you have trouble with the above sort command, try using KPackage, expanded all the trees and sorted by the size column to find big packages.
+
 
+
Or, you could use this command to get the qpkg-query speed with the non-installed packages not listed:
+
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | grep -v deinstall | sort -n | awk '{print $1" "$2}'
+
It does the same thing as above, I assume.  I couldn't get the first one to work because I don't have dpkg-awk.
+
 
+
To remove a package (and all packages dependant on it), type this:
+
apt-get remove --purge ''name-of-package-to-remove''
+
To check for orphaned packages, type this:
+
deborphan
+
Want to save more space by getting rid of those pesky orphans (how cruel!), type this ('''Warning''', you won't be prompted yes/no to remove these packages.  When you press Enter after this command, those packages ''will be gone''):
+
deborphan | xargs apt-get -y remove
+
If you're uncertain about the previous command and want to see what will happen without making any changes, just add the '''-s''' option to the apt-get command like this (you can do this with all of the apt-get commands, and it's a good habit to use this option before mass operations like this one):
+
deborphan | xargs apt-get -s -y remove
+
Now the good stuff.  If you wish to add a package, type this:
+
apt-get install '''name-of-package-to-install''
+
What, don't know what packages to install?  Type this.  When the list appears, you can peruse (over 13k lines!) or search for things using <tt>/''search-term''</tt>:
+
apt-cache search .* | sort | less
+
When you're done removing and adding packages, a good way to clean up is by typing this
+
COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs dpkg -P
+
Also, because the Debian package system keeps a cache of downloaded packages, you may want to run the following to clear out those spare files:
+
apt-get clean
+
 
+
===Settaggio degli utenti===
+
User settings are in /etc/skel.  This directory will be copied to make new user home directories.
+
<blockquote>tip: don't put files in /root they will be only available (at runtime) in /KNOPPIX/root</blockquote>
+
 
+
Note that the default user 'knoppix' is not created by adduser(1), thus /etc/skel is not copied completely but rather selectively.  That is, to make a file .xyrc appear in /home/knoppix, it is not sufficient to place it in /etc/skel.  One possibility is to extend the code in /etc/X11/Xsession.d/45xsession which is responsible for filling /home/knoppix.
+
 
+
===AutoEsecuzione programmi===
+
When you want to autrun some programs, one can create a script and put it in the directory <tt>/etc/rc5.d/</tt> (This only loads items before X loads).  Read up on the SysV init process for more possibilities.
+
 
+
''For X-programs consider <tt>/home/knoppix/.kde/Autostart</tt> but this may transfer form <tt>/etc/skel/.kde/Autostart</tt> on boot''--[[User:12.106.237.2|12.106.237.2]] 18:08, 7 December 2007 (UTC)
+
 
+
==Edit del KNOPPIX auto-configuration script==
+
You can find a lot of interesting information about how KNOPPIX auto-configures you system by looking in the /etc/init.d/knoppix-autoconfig script. Of particular note are the following.
+
 
+
===Cambire la default KDE background image===
+
The auto-configuration script sets the default KDE background image to be an image from the CD-ROM. An image that you can easily change when you are remastering KNOPPIX.
+
** In KNOPPIX 3.3 and below it is /cdrom/KNOPPIX/background.gif
+
** In KNOPPIX 3.4 and above it is /cdrom/KNOPPIX/background.jpg
+
 
+
===Editare i file di autoconfigurazione di floppy e CD-ROM===
+
The auto-configuration script sets up both your CD-ROM and your floppy disk. The commands for doing this are 'floppyconfig' and 'cdromconfig', respectively. The auto-configuration script will also run cdrom/KNOPPIX/knoppix.sh, which is an easy script to change when remastering KNOPPIX.
+
 
+
===Changing the default boot parameters===
+
All boot parameters obtain default values from the /etc/init.d/knoppix-autoconfig script. This is one massive BASH script (you best know your BASH to play with this), but it is the place that you can edit any of the default boot parameters.  For example, to switch from 'kde' to 'twm' as default desktop just search for the place where 'kde' is provided as default value (variable DESKTOP, IIRC). Another example would be changing the default language can be changed.
+
 
+
Note, if you are interested in changing the default language KDE uses, the easiest thing to do is to load KDE, instructions are below, and use the KDE configuration utility to select your language of interest.
+
 
+
==Configurazione delle sessioni X==
+
When working with X-based programs you will have to make sure that your display is set appropriately. You can do this manually when remastering KNOPPIX. Also, two scripts related to X Session is where you can change or disable the startup and shutdown sounds.
+
 
+
===Start dei programmi della interfaccia X===
+
Quando testate i programmi basati su X voi dovete avere attivato le variabili di ambiente
+
export DISPLAY=localhost:0.0
+
Questo consente di connettere le vostre applicazioni alle sessioni del server X. In alternativa (se avete lda testare il windows manager),Potete creare un successiva sessione X. Fuori da chroot, eseguite
+
Xnest -ac :1
+
All'interno di chroot, Settate così le variabili di ambiente
+
export DISPLAY=localhost:1
+
 
+
Indicazioni interessati le trovate in /etc/init.d/xsession :
+
* Potete personalizzare il background modificando /usr/local/lib/knoppix.gif
+
 
+
===Modifica/Disattivazione del sound alla partenza===
+
Il suono alla attivazione di X è eseguito mediante le indicazioni presenti in /etc/X11/Xsession.d/45xsession. Potete disattivare il suono commentando le linee seguenti nello script.
+
<pre><nowiki>playsound(){
+
# Play sound if soundcore module present (checking /dev/sndstat is unreliable)
+
# OGGPLAY=/usr/bin/ogg123
+
# PLAY=/usr/bin/wavp
+
# [ -x "$PLAY" ] || PLAY=/usr/bin/play-sample
+
# [ -x "$PLAY" ] || PLAY=/usr/bin/play
+
# if [ -x "$OGGPLAY" -a -f /usr/share/sounds/startup.ogg ]; then
+
# case "$(lsmod)" in *sound*) { $OGGPLAY -q -p 64 /usr/share/sounds/startup.ogg >/
+
# elif [ -f /usr/share/sounds/startup.wav -a -x "$PLAY" ]; then
+
# case "$(lsmod)" in *sound*) { $PLAY /usr/share/sounds/startup.wav >/dev/null 2>&
+
# fi
+
}</nowiki></pre>
+
 
+
===Modifica/disabilita il suono in shutdown===
+
Il suono allo shutdown ( spegnimento) è eseguito mediante le indicazioni presenti in /etc/init.d/xsession. Potete disattivare il suono commentando le linee 210-220 nello script.
+
<pre><nowiki>## Play informational sound if soundcore module present
+
## (checking /dev/sndstat is unreliable)
+
#OGGPLAY=/usr/bin/ogg123
+
#PLAY=/usr/bin/wavp
+
#[ -x "$PLAY" ] || PLAY=/usr/bin/play-sample
+
#[ -x "$PLAY" ] || PLAY=/usr/bin/play
+
#if [ -x "$OGGPLAY" -a -f /usr/share/sounds/shutdown.ogg ]; then
+
#case "$(</proc/modules)" in *sound*|*snd_*) { $OGGPLAY -q -p 64 /usr/share/sound
+
#elif [ -f /usr/share/sounds/shutdown.wav -a -x "$PLAY" ]; then
+
#case "$(</proc/modules)" in *sound*|*snd_*) { $PLAY /usr/share/sounds/shutdown.w
+
#fi</nowiki></pre>
+
 
+
===Cambiare il windows manager di default===
+
 
+
Aprire /etc/init.d/knoppix-autoconfig  e guardare o trovate la linea qui sotto:
+
<pre><nowiki>
+
# Allow only supported windowmanagers                                         
+
# Actually, this check is useless because it's done again in 45xsession. -KK   
+
# case "$DESKTOP" in gnome|enlightenment|kde|larswm|xfce|xfce4|lg3d|ratpoison|blackbox|openbox|windowmaker|wmaker|icewm|fluxbox|twm|nx|rdp|kiosk) ;; *) DESKTOP="kde"; ;; esac                                                                 
+
[ -n "$DESKTOP" ] || DESKTOP="kde"                                         
+
</nowiki></pre>
+
 
+
Cambiate "kde" tra gli apici della vostra interfaccia preferita, per esempio ( gdm, fluxbox, twm, ecc...).
+
 
+
==Changing the boot graphic, boot message, and startup script text==
+
While you are in the chroot environment you can easily change the boot messages, the boot graphic, and the default KDE background graphic.
+
 
+
===Cambiare la grafica del boot===
+
The 'boot graphic' is the first image you see when the CD or DVD boots. It looks similar to ASCII art and it is normally something flashy that says 'Knoppix'. You can change this to be any graphic that you please, but you must use a 640x400 graphic that has only 16 colors.
+
 
+
#Change to the /mnt/hda1/knx/master/boot directory. Swap '/mnt/hda1/' for whatever disk you are using.
+
#* <pre><nowiki>cd /mnt/hda1/knx/master/boot/isolinux</nowiki></pre>
+
#Back up your old logo in case you break things.
+
#* <pre><nowiki>mv logo.16 logo.16.backup</nowiki></pre>
+
#Make a 640x400 pixel 16 color graphic and save it as a GIF, e.g. 'logo.16.gif'. GIMP can easily do this. Note, you can use a graphic that originally had more than 16 colors, but it is critical that you conver the graphic to 16 colors before doing the next step.
+
#Convert the GIF to lss16 using the tools included on the Knoppix CD.
+
#* <pre><nowiki>giftopnm < 640x400x16.gif > logo.ppm
+
ppmtolss16 <logo.ppm > logo.16</nowiki></pre>
+
 
+
===Cambiare il messaggio di boot===
+
The 'boot message' is the message that you see under the 'boot graphic' on the initial screen when the Knoppix CD or DVD loads. It normally says something along the lines of Knoppix with the version number and includes a link to the Knoppix website. You can change this text to be whatever you please, but you shouldn't add too much text or it will make the boot screen look funny. Restricting yourself to a singly line of text that is no larger than the default one is a good idea.
+
 
+
#Change to the /mnt/hda1/knx/master/boot directory. Swap '/mnt/hda1/' for whatever disk you are using.
+
#* <pre><nowiki>cd /mnt/hda1/knx/master/boot</nowiki></pre>
+
#Back up your old message in case you break things.
+
#* <pre><nowiki>cp boot.msg boot.msg.backup</nowiki></pre>
+
#Edit the message with a text editor. You'll see at the top of the message that it shows the graphic. Don't change this text, just the line under.
+
#* <pre><nowiki>vi boot.msg</nowiki></pre>
+
 
+
===Cambiare lo script di startup ===
+
The 'startup script text' is the text that you see after the initial boot screen, while Knoppix loads and configures your system. You can change as much of this text as you please. You can even add addition lines to the script; however, it is recommended that you don't play with this file. Limiting yourself to editing the 'Welcome to KNOPPIX' message is a good idea.
+
 
+
#Change to the /mnt/hda1/knx/master/boot directory. Swap '/mnt/hda1/' for whatever disk you are using.
+
#* <pre><nowiki>cd /mnt/hda1/knx/master/boot/isolinux</nowiki></pre>
+
#Back up your old minirt.gz in case you break things.
+
#* <pre><nowiki>cp minirt.gz minirt.gz.backup</nowiki></pre>
+
#Uncompress minirt.gz
+
#* <pre><nowiki>gunzip minirt.gz</nowiki></pre>
+
#Make a temporary directory to mount the minirt filesystem.
+
#* <pre><nowiki>mkdir todelete</nowiki></pre>
+
#Mount the minirt filesystem as an ext2 filesystem.
+
#* <pre><nowiki>mount minirt todelete -t ext2 -o=/dev/loop0</nowiki></pre>
+
#::or if the above does not work use
+
#* <pre><nowiki>mount minirt todelete -t ext2 -o loop</nowiki></pre>
+
#Edit the linuxrc script to display the message you want. You'll find the default message approximately 2 pages down and it'll be using several colors, i.e. ${WHITE}, ${RED}, etc., so it might be slightly tricky to spot.
+
#* <pre><nowiki>vi todelete/linuxrc</nowiki></pre>
+
#unmount the minirt filesystem.
+
#* <pre><nowiki>umount todelete</nowiki></pre>
+
#Compress the minirt filesystem.
+
#* <pre><nowiki>gzip -9 minirt</nowiki></pre>
+
#Remove your temporary directory.
+
#* <pre><nowiki>rmdir todelete</nowiki></pre>
+
 
+
==Lanciare KDE per cambiare Menu,Icone,ecc...==
+
While you are in the chroot environment you can load KDE and use the configuration tools to change buttons, icons, etc. Once you are finished you can exit KDE and copy /home/knoppix to /etc/skel to keep these changes. To load KDE do the following.
+
 
+
#If you are not at runlevel 2 (i.e. if you are already in KDE), switch to runlevel 2.
+
#* <pre><nowiki>init 2</nowiki></pre>
+
#Copy /etc/skel to /home/knoppix
+
#* <pre><nowiki>cp -Rp /etc/skel /home/knoppix</nowiki></pre>
+
#Change permissions to the user 'knoppix'
+
#* <pre><nowiki>chown knoppix:knoppix -R /home/knoppix</nowiki></pre>
+
#Copy over your X11 configuration to the chroot'd environment (press ctrl+alt+F2 to switch to a non-chroot'd terminal, then ctrl+alt+F1 to switch back when done)
+
#* <pre><nowiki>cp /etc/X11/xorg.conf /mnt/hda1/knx/source/KNOPPIX/etc/X11</nowiki></pre>
+
#*<blockquote>'' Knoppix 3.7: I think it's XF86Config-4 rather than xorg.conf.''</blockquote>
+
#(Optional)Switch to user 'knoppix'. If you want to uninstall packages, stay as root -- e.g. skip this step. If you want to configure the buttons, icons, background, etc., that you see when KDE boots, be sure to do this step.
+
#* <pre><nowiki>su knoppix</nowiki></pre>
+
##Launch KDE
+
##* <pre><nowiki>startx</nowiki></pre>
+
##Do your KDE changes
+
##Exit KDE
+
##Exit su and switch back to user 'root'.
+
##* <pre><nowiki>exit</nowiki></pre>
+
#Copy /home/knoppix back to /etc/skel to keep the changes
+
#* <pre><nowiki>mv /etc/skel /etc/skel-old
+
mv /home/knoppix /etc/skel</nowiki></pre>
+
#Set the owner back to root
+
#* <pre><nowiki>chown root:root -R /etc/skel</nowiki></pre>
+
#Remove the xorg.conf file
+
#* <pre><nowiki>rm /etc/X11/xorg.conf</nowiki></pre>
+
#If you find that some of your settings are not persistent after booting the new image, check the initialization file at /etc/X11/Xsession.d/45xsession.  By default, Knoppix does '''not''' simply copy over all files from /etc/skel.  You may need to make modifications here if you wish to do something different.
+
 
+
===canbiare la grafica el ksplash KDE ===
+
You can change the graphics that KDE shows via ksplash when it first loads. These graphics are in the <b>/mnt/hda1/knx/source/KNOPPIX/usr/share/apps/ksplash/Themes/Default/</b> directory. You'll most likely want to swap out <b>splash_top.png</b> for a custom 400x248 PNG graphic. Note that ksplash will not automatically put a border around your graphic. If you'd like a border, you have to manually add it to your graphic.
+
 
+
==Leaving the Chroot==
+
If you mounted it, you'll need to unmount /proc - very important!
+
umount /proc
+
Press '''CTRL+D''' to leave being chrooted.
+
 
+
==Rinetrare in modo chroot==
+
If you've left the chroot, but you want to go back in and modify some things...
+
 
+
Remount the local hard disk (if needed)
+
<pre>mount -rw /dev/hda1 /mnt/hda1</pre>
+
Setup the environment for chroot
+
<pre><nowiki>mount --bind /dev /mnt/hda1/knx/source/KNOPPIX/dev
+
mount --bind /proc /mnt/hda1/knx/source/KNOPPIX/proc</nowiki></pre>
+
Now you can "chroot" into the copied KNOPPIX:
+
<pre><nowiki>chroot /mnt/hda1/knx/source/KNOPPIX</nowiki></pre>
+
 
+
==Rimasterizzare la ISO==
+
We've finished customizing and ready to burn!
+
First do some cleanup:
+
* remove any .bash_history files, tmp files, etc.
+
* back out any changes you don't want burned back to the disc
+
* <pre>rm -rf /mnt/hda1/knx/source/KNOPPIX/.rr_moved</pre>
+
 
+
===KNOPPIX Immagine Compressa===
+
Now we'll make the big <tt>KNOPPIX</tt> file which is an ISO 9660 filesystem compressed for use by the <tt>cloop</tt> driver:
+
mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "KNOPPIX www.knoppix.net" \
+
      -hide-rr-moved -cache-inodes -no-bak -pad /mnt/hda1/knx/source/KNOPPIX
+
  | nice -5 /usr/bin/create_compressed_fs - 65536 > /mnt/hda1/knx/master/KNOPPIX/KNOPPIX
+
the "www.knoppix.net" and "Knoppix.net filesystem" can be changed to what you want to call the file. You will get an error that it doesn't conform to ISO standards -- you can ignore this.  Note that, to run <tt>create_compressed_fs</tt>, you'll need to have enough space to store the entire ISO in RAM/swap.  Ensure you have at least 800M of free space before starting.
+
 
+
In Knoppix 3.4 the <tt>create_compressed_fs</tt> script has been updated so be sure to use it to obtain the best result. It has a new option '''-b''' (best), which enables the best compression by using different compression schemes and tries to optimize that way, but be careful, because that option is slow (10x slower).
+
 
+
Note: The above didn't work for me using the latest create_compressed_fs. I could create the ISO but it couldn't read the compressed image properly when booting (I/O errors when reading the cloop0 device). I think this was because create_compressed_fs didn't have enough RAM and it was just failing silently. The command below did work though. It uses a file rather than memory for temporary storage:
+
 
+
mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "KNOPPIX www.knoppix.net" \
+
    -hide-rr-moved -cache-inodes -no-bak -pad /mnt/hda1/knx/source/KNOPPIX
+
      | nice -5 /usr/bin/create_compressed_fs -B \
+
    65536 -f /mnt/hda1/isotemp - /mnt/hda1/knx/master/KNOPPIX/KNOPPIX
+
 
+
===Live CD ISO===
+
Bene quando avete finito, potete procedere a produrre l'immagine finale del CD-ROM:
+
cd /mnt/hda1/knx/master'''
+
find -type f -not -name md5sums -not -name boot.cat -not -name isolinux.bin \
+
    -exec md5sum '{}' \; > KNOPPIX/md5sums
+
(Questo aggiona il marker MD5 calcolando l'hash dei file includi nell'ISO, usato per verificare l'integrità) ora potete masterizzare; per Knoppix <= 3.3:
+
mkisofs -pad -l -r -J -v -V "KNOPPIX" -b KNOPPIX/boot.img -c KNOPPIX/boot.cat \
+
    -hide-rr-moved -o /mnt/hda1/knx/knoppix.iso /mnt/hda1/knx/master
+
per Knoppix >= 3.4 o altre distribuzioni isolinuxor:
+
mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot -boot-load-size 4 \
+
    -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
+
    -hide-rr-moved -o /mnt/hda1/knx/knoppix.iso /mnt/hda1/knx/master
+
(la ISO è memorizzata in <tt>/mnt/hda1/knx/knoppix.iso</tt>)
+
 
+
Trasferite la vostra ISO usando il vostro tool preferito, è il CD e pronto per l'uso.
+
 
+
=Trucchi=
+
I have had good results remastering working from the CD as root working from fluxbox. Just say "knoppix 2" at the boot prompt and it will boot you to a root prompt where you can then say "startx /usr/bin/fluxbox". I like to use the xterm unicode shell.
+
 
+
==Gestione dei pachetti Software==
+
While working chroot doing the remastering I like to use
+
apt-get remove --purge pkg-name
+
to remove packages because before it does anything it will stop and show details on what it is fixing to remove and let you say "yes or no".
+
 
+
If you don't use the above "apt-get" instructions and have a lot to cleanup and purge, here's the easy way to do it:
+
  COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' > topurge
+
That will make a list of all removed packages to purge and then you just say
+
dpkg -P `< topurge `
+
and you're all done.  
+
COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs dpkg -P
+
is a one-line version of this. Also use
+
deborphan | xargs dpkg -P .
+
 
+
==Alternativa per macchine con poca Memoria==
+
You don't really need 1G swap as there are two new tools to create compressed filesystems. Here are some candidates to make ''compressed'' fs:
+
* Valentijn's rewrite [http://projects.openoffice.nl/downloads/compressloop/]
+
* Quozl's port of compressloop for Knoppix 3.4 [http://quozl.linux.org.au/compressloop-1.9-64bit.c]
+
* Quozl's distributed compressloop (use more than one processor to speed things up) [http://quozl.linux.org.au/knoppix/compressloop/] or [http://quozl.netrek.org/knoppix/compressloop/]
+
* Justin's patch [http://s.bouncybouncy.net/~justin/code/] (link broken) I also just wrote a distributed cloop compressor(or for smp)  It's in that same directory.
+
 
+
==Test della immagine CD senza creare il supporto CD==
+
If you have a spare partition with at least 700MB free space formatted with ext2, ext3 or Vfat, you can use this for test by booting from a floppy disk. A floppy boot will look for a partiton with /KNOPPIX/ in the root, and the compressed image /KNOPPIX/KNOPPIX. Instead of using the sub-directory /mnt/hda1/knx/master/KNOPPIX/ as described above, it should be called /mnt/hda2/KNOPPIX/ . The root index.html will then be located at /mnt/hda2/index.html and the compressed image will be at /mnt/hda2/KNOPPIX/KNOPPIX . Now you can boot from floppy and use /mnt/hda2 as your image. For further information see [[Hd BasedHowTo]].
+
 
+
If you don't have an extra partition or you don't want to do so much for it, you can use Qemu ( see [http://fabrice.bellard.free.fr/qemu/] ) with the ISO image like this:
+
qemu -m 128 -cdrom /temp/knoppix-custom.iso -boot d -net user
+
You even do not have to build a hard disk image before, just install Qemu and try this. Amazing!
+
 
+
==Test della versione rimasterizzata senza creare il cloop file/iso==
+
i use a setup similar to knoppix terminal server to test the remastered files without having to recreate a
+
cloop image every time: the remastered files live in an ext2 filesytem in a loopfile (knoppix_loop) mounted rw (this is where i chroot in). when i want to test the current setup, i have another machine network boot and use the files from the loopfile directly (needs another miniroot.gz). See [[User:Ml#dev_setup]]
+
 
+
If you want to use only one machine, you'll have to reboot (or use qemu) and use the "loopfile" and "fromhd" cheatcodes (see [[User:Ml#miniroot_changes]]). For example, this is what my grub boot entry looks like:
+
 
+
<pre>
+
title          Remastered Knoppix
+
root            (hd0,0)
+
kernel          /boot/myknoppix/vmlinuz fromhd=/dev/hda4 loopfile=/samba/share/isos/knoppix_loop lang=us ramdisk_size=100000 init=/etc/init apm=power-off nomce vga=791 quiet BOOT_IMAGE=knoppix
+
initrd          /boot/myknoppix/miniroot.gz
+
</pre>
+
 
+
== Boot della immagine Knoppix con GRUB==
+
* First copy /boot off the Knoppix cd to your boot partition (or even your dos partition). I named mine boot.knoppix
+
Copy the master/KNOPPIX directory to your root directory of any hard disk. You may place it somewhere other than the boot partition (ext2/3, reiserfs, vfat are supported).
+
* for Knoppix <= 3.3, put the following in your /boot/grub/menu.lst:
+
title KNOPPIX
+
        root  (hd0,0)
+
        kernel /boot.knoppix/vmlinuz 2 fromhd=/dev/hda4 lang=us
+
        initrd /boot.knoppix/miniroot.gz
+
* for Knoppix >= 3.4 or other isolinux based distributions:
+
title KNOPPIX
+
        root  (hd0,0)
+
        kernel /boot.knoppix/isolinux/linux 2 fromhd=/dev/hda4 lang=us
+
        initrd /boot.knoppix/isolinux/minirt.gz
+
* notice the fromhd parameter: it's the location of the /KNOPPIX directory
+
* reboot and have fun.
+
 
+
==Script Utili al vostro remastering==
+
----
+
Questa e una struttura di directory raccomandata per il vostro remastering di KNOPPIX:
+
. (invoke ../remaster from here)
+
|-- master (invoke ../../[[u]]mountbootimage from here)
+
|  |-- KNOPPIX
+
|  |  |-- KNOPPIX (compressed image)
+
|  |  |-- boot.img (boot floppy image)
+
|  |  `-- (other files snipped)
+
|  `-- index.html
+
`-- source
+
    `-- KNOPPIX (this directory can be chrooted into)
+
        |-- bin
+
        |-- boot
+
        |-- cdrom
+
        |-- dev
+
        |-- etc
+
        |-- floppy
+
        |-- home
+
        |-- initrd
+
        |-- lib
+
        |-- mnt
+
        |-- none
+
        |-- opt
+
        |-- proc
+
        |-- root
+
        |-- sbin
+
        |-- tmp -> /var/tmp
+
        |-- usr
+
        |-- var
+
        `-- vmlinuz -> boot/vmlinuz-2.4.22-xfs
+
----
+
the following script "remaster" will do the remaster process for you. Use as root, or you will end up with wrong access rights in the image.
+
 
+
The script has last been tried out on Debian sid on 2004-04-02.
+
 
+
#!/bin/bash -x
+
# This script builds a new KNOPPIX ISO image.
+
# Copyright (C) 2004 by Marc Haber <mh+knoppix-remaster@zugschlus.de>
+
# License: GPL V2
+
+
ROOT="$PWD"
+
SOURCE="$ROOT/source/KNOPPIX"
+
MASTER="$ROOT/master"
+
CLOOPTARGET="$ROOT/master/KNOPPIX/KNOPPIX"
+
TARGET="$ROOT"
+
EXCLUDELIST="$ROOT/source/excludelist"
+
+
rm -rf $SOURCE/.rr_moved
+
+
cd $SOURCE
+
mkisofs -R -U -V "KNOPPIX.net filesystem" \
+
-P "KNOPPIX www.knoppix.net" \
+
-hide-rr-moved -cache-inodes -no-bak -pad \
+
-exclude-list $EXCLUDELIST \
+
. | nice -5 /usr/bin/create_compressed_fs - 65536 > $CLOOPTARGET
+
+
cd $MASTER
+
rm -f KNOPPIX/md5sums
+
find -type f -not -name md5sums -not -name boot.cat -exec md5sum {} \; >> KNOPPIX/md5sums
+
mkisofs -pad -l -r -J -v -V "KNOPPIX" -b KNOPPIX/boot.img \
+
-c KNOPPIX/boot.cat -hide-rr-moved -o $TARGET/knoppix.iso $MASTER
+
----
+
The following script will loop-mount boot floppy image and initrd image for modification. The umount function will build a new initrd image and put it back on the boot floppy image.
+
 
+
The script has last been tried out on Debian sid on 2004-01-13.
+
<!-- lines starting with space a preformatted -->
+
#!/bin/bash -x
+
# This script will loop-mount boot floppy and initrd image
+
# Copyright (C) 2004 by Marc Haber <mh+knoppix-remaster@zugschlus.de>
+
# License: GPL V2
+
unset CDPATH || true
+
+
# if not root, re-invoke self as root
+
if [[ "`id -u`" -ne 0 ]]; then
+
export LOCUSER="$USER"
+
export LOCHOME="$HOME"
+
if [[ "${SHELLOPTS/xtrace/}" != "$SHELLOPTS" ]]; then
+
sudo bash -x $0 $@
+
exit $?
+
else
+
sudo $0 $@
+
exit $?
+
fi
+
else
+
LOCUSER="${LOCUSER:-$USER}"
+
LOCHOME="${LOCHOME:-$HOME}"
+
fi
+
set -e
+
+
KNOPPIXDIR="KNOPPIX"
+
BOOTIMGFILE="$KNOPPIXDIR/boot.img"
+
BOOTIMGFS="vfat"
+
BOOTIMGDIR="boot.img"
+
INITRDGZ="$BOOTIMGDIR/miniroot.gz"
+
INITRDFILE="$KNOPPIXDIR/miniroot"
+
INITRDFS="ext2"
+
INITRDDIR="miniroot"
+
+
mountbootimage() {
+
if ! modprobe loop; then
+
echo >&2 "ERR: cannot load loop module"
+
exit 1
+
fi
+
+
if ! [[ -e "$BOOTIMGFILE" ]]; then
+
echo >&2 "ERR: no $BOOTIMGFILE found"
+
exit 1
+
fi
+
+
for nofile in $BOOTIMGDIR $INITRDGZ $INITRDFILE $INITRDDIR; do
+
if [[ -e "$nofile" ]]; then
+
echo >&2 "ERR: $nofile already exists"
+
exit 1
+
fi
+
done
+
+
mkdir -p $BOOTIMGDIR
+
mount -o loop,uid=$LOCUSER -t $BOOTIMGFS $BOOTIMGFILE $BOOTIMGDIR
+
+
< $INITRDGZ gunzip > $INITRDFILE
+
mkdir -p $INITRDDIR
+
mount -o loop -t $INITRDFS $INITRDFILE $INITRDDIR
+
}
+
+
umountbootimage() {
+
dd if=/dev/zero of=$INITRDDIR/nullfile || true
+
sync
+
rm $INITRDDIR/nullfile
+
umount $INITRDDIR
+
rmdir $INITRDDIR
+
< $INITRDFILE gzip --best > $INITRDGZ
+
rm -f $INITRDFILE
+
+
umount $BOOTIMGDIR
+
rmdir $BOOTIMGDIR
+
+
syslinux KNOPPIX/boot.img
+
}
+
+
case "`basename $0`" in
+
mountbootimage)
+
mountbootimage
+
;;
+
umountbootimage)
+
umountbootimage
+
;;
+
*)
+
echo >&2 "ERR: called with unknown name `basename $0`"
+
exit 1
+
;;
+
esac
+
 
+
==Spunti Intorno all'uso di apt-get per installare/update/rimozione applicazioni==
+
(by gnarvaja)
+
* If you booted from CD, even on a HD install (example: Pivot Install) instead of copying the original CD and KNOPPIX directory to the HD, you can use them directly from their mount points.
+
* Another alternative is to mount an ISO image of the original CD as a loop device and mount the KNOPPIX image as a '''cloop''' device. You will save close to 2GB of space. Script to mount from an ISO image:
+
 
+
#!/bin/bash
+
# Assumes that the current directory is the working space
+
# original.iso is an image of the CD we will be using as master
+
mount -t iso9660 original.iso ./oldcd -o ro,loop
+
# initialize the compressed loop device
+
losetup /dev/cloop1 ./oldcd/KNOPPIX/KNOPPIX
+
mount -t iso9660 /dev/cloop1 ./KNOPPIX -o ro,loop
+
 
+
* Get '''apt-spy''' and use it to modify the sources.list file with the best mirrors for your particular region. This will speed up the downloading. Backup the original '''sources.list''' just in case.
+
* Another technique is to modify '''sources.list'''. Replace the string '''.de.''' in the ftp addresses (ftp.de.debian.org) with the code corresponding to your country. Examples: USA -> .us. (ftp.us.debian.org), Brazil -> .br. (ftp.br.debian.org). Check the Debian site for debian.org mirrors in your country.
+
* Remember to uncomment the '''linuxtag''' ftp addresses to get the latest and greatest from Knoppix
+
* Use '''apt-get update''' to get the lists with the latest releases and patches. Do not update a package if you don't need to, it may lead to the use of additional disk space (precious commodity when you want to keep everything below 700MB) and you may brake something else without knowing. Abuse the '''-s''' option to simulate the installation.
+
* Before doing the update, I modified my default releases to '''testing''', that means that the software I'll be using will have a good balance of stability and features. Knoppix uses '''unstable''' by default, which is too risky for my personal taste.
+
* Get '''[apt-get install] locale''' and configure it with the locales you are going to use. It will save lots of space when downloading applications with plenty of locale modules and localized manual pages.
+
* I use '''aptitude''' to get/remove applications, it is character based so it works with init 2. As you mark packages for install/update/removal, it will tell you how much disk space you will save/use, try to solve depencies problems and give you plenty control to fix them manually when possible.
+
* When installing applications it is likely that your '''/etc/rc?.d''' directories will have new entries, many of them unwanted or unplanned. Make sure you check them and remove the new entries based on your preferences. I usually leave '''/etc/rc2.d''' and '''/etc/rc5.d''' as close as the originals as possible and modify '''/etc/rc3.d''' and '''/etc/rc4.d''' to test new stuff. '''Example:''' You may want to have ntfs installed, but not necessarily running by default. Same with apache, mysql and many others.
+
* When removing/purging applications, they may leave behind non-empty directories. Usually this is announced by aptitude, apt-get or any other installation utilty. Make sure to check the messages and manually remove those directories.
+
* After you are done, '''aptitude''' may leave some files behind. Here's a clean up script I use:
+
 
+
# !/bin/bash
+
# Clean package files generated by aptitude
+
rm /var/log/aptitude
+
rm /var/lib/apt/lists/*debian*
+
rm /var/lib/apt/lists/*knoppix*
+
 
+
=Problemi Comuni riscontrati=
+
* [[Dev_null_permission_denied|/dev/null: Permission Denied]] Chroot problems accessing device files
+
 
+
* You've <code>startx</code>'d (into whatever window manager you like) and you start a terminal (gnome-terminal, konsole, xterm).  Nothing happens (such is the case in fluxbox, and you'll see an error in you <code>~/.xsession-errors</code> file).  Or perhaps the error is helpfully displayed: <code>
+
  get_pty: not enough ptys
+
</code>
+
I had plenty yesterday... but then I <code>chroot</code>ed so, to solve this, <code>
+
  # NOT in your chroot environment
+
  cd /mnt/hda1/knx/source/KNOPPIX/dev
+
  MAKEDEV pty
+
 
+
  # enter your chroot environment
+
  chroot /mnt/hda1/knx/source/KNOPPIX/
+
 
+
  # and mount /dev/pts
+
  mount -t devpts /dev/pts/ /dev/pts
+
 
+
</code>
+
it might give that same "fstab not found" error as mounting proc
+
does.  so do what you'd do then, disregard.
+
 
+
start your X up again and try your terminal, should work.
+
thanks to: technovelty[http://www.technovelty.org/linux/tips/xinchroot.html] for the final enlightenment
+
 
+
=Altre Indicazioni=
+
 
+
If my howto is too confusing, or you'd like a second opinion, check out charan's very nice remastering howto: http://gnubox.dyndns.org:8080/~sunil/knoppix.php.
+
Another Howto is at  http://www.stirnimann.com/mystuff/doc/knoppix.txt
+
 
+
There is a wizard, which knows all the unpacking, compressing and CD-recording steps mentioned here. It also shows a shell where you can update the uncompressed KNOPPIX system using debian's standard software installation tools. It is called mmkcdrom and part of the plugscript package: [http://rcswww.urz.tu-dresden.de/~holzhey/plugscript]
+
 
+
Vedete questo HOWTO, per smanettoni delle shell, a http://quozl.linux.org.au/knoppix/
+
 
+
Potete dare uno sguardo a [http://knoppix.net/forum/viewforum.php?f=2 Knoppix Customization Forum] per altre idee ad aiuto al vostro remastering.
+
 
+
* Se volete introdurre un kernel personalizzato, vedete questo link [[Knoppix Custom Kernel Howto]]
+
* Trovate alcune utili quide alla O'Reilly con molte varianti: [http://linux.oreillynet.com/lpt/a/4323 Using and Customizing Knoppix]
+
 
+
=Conclusioni=
+
Questa è una versione aggiornata del mio howto precedente. Un suggerimento ai principianti del linux; Dovete conoscere bene come utilizzate i comandi del linux e apprendere delle singole funzioni l'esito dei comandi. Evitate se non avete una buona esperienza di Linux potreste fare danni alla Vs. installazione. Continueremo ad aggiornare e dattagliare la procedura in funzione anche dei vostri suggerimenti.
+
 
+
=Ringraziamenti=
+
Traduzione a cura di [http://www.mcmax.info mcmax], e a [http://www.knoppix.org knoppix] per le correzioni i trucchi e le idee.  Ritenetevi liberi di operare modifiche per aggiornamenti sulle procedure.
+
 
+
Note sullo swap:<br>
+
 
+
=Translations=
+
* German Version: [[Knoppix Remastering Howto Deutsch]]
+
* Spanish Version: [[Knoppix Remastering Howto Spanish]]  en español
+
* French Version: [[Knoppix Remastering Howto French]]
+
* Indonesian Version: [[Knoppix Remastering Howto Indonesian]]
+
* Russian Version: [[Knoppix Remastering Howto Russian]]
+
* Brazilian Portuguese Version: [[Knoppix Remastering Howto Brazilian Portuguese]]
+
 
+
 
+
[[Category: Remastering Knoppix ]]
+

Latest revision as of 17:58, 16 February 2012

Template:Delete--Werner P. Schulz 10:58, 16 February 2012 (MST)