# Questions and Answers for November 2003

### Objectives

• RPM - what they are and how to work with them
• Mount CDImages - How to use the loop device to work with iso images.
• X for Cygwin - How to get it going.
• Updating the Kernel in Redhat
• What is happening with Distributions - The companies selling Linux distributions are changing, how does that affect us users.

Todays Linux class will attempt to answer some of the topic question I collected in a class in the fall. We will go through them in the order I wrote them down. Finally, we will discuss some changes in the distribution landscape for Linux. How does it affect us, and how to pick a distribution.

### RPM

RPM (Redhat Package Manager) is a tool to install, update, rebuild, and remove applications from Linux.

When Unix was first coming into use there was a need to archive files in a format easy to backup. One of the original tools for this purpose was tar Tape Archive Routine. This tools is given either a list of file, or a directory as input. It then copies the files into a single file. If you do not compress a tar file, you can open it in an editor a view the individual files. So tar’s main purpose was to create an archive preserving their directory structure. If uncompressed, a tar archive is the same size as the original files.

The next improvement was to compress the archive. Originally this was done with the program Compress, and uncompressed with Uncompress. The problem with these two programs was that they were proprietary. The next format which came along was zip . Again originally proprietary, but since taken into an open source version. The GNU people then created the compress/uncompress programs gzip/gunzip, which are actually a single program. The next step was to teach tar to use the gzip program internally. There is also the newer compression program bzip2, which is superior to all the previous ones in terms of small size.

The reason for this discussion of tar is that it was the original way to distribute application packages. A package, in this context is an executable file, any associated libraries, and documentation. When I first installed a Slackware distribution, this is how the applications were packaged.

Advantages: The format is pretty universal. A tar package created on AT&T Unix, can be read on HPUX. This is not always true, but usually. The files are compressed, and contain both the files and the location information in a single file.

Disadvantages: The package has to be installed from a given location. ie. if the archive writes to bin/zinf you could start in the directory / or the directory /usr/local, or some where else. The package does not include any information to allow removal or updating of the package. Finally there is no information on dependencies, ie. you must have library X installed before you can use this application.

Redhat looked at these issues and decided that it needed something more robust for installing and managing the packages needed in their distributions. Originally, I think RPM was a set of perl scripts. Today the RPM format is used by Redhat, Suse, Mandrake, Yellow Dog, and other distributions. Redhat has created a web site www.rpm.org to manage and continue implementation of the RPM application. The best reference for learning about how to build and use RPMs is Maximum RPM book. It is a fairly complete description of the package manager and how to work with RPMs.

#### How to use RPM

So what can RPM do and how do I use it for day to day use.

First lets talk about what RPM does. It can install packages, uninstall packages, check dependencies, update packages, and maintain a database of what is on your system which were added or modified with the RPM package manager.

RPM packages names contain the basic information about the package. Lets look at a package to understand how this works. I will use the rpm package pdmenu-1.2.69-5mdk.i586.rpm as an example.

First look at the name of the package. It shows the package name as pdmenu. The version is 1.2.69 and this is rpm 5 of that version. It was compiled for the Mandrake distribution, and is for the i586 processor family. The other common name you find in place of processor family is src, meaning source package. So now we have some information about the package we are viewing. Lets use RPM to see what else we can learn about this package. I ran the command rpm -qip pdmenu-1.2.69-5mdk.i586.rpm to get the following results.

    Name        : pdmenu                       Relocations: (not relocateable)
Version     : 1.2.69                            Vendor: MandrakeSoft
Release     : 5mdk                          Build Date: Mon 05 May 2003 12:21:56 PM EDT
Install Date: (not installed)               Build Host: bi.mandrakesoft.com
Group       : Shells                        Source RPM: pdmenu-1.2.69-5mdk.src.rpm
Signature   : (none)
Packager    : Lenny Cartier <lenny@mandrakesoft.com>
Summary     : A simple text-based menu program
Description :
A simple full screen menu program, intended to be a comfortable login shell for
inexperienced users.

This is the information on the package. The options I used were -qip or query, information package. This is the easy to see the information from a package. If the package were installed on your system the command would then be rpm -qi pdmenu . Next we can use the command rpm -qlp pdmenu-1.2.69-5mdk.i586.rpm to see what files are included in the package.

    /etc/pdmenurc
/usr/share/man/man5/pdmenurc.5.bz2

This is a list of the files included in the package, and where they will be installed. Again if the package was installed on your system the command would be rpm -ql pdmenu .

Lets do a brief introduction of how to use RPM. I will assume you are in the directory which contains the packages, so I will use ./ for the directory to the package.

• Install Packages

When you want to add a package to your system, you use the -i or –install option. I tend to use the command rpm -ivvh <package> . This says install, extra verbose output, and hash marks as the files are installed.

