Andrew J. Nelson
Published: 16 September 2008
Revised: 26 November 2010
This How To explains converting a Slackware TGZ package into a Slax LZM module. We will be doing this with the Firefox 3.0 package. After incorporating the newly created LZM module into Slax, we will then configure Firefox and save the configuration changes as a second module. From here on out in this How To we assume that you are using Slax-6.0.7 on your USB flash drive.
We will try to go beyond the scope of the basic, "do this to accomplish that", step by step instruction set by educating the reader on some of the concepts and background integral to our objective.
This How To is written for anyone looking to go beyond the wonderful vanilla Slax-6.0.7 and modify it into a truly personal pocket operating system.
The Slax clover leaf, straight from Tomas' slax.org.
This How To assumes that the reader has Slax-6.0.7 installed on a USB flash drive of at least 1GB in size. If you need instruction on producing such a drive, please see How To: Install Slax On A USB Flash Drive. It is further assumed that the reader has a basic but solid grasp on navigating in a Linux shell environment and using commands to manipulate that environment. This How To specifies every needed command to complete the objective, but it does not explain the usage for all of them. Explaining basic Linux commands is beyond the scope of this document.
In our examples, we demonstrate the necessary commands as if we are the root user on a Slax install. Furthermore, we use the drive designation sdb1. If your username and/or drive designation is different, replace as needed.
This How To does not intend to explain how to make an official Slax module, rather it serves as introduction to the Slax user on how to add functionality they desire to their OS. WebGnuru takes no responsibility for any loss of data, hardware, time, hair, self esteem, or opportunities that may result from following the instructions in this How To.
A TGZ is a "package" used to install software onto a Slackware operating system. A TGZ package, as in somefile.tgz is occasionally and mistakenly thought to be the same thing as a .tar.gz file (a tarballed, gzipped file), such as somefile.tar.gz. This is not the case. A .tgz file extension is specific to inter-operability with the slackware pkgtool utility. A .tgz package is usually a precompiled binary file. To be clear, somefile.tgz is not the same thing as somefile.tar.gz.
An LZM module is the Slax parallel of a Slackware .tgz package: it is used to install software onto a Slax OS. The LZM module is a filesystem or directory compressed with the SquashFS tool using the LZM compression algorithm. What this amounts to is a very efficiently compressed directory/filesystem, ideal for an OS intended to fit on a CD or a USB flash drive.
You can learn more about SquashFS at tlpd.org's SquashFS How To. This Wikipedia article provides some good information on the Lempel-Ziv-Markov (LZM) chain algorithm. Of course, slax.org is the place to go for information on the Slax operating system. Last, linuxpackages.net can provide a wealth of Slackware packages, information on packages, and the purpose of the package providing community.
The Firefox logo. My favorite web browser!
An excellent resource for obtaining slackware packages is linuxpackages.net. To download the Firefox 3.0.1 package, go there, select the packages page, and use the letter browser to find F packages for Slackware 12.1.
This part of the process is far easier than one might assume: we simply use the tgz2lzm command. From the command line or console, navigate to the directory containing the download. Execute the command, then move the newly created module to your Slax modules directory. Last, since this is a USB flash drive and the available space is not limitless, remove the downloaded TGZ file. You can name the new file anything you want, but I recommend using the same name as the original package with the new .lzm file extension. This can save you trouble down the road.
tgz2lzm firefox-3.0.1p1-i486-1kjz.tgz firefox-3.0.1p1-i486-1kjz.lzm
mv firefox-3.0.1p1-i486-1kjz.lzm /mnt/sdb1/slax/modules/
That's it! You have created and installed your first Slax module. But before we move on, lets get a better understanding of what the modules/ directory does, and how Slax saves changes.
Risking the possibility of stating the obvious, the modules/ directory is one of three places where your Slax modules are stored, and is used for holding those modules that you want loaded every time you boot. Modules are also stored in base/ and optional/. The base/ directory contains those modules integral to the operating system, and which are not optional. The /optional directory can be used to house those modules which you occasionally use, but do not want automatically loaded every time you boot. Take a look at this Slax documentation to learn about options for loading modules after Slax has already booted, or to load modules from the optional/ directory at boot time with a boot parameter.
Understanding how Slax saves changes to the the filesystem is not quite as straight forward. I will begin by quoting the official Slax documentation on how changes are saved.
Thanks to the AUFS filesystem, the read-only part of Slax (system data and modules) is overlayed by a writable filesystem. You can modify all areas of the filesystem in Slax without any restrictions. Your changes to the read-only parts are transparently copied to the writable branch and stored in memory or in a persistent directory on your disk or even flash drive. Slax is designed to autodetect whether it runs from a writable media, and if that is detected, Slax will save all your changes there automatically.
What this boils down to is that Slax has a changes/ directory. When you make changes to the filesystem, Slax saves those changes to the changes/ directory without actually altering the read only portion of the filesystem. Then, everytime you boot up, it looks in changes/ and superimposes whatever is in there over the unalterable files.
The drawback of the way Slax makes persistent changes is that the changes/ folder can quickly become bloated, taking up a large portion of your drive, reducing performance, and making Slax behave in odd ways. A simple solution is to delete the entirety of the folder, restoring the file system to its virginal state. The downside of that is all of those pesky configuration changes that have accumulated during use are wiped out. This is the point where you say, "What the heck good is that? I don't want to reconfigure all my stuff! I might as well use a CD!"
The answer to that concern is: we will modularize your configuration changes, and we will facilitate this with the Slax Always Fresh boot mode. Slax Always Fresh does not load the changes/ directory at boot, so the filesystem is clean. Furthermore, any modifications that you make to Slax while in Always Fresh mode are not written to the permanent changes/ directory when you shut Slax down. Therefore, it is an excellent environment for creating a configuration module that won't be corrupted with irrelevant changes.
There are several benefits to saving your configuration changes to modules:
Making a module out of configuration changes might require a little planning. Ideally, it will include only those changes that are relevant to the objective. For instance, you don't want a bunch of cookies from random websites loaded into your module, so don't go web surfing while making your config changes. You also want to consider the platform you are using: a USB flash drive which is easily lost or invaded. Your configuration should take privacy and security into consideration. With that said, lets get down to business.
Restart Slax with the newly installed Firefox module. If necessary use the network-conf tool to set your IP and routing information. This info is the type of data we don't want saved into the config module, so we will delete it before we convert our changes into a module. Next, start Firefox, accept the license agreement, and open the preferences dialog.
Of course, your preferences will not be the same as mine. But here is an example of how I changed the default Firefox options, placing security and simplicity at the forefront.
Beyond the obvious options, a couple of configuration changes I like to make is to set the window size and position as I like it. I also add the Firefox icon to the desktop and the quick start menu.
Once you are done making changes, clear your private data so that no cookies are saved. Close Firefox, then clear any IP and routing information you may have set. At this point, the only changes in the system memory should be what you intend.
Let's summarize the process for making the config module. Navigate to the temporary changes directory. Convert that directory to an LZM module. Move that module to the modules/ directory and then reboot. The command to make a module out of a directory is
dir2lzm. The usage syntax is identical to tgz2lzm:
dir2lzm target_directory/ module_name.lzm. Here is the sample code.
dir2lzm changes/ z1_firefox3_config.lzm
mv z1_firefox3_config.lzm /mnt/sdb1/slax/modules
The module is complete! After you restart Slax your changes should be loaded. There are two last areas I would like to comment on. First, the naming convention I used for the module was developed from practical experience. Obviously, you can name your modules whatever you like, but I strongly encourage using a logical system like this one.
The last topic I want to touch on is the difference between the temporary and permanent changes/ directories. When we made the module, we did so in the temporary changes/ directory located in the live file system. Slax keeps the all the changes you make during your session in memory in that directory. When you close Slax, those changes are then written to the permanent changes/ directory in the root slax/ directory.
I hope that this How To provided a clear and consise method for creating a Slax LZM module from a Slackware TGZ package. The process illustrated with the Firefox package can be translated to converting just about any package, from Apache to Lynx.
If you have any questions, concerns, suggestions, or constructive criticism, please email me.