The Debian GNU/Linux FAQ - Customizing your installation of Debian GNU/Linux

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ next ]

# The Debian GNU/Linux FAQ
Chapter 11 - Customizing your installation of Debian GNU/Linux

## 11.1 How can I ensure that all programs use the same paper size?

Install the `libpaper1` package, and it will ask you for a system-wide default paper size. This setting will be kept in the file `/etc/papersize`.

Users can override the paper size setting using the `PAPERSIZE` environment variable. For details, see the manual page `papersize(5)`.

## 11.2 How can I provide access to hardware peripherals, without compromising security?

Many device files in the `/dev` directory belong to some predefined groups. For example, `/dev/fd0` belongs to the `floppy` group, and `/dev/dsp` belongs to the `audio` group.

If you want a certain user to have access to one of these devices, just add the user to the group the device belongs to, i.e. do:

         adduser user group

This way you won't have to change the file permissions on the device.

If you do this from within a user's shell or a GUI environment you have to logout and login again to become an effective member of that group. To check which groups you belong to run `groups`.

Notice that, since the introduction of `udev` if you change the permissions of a hardware peripheral they might be be adjusted for some devices when the system starts, if this happens to the hardware peripherals you are instered in you will have to adjust the rules at `/etc/udev`.

## 11.3 How do I load a console font on startup the Debian way?

The `kbd` and `console-tools` packages support this, edit `/etc/kbd/config` or `/etc/console-tools/config` files.

## 11.4 How can I configure an X11 program's application defaults?

Debian's X programs will install their application resource data in the `/etc/X11/app-defaults/` directory. If you want to customize X applications globally, put your customizations in those files. They are marked as configuration files, so their contents will be preserved during upgrades.

## 11.5 Every distribution seems to have a different boot-up method. Tell me about Debian's.

Like all Unices, Debian boots up by executing the program `init` [6]. The configuration file for `init` (which is `/etc/inittab`) specifies that the first script to be executed should be `/etc/init.d/rcS`. This script runs all of the scripts in `/etc/rcS.d/` by forking subprocess to perform initialization such as to check and to mount file systems, to load modules, to start the network services, to set the clock, and to perform other initialization.

After completing the boot process, `init` executes all start scripts in a directory specified by the default runlevel (this runlevel is given by the entry for `id` in `/etc/inittab`). Like most System V compatible Unices, Linux has 7 runlevels:

- 0 (halt the system),

- 1 (single-user mode),

- 2 through 5 (various multi-user modes), and

- 6 (reboot the system).

Debian systems come with id=2, which indicates that the default runlevel will be '2' when the multi-user state is entered, and the scripts in `/etc/rc2.d/` will be run.

Debian uses dependency-based boot ordering through `insserv`, using the LSB headers in each script under `/etc/init.d/`, as well as parallel concurrent booting through the use of `startpar` to speed up the boot process.

The scripts in any of the directories, `/etc/rcN.d/` are just symbolic links back to scripts in `/etc/init.d/`. However, the names of the files in each of the `/etc/rcN.d/` directories are selected to indicate the way the scripts in `/etc/init.d/` will be run. Specifically, before entering any runlevel, all the scripts beginning with 'K' are run; these scripts kill services. Then all the scripts beginning with 'S' are run; these scripts start services. The two-digit number following the 'K' or 'S' indicates the order in which the script is run. Lower numbered scripts are executed first.

This approach works because the scripts in `/etc/init.d/` all take an argument which can be either `start', `stop', `reload', `restart' or `force-reload' and will then do the task indicated by the argument. These scripts can be used even after a system has been booted, to control various processes.

For example, with the argument `reload' the command

         /etc/init.d/sendmail reload

sends the sendmail daemon a signal to reread its configuration file.

Note that `invoke-rc.d` should not be used to call the `/etc/init.d/` scripts, `service` should be used instead.

## 11.6 What other facilities are provided to customize the boot process besides `rc.local`?

The `rc.local` script is executed at the end of each multiuser runlevel. In Debian it is configured to do nothing. This provides customisation of the boot process, but might not be sufficient for all situations.

Suppose a system needs to execute script `foo` on start-up, or on entry to a particular (System V) runlevel. Then the system administrator should:

- Enter the script `foo` into the directory `/etc/init.d/`.

- Run the Debian command `update-rc.d` with appropriate arguments, to specify which runlevels should start the service, and which runlevels should stop the service.

- Consider rebooting the system to check that the service starts correctly (assuming that you've asked for it to be started in the default runlevel). Otherwise, manually start it by running ``/etc/init.d/foo start`'.

