Difference between revisions of "Remastering Hacks"
m (→Configuring locale settings) |
m (→Useful packages for install packages and cleaning up locales) |
||
Line 96: | Line 96: | ||
localepurge | localepurge | ||
+ | |||
+ | NOTE: localepurge may not be able to be installed by the '''apt-get install''' command (ie. you get the error "Couldn't find package localepurge" when you try to install), but you can install it with the '''aptitude''' interface. | ||
Aptitude is a console menu front end to apt and dpkg. | Aptitude is a console menu front end to apt and dpkg. |
Revision as of 23:37, 6 January 2006
There are so many howtos cropping up, each with individual tips and customization examples for Knoppix remasters, that it seems good to have a place to put generic tips, no matter how you go about remastering, be it using scripts, completely by hand, or via a HD install, Morphix, etc... Please add your tips and example "hacks" here.
Contents
- 1 Remastering Process Tips
- 2 Installing software and clearing up space with Apt
- 2.1 Get the best apt mirror
- 2.2 Update all packages
- 2.3 Configuring locale settings
- 2.4 Character based pkg mgt w/Aptitude
- 2.5 Cleaning up space when removing apps
- 2.6 Removing a bunch of Internationalization support to save space`using Apt and grep
- 2.7 Other packages commonly removed for custom images
- 2.8 What to do when behind a proxy
- 2.9 Useful packages for install packages and cleaning up locales
- 3 Boot
- 4 Startup
Remastering Process Tips
Saving space while running chroot environment
- 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
Installing software and clearing up space with Apt
Get the best apt mirror
- 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
Update all packages
- 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.
Configuring locale settings
- 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.
- NOTE: Knoppix 4.0.2 (possibly other 4.x and 3.9 versions too) already has the 'locales' package installed. In this case it is easy to get the right locale set. Just run the command dpkg-reconfigure locales as the root user. This will allow you to select/de-select the locales that you will use, and choose a default locale for your system.
Character based pkg mgt w/Aptitude
- 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.
- 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*
Cleaning up space when removing apps
- 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.
Removing a bunch of Internationalization support to save space`using Apt and grep
The following command returns a listing of all packages installed.
dpkg-query -l | less
While that command is useful, you can use grep to sort out which packages you to remove. The following command shows me packages that kde uses for internationalization support and strips off all the other extraneous information.
dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3
I can feed this to apt-get so that it will remove those packages.
apt-get remove `dpkg-query -l | grep i18n | grep kde | cut -d' ' -f3`
You could remove openoffice and other German tools as follows:
apt-get remove openoffice-de-en manpages-de trans-de-en
Other packages commonly removed for custom images
Remove enigma and bacula as follows:
apt-get remove enigma bacula-common
Remove emacs as follows:
apt-get remove emacs21 emacs21-bin-common emacs21-common emacsen-common gettext-el zile
German Language user package
apt-get remove user-de
This results in a reasonable base to begin updating and adding packages to this system. First configure /etc/apt/sources.list and add the appropriate entries for a local Debian mirror.
What to do when behind a proxy
If you are behind a proxy and must authenticate against it to access the internet, then use the following command. export http_proxy="http://username:passwd@yourproxy.company.com:portnumber/"
Useful packages for install packages and cleaning up locales
Add three useful packages:
apt-get install localepurge aptitude
Localepurge will only keep the locales that are marked. This means that it will free up additional space. After running through the configuration removing locales you don't need, you must run it from the command line:
localepurge
NOTE: localepurge may not be able to be installed by the apt-get install command (ie. you get the error "Couldn't find package localepurge" when you try to install), but you can install it with the aptitude interface.
Aptitude is a console menu front end to apt and dpkg.
Package updates within the GUI
apt-get install synaptic
Synaptic is a graphical front end to apt & dpkg.
Boot
Boot logo
The boot logo : The boot image is logo.16 and is a lss16 format image. To start make a 16 color image (in Gimp, create the image and use the Image -> Mode -> Indexed menu to export to 16 colors) you want to use. The image must be 640x480 or less. 640x400 leaves room at the bottom for the boot prompt. Save the image as a bmp format (in gimp you can save as ppm as well to skip the first conversion). Then run:
bmptoppm mylogo.bmp > logo16.ppm ppmtolss16 < logo16.ppm > logo.16
When using the script method Knoppix Remastering with Menu Based Scripts, the logo file will be located somewhere like:
<path-to-remaster dir>KNOPPIX.build/Knoppix.Master/KNOPPIX-CUSTOM/boot/isolinux
There are also some files in KNOPPIX.build/Knoppix.Master/KNOPPIX-CUSTOM/KNOPPIX/images that might be interesting to look at.
Desktop
To keep certain desktop settings persistent
I must now mention the file /etc/X11/Xsession.d/45xsession. This script controls how knoppix behaves & how knoppix creates the knoppix user's home directory.
Edit the file /etc/X11/Xsession.d/45xsession and look for the ninth occurence of rsync in the script and it is found at or around line 128:
126: if [ -z "$DONTCHANGE" ]; then 127: # No persistent homedir, copy everything 128: rsync -Ha --ignore-existing /etc/skel/{.kde*,Desktop} $HOME/ 2>/dev/null 129: [ "$USER" = "knoppix" ] && rsync -Ha --ignore-existing /usr/share/knoppix/profile/{.kde*,Desktop} $HOME/ 2>/dev/null
It is line 128 which populates the /home/knoppix folder. So In line 128, I delete from & including the { to the }. It is changed as follows.
126: if [ -z "$DONTCHANGE" ]; then 127: # No persistent homedir, copy everything 128: rsync -Ha --ignore-existing /etc/skel/ $HOME/ 2>/dev/null 129: [ "$USER" = "knoppix" ] && rsync -Ha --ignore-existing /usr/share/knoppix/profile/{.kde*,Desktop} $HOME/ 2>/dev/null
Make the change and save the 45xsession file.
Making a permanent desktop background change
Replace the <path to chroot env>/KNOPPIX.build/Knoppix.Master/KNOPPIX-CUSTOM/KNOPPIX/background.png from outside the chroot env to be the one you would like for the default desktop background.
Changing the desktop splash screen
Replace /usr/share/apps/ksplash/Themes/Default/splash_top.png
(400X248 px is the normal size of this image)
Adding Icons
Plonk them into /etc/skel/Desktop or if you are working under a knoppix home directory, plonk them there. Under any KDE or GNOME system you can find examples of the format for these files.
Startup
Adding init scripts that should run
Say you need to make sure certain services are started up at boot time. You would think you could put them in the proper /etc/rc<num>.d/ directory and they would just work eh. Ha. Ha. To get something to always start, you have to actually modify the /etc/init.d/knoppix-autoconfig script and have it start the services. The init scripts will always be in the /etc/init.d/ directory, but they won't stay in the /etc/rc<num>.d directories, even if you put them there. It will make you sad.
For example, to add a custom vpn script and turn on some of the NFS client utils, one could add some lines after the automounty stuff:
# Start automounter now /etc/init.d/autofs start >/dev/null && echo "${GREEN}Automounter started for: ${MAGENTA}${AUTOMOUNTS}${GREEN}.${NORMAL}" fi # # CUSTOM SCRIPTY STUFF # if [ -f /etc/init.d/portmap ] ; then /etc/init.d/portmap start >/dev/null && \ echo "${GREEN}Portmapper started" fi if [ -f /etc/init.d/nfs-common ] ; then /etc/init.d/nfs-common start >/dev/null && \ echo "${GREEN}NFS Common Services started" fi # Start VPN if [ -f /etc/init.d/vtundvpn ] ; then /etc/init.d/vtundvpn start >/dev/null && \ echo "${GREEN}VPN started" fi # # END CUSTOM SCRIPTY STUFF #
Making the CD fallback default language not German
Again, you want to modify the /etc/init.d/knoppix-autoconfig script and find where the LANGUAGE variable gets set. Change it to the desired default language (for example, from 'de' to 'us'.)