When you want to upgrade a package you can download a newer version and run the command rpm -Uvvh <package> or rpm -Fvvh <package> . The difference between -U and -F is upgrade will install the package if it does not exist, but Freshen will only upgrade an existing package.

One issue that often comes up during an Upgrade is dependences. If a package has dependences it will give you a message something like:

              error: failed dependencies:
libqt.so.3 is needed by opera-7.22-20031103.3

This is RPM’s way of telling you that it needs another package updated before you can install this one. The easiest way to deal with this situation is to upgrade the specified package.

• Remove

One of RPM’s real strengths is it’s ability to completely remove a package from the system. In windows the install shield program can remove the files, but the registration information is left behind. This might not sound like a big deal but it can definitely hose a windows system.

• Query

Since the RPM system keeps a record of all the packages stored on your system you can lookup all the package information without needing the package. The command rpm -qa will produce a list of all the packages on your system. You can check for an individual package by name or by using grep, as in rpm -qa | grep -i perl . That will find all the rpm packages related to perl. Finally the command rpm -qf <filename> will tell you which package contains <filename>. This is useful if you have a file and want to know where it came from.

Another strength of the RPM system is to allow it to build a package on your computer using the libraries and files you have installed. The way this works is by starting with a Source package like: pdmenu-1.2.69-5mdk.src.rpm . Notice that part of the name is src. This means that the package contains the source code. You can use the command rpmbuild –rebuild <packagename> to install the package under /usr/src/redhat, then invoke the compiler to build a binary RPM package which will be available in /usr/src/redhat/RPMS/i386 when it finishes. You can then install the binary package on your system.

For a more hands on approach to RPM let me again recommend Package Management from the Redhat Manual 9.0.

The rpm program has many more options than can reasonably be handled in one lesson. I recommend you read through the man page, or if you want more details, have a look at Maximum RPM listed above.

If you are interesting in an article which discusses the Good, the Bad, and the Ugly of RPM have a look at this article: Is RPM doomed?.

### Mount CDImages

Lets suppose you have just downloaded a new ISO image and want to have a look at it before burning it on a CD. Lets assume the image is called /tmp/magic.iso.

You could start by creating a directory named /mnt/magic. You would then use the command mount -v -t iso9660 -o ro,loop=/dev/loop0 /tmp/magic.iso /mnt/magic. This uses a device known as the loop back device or /dev/loop to mount a CD file image onto your directory tree. This is a good way to examine a CD image you created or downloaded.

Lets suppose you have a set of mp3 files and want to burn them into a CD for easy storage or playing. Here are the steps you could use to accomplish this task.

1. Create a directory somewhere to store the information before creating the ISO image. Lets use the directory /tmp/mymusic.
2. Copy all the files you want on the CD to the directory /tmp/mymusic. Keep track of the size since you want it to fit on a CD. I usually stop about 640 Meg, even though many CDs today take 700 Meg.
3. Next, as root, from the directory /tmp, you can use the command: mkisofs -r -l -v -allow-lowercase -allow-multidot -o mymusic.iso mymusic to create the iso image file mymusic.iso.
4. Now lets suppose you want to examine the image you just created. You could mount the image file to the directory /mnt/test with the command mount -v -t iso9660 -o ro,loop=/dev/loop0 /tmp/mymusic.iso /mnt/test .
5. Finally, as root you could use the command: cdrecord -v speed=4 dev=0,3,0 -data /tmp/mymusic.iso to burn the CD. This assumes the device name, and speed are correct for your computer.

### X for Cygwin

The Xwindows package for cygwin can be downloaded with the setup program. It is now included in the distribution. Once it is installed you run the command startx to start it. If you would like a better window manager than the default TWM, I would recommend Xfce. You can download Xfce from Dream Wiz . Once you have the package you untar it and tweak the startup file if you want.

### Updating the Kernel in Redhat

This operation is not for the faint of heart. If you make a mistake during the upgrade, you may need to re-install the entire system. But before you do an upgrade, ask yourself, why are you upgrading the kernel instead of the whole distribution? If you want to optimize the kernel or modify the list of drivers you would be better to build rebuild the kernel and install a second kernel rather than upgrade.

If you want to upgrade, you best source of information is directly from Redhat. Assuming you are using Redhat 9.0 have a look at the web page Preparing to Upgrade . This page plus the following pages will walk you through the upgrade process.

For myself, I usually like to build a new kernel, and install that one. The compile takes a while, but the most difficult part is selecting what drivers you want. To build a new kernel follow the steps in Building a Custom Kernel. The advantage of this method is you can have multiple kernels available for booting. By using this method, you can select with Lilo or grub which kernel to boot by default. So if something goes wrong with the build or install, you can simply boot back into your existing kernel and fix the problem. This is both safer and achieves the same results. I would recommend this method if you want to upgrade your kernel.