One might, for example, cause the script `foo` to execute at boot-up, by putting it in `/etc/init.d/` and running `update-rc.d foo defaults 19`. The argument ``defaults`' refers to the default runlevels, which means (at least in absence of any LSB comment block to the contrary) to start the service in runlevels 2 through 5, and to stop the service in runlevels 0, 1 and 6. (Any LSB Default-Start and Default-Stop directives in `foo` take precedence when using the sysv-rc version of update-rc.d, but are ignored by the current (v0.8.10) file-rc version of update-rc.d.) The argument ``19`' ensures that `foo` is called after all scripts whose number is less than 19 have completed, and before all scripts whose number is 20 or greater.

## 11.7 How does the package management system deal with packages that contain configuration files for other packages?

Some users wish to create, for example, a new server by installing a group of Debian packages and a locally generated package consisting of configuration files. This is not generally a good idea, because `dpkg` will not know about those configuration files if they are in a different package, and may write conflicting configurations when one of the initial "group" of packages is upgraded.

Instead, create a local package that modifies the configuration files of the "group" of Debian packages of interest. Then `dpkg` and the rest of the package management system will see that the files have been modified by the local "sysadmin" and will not try to overwrite them when those packages are upgraded.

## 11.8 How do I override a file installed by a package, so that a different version can be used instead?

Suppose a sysadmin or local user wishes to use a program "login-local" rather than the program "login" provided by the Debian `login` package.

Do not:

- Overwrite `/bin/login` with `login-local`.

The package management system will not know about this change, and will simply overwrite your custom `/bin/login` whenever `login` (or any package that provides `/bin/login`) is installed or updated.

Rather, do

- Execute:

           dpkg-divert --divert /bin/login.debian /bin/login

  in order to cause all future installations of the Debian `login` package to write the file `/bin/login` to `/bin/login.debian` instead.

- Then execute:

           cp login-local /bin/login

  to move your own locally-built program into place.

Run `dpkg-divert --list` to see which diversions are currently active on your system.

Details are given in the manual page `dpkg-divert(8)`.

## 11.9 How can I have my locally-built package included in the list of available packages that the package management system knows about?

Execute the command:

         dpkg-scanpackages BIN_DIR OVERRIDE_FILE [PATHPREFIX] > my_Packages

where:

- BIN-DIR is a directory where Debian archive files (which usually have an extension of ".deb") are stored.

- OVERRIDE_FILE is a file that is edited by the distribution maintainers and is usually stored on a Debian FTP archive at `indices/override.main.gz` for the Debian packages in the "main" distribution. You can ignore this for local packages.

- PATHPREFIX is an optional string that can be prepended to the `my_Packages` file being produced.

Once you have built the file `my_Packages`, tell the package management system about it by using the command:

         dpkg --merge-avail my_Packages

If you are using APT, you can add the local repository to your `sources.list(5)` file, too.

## 11.10 Some users like mawk, others like gawk; some like vim, others like elvis; some like trn, others like tin; how does Debian support diversity?

There are several cases where two packages provide two different versions of a program, both of which provide the same core functionality. Users might prefer one over another out of habit, or because the user interface of one package is somehow more pleasing than the interface of another. Other users on the same system might make a different choice.

Debian uses a "virtual" package system to allow system administrators to choose (or let users choose) their favorite tools when there are two or more that provide the same basic functionality, yet satisfy package dependency requirements without specifying a particular package.

For example, there might exist two different versions of newsreaders on a system. The news server package might 'recommend' that there exist some news reader on the system, but the choice of `tin` or `trn` is left up to the individual user. This is satisfied by having both the `tin` and `trn` packages provide the virtual package `news-reader`. Which program is invoked is determined by a link pointing from a file with the virtual package name `/etc/alternatives/news-reader` to the selected file, e.g., `/usr/bin/trn`.

A single link is insufficient to support full use of an alternate program; normally, manual pages, and possibly other supporting files must be selected as well. The Perl script `update-alternatives` provides a way of ensuring that all the files associated with a specified package are selected as a system default.

For example, to check what executables provide `x-window-manager', run:

         update-alternatives --display x-window-manager

If you want to change it, run:

         update-alternatives --config x-window-manager

And follow the instructions on the screen (basically, press the number next to the entry you'd like better).

If a package doesn't register itself as a window manager for some reason (file a bug if it's in error), or if you use a window manager from /usr/local directory, the selections on screen won't contain your preferred entry. You can update the link through command line options, like this:

         update-alternatives --install /usr/bin/x-window-manager \
           x-window-manager /usr/local/bin/wmaker-cvs 50

The first argument to `--install' option is the symlink that points to /etc/alternatives/NAME, where NAME is the second argument. The third argument is the program to which /etc/alternatives/NAME should point to, and the fourth argument is the priority (larger value means the alternative will more probably get picked automatically).

To remove an alternative you added, simply run:

         update-alternatives --remove x-window-manager /usr/local/bin/wmaker-cvs

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ next ]

The Debian GNU/Linux FAQ