Chapter 20. Tips and Answers to Questions

Table of Contents

What is Linux?
How does Free Software affect Linux?
The Role of the Community
Running Linux
The Linux File System
Working with Processes
Configuring a Linux Kernel
Hardware Support
Software Management
User Management
Network Management
Service Management
Storage Management
System Management
Introducing the Graphical Environment
Installing Gentoo Linux

What is Linux?

  1. You can find information about various Linux distributions at DistroWatch. Also, Wikipedia has a List of Linux Distributions. However, you will most likely have to look at the homepage of each distribution to learn how they perform in the fields you find important.

  2. A small list of CPU architectures is:

    • For the embedded market, popular architectures are MIPS and ARM

    • For the desktop market, Intel x86 and related architectures (IA-32, x86-64, AMD64) have almost monopolized the market. POWER (formerly known as PowerPC and IBM POWER) has been used on desktop environments (most notably by Apple)

    • For the server market, Sun SPARC and HP PA-RISC are trying to keep their market share, although systems with Intel's Itanium (IA64) are forcefully growing in the server market.

    • For the more specialized market, IBM's Cell architecture (which is actually a mix of POWER4 and RISC-based coprocessors) is a nice example (used in Sony's Playstation 3)

    • In the mainframe market (which is almost fully delivered by IBM) the z/Architecture is well known through its use by the IBM zSeries mainframes

  3. New kernel releases are made by the kernel maintainers of that particular tree (for instance, the vanilla tree is managed by Linus Torvalds). At this point, the source code for the new kernel is made available tagged with the specific version number (the source code for the Linux kernel is always available, you can even obtain the at that time development version which might be changed the second after you've downloaded it - look for the linux-2.6 git repository).

    Distributions then obtain the source code and start building kernels based on generic kernel configurations, often with additional software code patches applied. The result of the distribution builds are packages containing the Linux kernel together with many kernel modules (dynamically loadable parts of the Linux kernel) which are then tested by many users. This testing is possible because the Linux kernel will not (by default) load a Linux kernel module that isn't needed or where the system doesn't have the necessary hardware.

    When a kernel built has been thoroughly tested, the kernel build is distributed to the distribution users (or, in case of source code based distributions, the patched source code is distributed).

How does Free Software affect Linux?

  1. You can find information about GPL at the GNU site.

  2. A few examples of operating systems that use the ELF format or where the format is heavily based upon ELF are those used by the Sony PlayStation Portable/2/3 and the Nintendo Wii.

  3. Many software projects still support older versions of the software. For instance, at the time of writing, the KDE project still supports version 3.5 even though 4.2 is being developed and 4.1 is considered the latest stable one. All efforts put in the 3.5 series are bugfixes and security fixes but no new features.

    Distributions that want to offer a stable software stack tend to use these software versions rather than the latest available ones. Although their users lag behind on features, their software stack is quite stable.

  4. Upgrading a distribution means upgrading the packages offered by the distribution. Now, these packages are not heavily depending upon each other: you can upgrade one package without requiring to upgrade all other packages (although perhaps dependencies need to be pulled in). And because this software is freely available on the Internet, there is no license cost attached to it.

    Whenever a distribution makes a new release, it is often accompanied with a list of "new" supported software. Users of that distribution can then just start upgrading their packages to the "new" software without requiring any reinstall.

    Distributions do make new releases often, but this is mostly because the installation media itself (installation CD and tools) are updated to fit the latest hardware available.

The Role of the Community

  1. The Gentoo Linux distribution offers the discussion mediums discussed in this chapter:

    • The Gentoo Linux Forums are heavily used (over a thousand postings a day) web forums

    • Gentoo hosts its mailing lists itself - you can find an overview of the available mailing lists online

    • On the Freenode IRC network, Gentoo has a few official chat channels, including the generic #gentoo channel

    There is also the official Gentoo Wiki.

Running Linux

  1. Organising your home directory should not be taken lightly. By using a good structure you can easily backup important documents, access files you often need and still keep a good overview.

    For instance, to create the directories as given in the exercise:

    $ mkdir doc pics work tmp

    With this simple structure, the most important directory would be doc (personal documents) and perhaps work. You most likely do not want to back up the temporary files (tmp) and the pics folder might require a lower frequency on backups.

    Of course, you should attempt to use a structure you find the most appealing.

  2. The tar command allows you to group multiple files (and directories) into a single file (archive). It is originally created to allow administrators to back up multiple files on tape (tar is most likely short for "tape archive"). A tar file is not compressed - it is merely a concatenation of the files with additional metadata about the files (such as filename, permissions, ...).

    This is where the gzip/bzip2 compression comes in: these compression methods do not support archiving, so one should first archive the files together in a tar file and then compress the tarfile using gzip or bzip2. gzip is the most used as it offers a fast compression algorithm. bzip2 is popular too because it has a higher compression rate.

    The combination result of tar with gzip/bzip2 creates what is called a tarball. These usually have the extension .tar.gz (or .tgz) for gzip, or .tar.bz2 for bzip2.

    Another compression utility is provided by the compress command. Just like gzip/bzip2 it compresses a single file; its extension is .Z (so a tarball would yield .tar.Z as an extension). compress is the oldest method of these four (compress, zip, gzip, bzip2) and supported on all Unix and Unix-alike operating systems.

    Other compression utilities come and go as well. If you are interested in compression utilities, take a look at the lha, 7z, lzma and xz commands to name a few.

  3. Photorec is a software tool that allows you to recover removed files from a file system. In Gentoo, you can install this tool through app-admin/testdisk.

The Linux File System

  1. The command to recursively change a mode can be found in the manual page of chmod:

    $ man chmod

    In effect, the command could be:

    $ chmod -R o-r tmp/test

    All underlying directories (test/to, ...) will be changed as well.

  2. The /tmp directory is world-writable, but has a specific flag set: the sticky bit. Check out the manual page of chmod to find out why a possible solution to this question would be:

    $ chmod 1777 tmp

Working with Processes

  1. There are quite a few possibilities to obtain a process id.

    The first one is to obtain an entire listing of all processes and grep out those you are interested in. The output's second column then displays the process' ID.

    $ ps -ef | grep firefox

    Another method is to use the pidof command. The disadvantage is that you need to know the process name exactly (not just a part of it):

    $ pidof firefox-bin

    If you have /proc available, you can search through all /proc/<pid> directories and read out the cmdline file:

    $ grep firefox /proc/*/cmdline
  2. Although many possibilities exist, two are quite popular: nohup and screen.

    With nohup, you tell the operating system that the process should not be terminated (nohup = no hang-up) when the session is terminated. However, a process launched with nohup can only be put in the foreground as long as the session is running. The moment the session is terminated, the process still remains active but you wont be able to put it back to the foreground. You should see nohup as a means to make a process behave like a daemon.

    With screen, you can run processes in named sessions, detach sessions from your terminal and reattach those sessions in a different terminal. The screen command is quite popular in command-line environments because you have such flexibility at hand (you can launch a command-line chat on a server inside irssi, detach from your terminal, go elsewhere, log on to the server and reattach to the screen session to continue the chat).

  3. A defunct process is a process that cannot communicate with its parent or child for who knows what reason. Unlike zombie processes (who don't really exist), defunct processes still exist but are just... well... defunct. To remove defunct processes from the system, see if they have running child processes and terminate those first (it happens that a defunct process can recover when the child processes are terminated). If not, terminate its parent process (just like you would for a zombie process).

Configuring a Linux Kernel

  1. Many bootloaders support what is called "chaining". When a bootloader is asked to boot an operating system through another bootloader, it hands over the CPU control to the other bootloader. This however requires that the other bootloaders' code is still available (for instance on a certain partition).

    Chaining is frequently used to boot Windows from a Linux boot loader (LILO or GRUB); the Windows boot loaders' code is available on the Windows' partition (so doesn't need to reside in the MBR).

Hardware Support

No exercises for this chapter yet.

Software Management

  1. One alternative package manager is called Paludis, another is pkgcore.

  2. Various locations for USE flag definitions are the system profiles (pointed to by /etc/make.profile), make.conf, /etc/portage/package.use and the environment variable set in the user's session.

  3. Gentoo's architecture testing program is brought to life to assist package developers with the time-consuming testing of packages for every supported architecture. Each architecture has its own AT (arch tester) staff. For more information, Google for "gentoo arch testers".

User Management

  1. By default, sudo logs to the system logger, so you'll find it either on the messages console or general messages file. You can alter this behaviour in sudo if you wish (see man sudoers).

Network Management

No exercises for this chapter yet.

Service Management

No exercises for this chapter yet.

Storage Management

No exercises for this chapter yet.

System Management

No exercises for this chapter yet.

Introducing the Graphical Environment

No exercises for this chapter yet.

Installing Gentoo Linux

No exercises for this chapter yet.