Installing and Removing Software


You can use the extracted files to install and remove software from Knoppix. All files from the Knoppix ISO are now available via /home/knoppix/knoppixiso, and the files that were in the KNOPPIX/KNOPPIX file are available in /home/knoppix/knoppixuncompressed.

To begin, chroot (change the root directory) into the extracted filesystem:

 # chroot /home/knoppix/knoppixuncompressed 

This means that you will see the /home/knoppix/knoppixuncompressed directory as your new root filesystem. You now have a shell that has access only to the files in /home/knoppix/knoppixuncompressed.

To install certain packages, you need to mount the proc filesystem inside the chroot:

 # mount -t proc /proc proc 

You will get a warning (warning: can't open /etc/fstab: No such file or directory.), which you can safely ignore.

Test whether your Internet connection works by pinging a server:

 # ping slashdot.org 

If you receive replies, congratulations! You have a connection with the Internet from within the chroot and can start using apt-get to install new software.

If you didn't get a reply, you'll have to add your DNS nameservers to /etc/resolv.conf. Open the file using vim or a different text editor:

 # vim /etc/resolv.conf 

For each nameserver, add an entry:

 # nameserver 0.0.0.0 

where 0.0.0.0 is your nameserver. Save the file and try pinging again to make sure your connection works. You need it if you want to install new software from the Internet using apt-get.

Using apt-get

First, update apt-get's package lists so it will know which new packages are available:

 # apt-get update 

Now you can install packages at will. For example, use this to install the latest version of AbiWord:

 # apt-get install abiword 

Similarly, use the following to install the newest Firefox Web browser:

 # apt-get install mozilla-firefox 

Naturally, you can also remove packages, which is necessary if you want to install additional packages. If you don't free up enough space for your new packages, your final Live CD won't fit on a CD! The following removes OpenOffice:

 # apt-get remove openoffice.org* 

Adding * to the command catches all of the packages.

Afterward, you have to clean up inside the chroot:

 # apt-get clean # umount /proc 

After you are done, simply exit the chrooted shell.

Other Customizations

You can make several other common modifications to a Knoppix Live CD. The following sections explore some of them.

Setting Passwords

Setting the initial passwords of the knoppix and root users is simple. To set the knoppix user password, execute the following in the chroot:

 # passwd knoppix 

To set the root user password, execute the following:

 # passwd 

Enter and confirm the password. Setting these passwords on a Live CD that is distributed and used "in the wild" isn't as good an idea as it might seem. In Knoppix, with the knoppix user able to execute commands directly using sudo, you want to avoid anyone being able to log into Knoppix remotely over a network. Although Knoppix itself can't be tampered with permanently by a remote user, it is possible for such a user to access the hard disk or other media on the computer that is running Knoppix.

Picking a Different Background

Changing the default background is easy once you have uncompressed the KNOPPIX file. The location of the background used in Knoppix is /usr/local/lib/knoppix.jpg in the chroot. You can overwrite this file simply by overwriting this image:

 # cp mybackground.jpg /home/knoppix/knoppixuncompressed/image from book    usr/local/lib/knoppix.jpg 

You can overwrite this image with an image of any format.

Changing the Boot Screen

The Knoppix boot screen is set up in the /home/knoppix/knoppixiso/boot/isolinux directory. Three files are of interest:

  • isolinux.cfg: The configuration of the isolinux bootloader. Isolinux provides the initial boot screen and starts the Knoppix boot process. This file can be edited directly using any editor.

  • boot.msg: The text section of the boot screen. You can use any editor to modify this file, too.

  • logo.16: The image shown at boot time. It is more difficult to modify. logo.16 in the LSS16 image format, which is designed especially for isolinux and its counterpart, syslinux. To convert an image to this format, you must first save the image in the Gimp as a.ppm file. Then:

 # ppmtolss16 < myimage.ppm > /home/knoppix/knoppixiso/image from book    boot/isolinux/logo.16 

myimage.ppm must be a 640 ´ 480 16-color image. Any other image, and isolinux refuses to show an image, so getting this right will take some practice.

Setting Languages

In the isolinux.cfg file, introduced in the preceding section, you can define the default cheatcodes used for booting Knoppix. These cheatcodes are the ones that can normally be entered on the command line right before Knoppix boots from the Live CD and displays the boot screen.

Open the isolinux.cfg file with your favorite text editor and locate the lines that start with APPEND. On these lines you'll see a cheatcode in the form lang=us or lang=de. Changing this to another language's two-letter abbreviation changes the default language used on the Live CD.

Note that setting the cheatcode doesn't always work. Certain programs, such as KDE, OpenOffice.org, Mozilla, and Mozilla Firefox, don't have all language packs installed by default. If you want to have a completely translated Live CD, you will have to install these, similar to installing new software as described in the section "Installing and Removing Software" earlier in the chapter. For example, if you want to install the Dutch language package for KDE, you'd execute the following in the chroot:

 # apt-get install kde-i18n-nl 

Similarly for Mozilla Firefox:

 # apt-get install mozilla-firefox-locale-nl-nl 

Creating translated Knoppix Live CDs isn't very complicated after you've mastered the installing of software in Knoppix; however, language package names differ per software package. If you aren't sure, start synaptic to search for software package names and their language package counterparts. Not every language will be available.

Choosing a Different Desktop Environment

A lot of simple hacks are possible using the Knoppix cheatcodes. Knoppix comes with a number of desktop environments pre-installed, and you can use the desktop cheatcode for altering the desktop environment Knoppix starts.

Say, for example, that you want to start with icewm, a quick desktop environment suited for older machines, by default. Change the isolinux.cfg file APPEND lines to include desktop=icewm.

If you don't want to use the cheatcodes to easily modify your Live CD, you have to modify the Knoppix startup files. In that case, open from within the chroot the /etc/init.d/ knoppix-autoconfig file with a text editor. This shell script contains the largest part of the boot process and starts a lot of other programs for hardware detection and the like. On line 483 of this file is a case statement defining the way the desktop cheatcode is used in Knoppix. If you want to change the default in this way, modify

 DESKTOP="kde" 

to

 DESKTOP="icewm" 

Modifying the default desktop environment is, of course, more complicated if that desktop environment isn't installed in Knoppix to begin with! In that case, you also have to install the environment you want. For example, to install the XFCE4 desktop environment, simply execute

 # apt-get install xfce4 

from within the chroot. This installs the XFCE4 desktop environment and all the dependencies it requires. Remember to free up a corresponding amount of space or your Live CD won't fit on a CD! One of the largest challenges in remastering Knoppix is making sure the Live CD contains everything you need and is still small enough to fit on the CD.



Hacking Knoppix
Hacking Knoppix (ExtremeTech)
ISBN: 0764597841
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net