### What is happening with Distributions

I don’t know how many of you are up on what is happening in the Linux Distribution scene, but I found these two issues interesting.

1. Redhat is getting out of the Home User distribution business

Here is a quote from an Email sent to some Redhat Users: “As previously communicated, Red Hat will discontinue maintenance and errata support for Red Hat Linux 7.1, 7.2, 7.3 and 8.0 as of December 31, 2003. Red Hat will discontinue maintenance and errata support for Red Hat Linux 9 as of April 30, 2004. Red Hat does not plan to release another product in the Red Hat Linux line.”

Redhat has setup a community distribution site known as Fedora , to continue the community involvement in Redhat.

2. Novell to purchase Suse Linux distribution company.

From a news article on the Novel purchase of Suse: “Now that the initial reactions to Novell’s US\$210 million acquisition of SuSE Linux have passed – and questions on the who, what, when and how much of the deal have been answered – the broader implications are beginning to hit home in the Linux community.

In order to place these two news issues into perspective lets have a look at Linux and what is a distribution anyway.

One of the first issues to keep in mind is that Linux is in fact only the kernel. What Linus created was a Unix like kernel, which when combined with the GNU tools already existing, constitute what most people today mean when they talk about a Linux system.

So in reality what we mean by a Linux system is a combination of software from many sources. So then a distribution is really a collection of applications which have been selected and compiled to sing and dance together. Given this loose definition we can understand how there are so many Linux distributions available. Some of the best known ones are RedHat, Suse, Debian, Mandrake, Gentoo, Koppix, among many others. Each of these distributions starts with a pool of source code and compiles a set of application to make a working system. Given the flexibility of the Linux system it is not surprising that there are so many distributions. Each company thinks they can do something better than anyone else has done it. This entrepreneurial spirit is what makes for interesting times, and some confusion.

So why should we care if the landscape in the distribution market is changing shape? Other than the amusement value of watching the board being reshuffled, it gives us an excuse to discuss what separates one distribution from another. So with that intro, lets talk about the difference between distributions to get a better understanding of what goes into a creating a distribution.

Now lets be clear, I have no intention of going through all the issues involved, but some a discussion of some general issues will open the door to a better understanding of how to choose a distribution which suits your needs.

#### Distribution Elements of interest

Please understand these are my opinions, you are welcome to disagree with me, or present your own views. After all this is a users group, not a classroom.

How easy is the distribution to install?
One area where there has been great strides in Linux is the ease of installation. The more of your system that can be automatically detected, the easier it is to get working in the first place. One of the early pioneers in this area was Caldera. At one time they had the smoothest install of anyone. Since then others have done the work of catching up. This will always be an area of growth because the hardware continues to change.

How easy is it to add, remove, and update applications?
This is one area where most distributions have opted for one of three methods. Several distributions use the RPM method. Another method is the Deb package handler from debian. Finally some distributions continue to use tar. Each has it’s strengths and weaknesses. I tend to prefer RPM for now, but I am going to explore the Deb system.

Does the distribution include application you want?
If you have specific needs from a distribution, it is a good idea to check that you can get the application you want on it. Now to be honest, you can add most Linux programs to any distribution, but it might be more difficult with some. For example, I have a sun Sparc Ultra 5 at work. I had installed Suse on the box and I wanted to compile Mozilla for that box. I tried twice, and kept running out of space on the system before the package completed compiling. It was using 1.5 gig of disk space with out coming to the end of the compile. I finally gave up and found a copy of Konqueror to work on the system.

Can you get help from other users?
This is where popularity of the distribution come in. If you are using a Redhat distribution, there are plenty of people who can probably answer your configuration questions. But if you are using the Linux From Scratch, you might have more trouble getting information. The more obscure your distribution, the harder it will be to get help. Note I am ignoring support services by the distribution company. That is good for businesses, but most individuals do not want to pay for this type of support.

How easy is the distribution to upgrade?
One of the selling points to many distributions is the ability to upgrade without reinstalling. This can be a strong point if you do not want to spend the time or effort of reinstalling your OS. This is one place where Linux is starting to exceed Windows. Given some of the auto update tools available, you could keep a large group of users up to date, without them doing anything. But for the individual person this can also be a strong point. Debian goes so far as to say, you will never need to install again if you use their upgrade tools. Could be very appealing to some users.

How technically savvy is the system user?
Unlike windows, which wants to treat everyone as a dumb user, Linux distributions are often aimed at different skill levels of users. Debian and Gentoo are not for naive users. This does not mean that some distributions discourage skilled users, it just means that some will require more skill than others. Lindows claims to be the most idiot proof. But with any distribution there are trade offs.

OK you have heard enough of my opinions, what are yours?