The Debian Maintenance HOWTO
Chapter 5 - System Administration
5.1 System cloning
After a crash or when a second system should be set up as a backup server, it
is helpful to simply clone the first system into the second one instead of
manually installing everything. This is actually possible and can be achieved
without much work. All you need as additional software is dselect
even though you may have considered it archane.
In section Installed Packages,
Section 3.3 you have already been told how to dump the status of all
packages known to the system into a file. This file needs to be transferred to
the second machine and imported there via dpkg --set-selections.
Afterwards start dselect and let it update its internal database.
When this is done, hit the install target and let dselect finish
the job. It will remove those packages that were marked to be removed and
install those that were marked to be installed. Alternatively, use the
dselect-upgrade mechanism of apt-get.
5.2 Keyboard
This section only covers the keyboard layout for (virtual) text consoles. The
configuration for X11 is covered in Keyboard Layout, Section 2.9.2.
They keyboard translation table is controlled by the program
loadkeys(1). As parameter for that program you supply the keymap
you want to load. All available keymaps are stored in
/usr/share/keymaps. Upon system boot the file
/etc/kbd/default.kmap.gz is loaded.
The default.kmap.gz file is a compiled and compressed keymap,
generated from /usr/share/keymap with all #include
statements expanded. This is is configured by the program
kbdconfig(8) which you can run as root at any time.
It may be useful when using a console at a friend who uses a different keyboard
layout than you, or when he needs to type on yours, to switch the keyboard
layout on the running system. For example loadkeys us will switch
to a US layout while loadkeys de will switch to the German layout.
These changes have impact to all virtual consoles but not for X11.
It may be valuable to remap some keys (e.g. use the Window-Key for something
useful). For doing this you will have to edit the keymap yourself. Since they
are plain text files (though compressed) this is done with any editor. For
finding out which keycode is generated for which keypress, use the
showkey(1) program. The program runs until 10 seconds (or the
amount of time specified by the --timeout or -t
option) has elapsed since the last key press or release event, or until it
receives a suitable signal, like SIGTERM, from another process.
If you want to modify an existing keymap and use it under a different name, you
may want to use the dumpkeys(1) program which writes the current
keyboard translation table to stdout.
Please be warned not to use a keymap which was designed for a different architecture. Using a keymap designed for sun on an intel compatible system will lead to very strange keyboard mappings.
5.3 Time and Timezone
Upon system installation you are asked in which timezone your computer is and if it uses GMT for the system clock. This chapter informs you how the time is calculated and how you can adjust or change that.
5.3.1 Reconfiguring the Timezone
The program tzconfig(8) is used to configure the timezone. You
set a continent and capitol city which is next to your location. From this
information the actual timezone is calculated. For example, if you are living
in Germany your timezone will most probably be Europe/Berlin.
This information is stored in /etc/timezone.
5.3.2 System Clock
Your system clock does not need to run with the same time that is diplayed when
issuing the date command. The time is calculated from it at boot
time though. Only upon system boot the Linux clock is adjusted from the
hardware clock. On a Debian system it is done the other way around when the
system is turned off. This is controlled by the start/stop-script
/etc/init.d/hwclock.sh.
Your system clock may run on UTC (Universal Coordinated Time also known as
Greenwich Mean Time (GMT)) or localtime. This is configured in
/etc/default/rcS. When UTC is set to
yes this tells the boot script that the system clock runs on UTC
and time has to be converted into local time when the time is read or written.
5.3.3 Automatic Clock Adjustments
There are techniques to adjust the Linux time on a regular basis. This may be important if your clock runs too unreliable but requires some sort of permanent connection to the internet. Adjusting the time is done by synchronizing it with another host which is said to contain a reliable time.
The most common technique is to participate from timeservers that are located
in various places around the world and that synchronize themselves either with
a readio receiver or by using the Network Time Protocol (NTP). To participate
in this network all you have to do is to install the ntp-package
and to tell it to use one or more public
NTP-servers.
5.4 Systemwide environment configuration
Sometimes it is needed to set some environment variables that should be used by all applications. It is a general rule to set as few variables as possible since this data is inherited from process to process and may waste memory. However, some variables are needed for localisation support (see below), for example. But make sure that the changes are really wished by all users before doing them!
There is NO DEFAULT WAY of setting the variables in Debian, but you may use the /etc/environment file that can be parsed in scripts that use bourne compatible shells (like bash).
LANG=de_DE
LC_MESSAGES=en_US
Now, this file may be parsed by /etc/profile adding following line there:
. /etc/environment
5.5 Languages (locales)
Many non-native english speakers like to use their native language for program
messages where possible. This is configured by the LANG environment variable
and by other settings from locale(7). The described variables may
be set from each user for his environment (i.e. in ~/.bash_profile if using
bash) or systemwide as described above.
The rules of setting the locale variables in few words:
If nothing is set before, then setting of "LANG" makes LC_* (except of LC_ALL) adopt the value of "LANG". If a LC environment variable is set before, it will keep it's setting indepent of LANG.
If you set LC_ALL, it will allways overwrite the content of all locale variables, except of LANG.
So if you wish to only set certain variables (e.g. LC_CTYPE), set them first, then LANG (if wished) but don't set LC_ALL.
Another example: if you wish to set everything to your country's settings, change LANG first, and then (if wished) change certain LC_ variables.
When using current unstable (after 2.2 aka potato) you'll have to prepare the
locales you want to use as well. The file /etc/locale.gen
contains all possible locales that you can use on your system. You will have
to uncomment all of them that will actually be used (or all if you are insane).
After that you'll have to run the program locale-gen.
5.6 Character sets (foreign characters)
Disclaimer: This section lacks information. This is due to the fact that the author doesn't make heavy use of foreign characters on his machines. Help is appreciated.
You have to distinguish between input of foreign characters and proper output of them. In general, locale variables like LANG and LC_ALL should be sufficient. Unfortunately they are not and you may have to tweak a couple of programs in order to make them work properly with non-english characters.
5.6.1 Readline
The readline library is responsible for interaction with programs like
bash, ftp and psql. With recent
versions of the library you don't need to make the changes described below if
you have set LC_CTYPE correctly (see locales part above).
However, with potato or a prior release of Debian, you will need additional
configuration. There are two files where you may configure this:
/etc/inputrc (system-wide) and ˜/.inputrc (per
user). The following configuration should enable you to type foreign
characters as well as making programs output them properly.
set meta-flag on
set convert-meta off
set input-meta on
set output-meta on
5.6.2 less
Less usually doesn't display foreign characters. You have to tell this program
which character set to use. This can be adjusted with the environment variable
LESSCHARSET. It is set in either /etc/profile,
˜/.bash_profile or ˜/.bashrc for a bourne
shell (i.e. bash):
export LESSCHARSET=latin1
If you use a C-shell the relevant files are /etc/csh.login,
/etc/csh.cshrc and ˜/.cshrc that have to
contain the following:
setenv LESSCHARSET latin1
5.6.3 Mutt
With LANG=de_DE Mutt should not only display german messages but
also display german characters (setup locales as described above). If you
don't like german messages but want to see german characters (i.e. umlauts)
you'll have to set the following:
export LC_CTYPE=en_US.ISO-8859-1
If this is only required for Mutt you can use the following respectively:
alias mutt='LC_CTYPE=en_US.ISO-8859-1 mutt'
5.6.4 Emacs
Emacs normally displays non-english characters by their octal representation
normally. To surpress this you have to add the following code to
˜/.emacs or add it as as separate file to
/etc/emacs/site-start.d (I have it as 50i18n.el
there).
(set-input-mode (car (current-input-mode))
(nth 1 (current-input-mode))
0)
(standard-display-european t)
If you have a US keyboard layout and want to type foreign characters the minor
mode iso-accents-mode might be interesting for you. German
umlauts are typed just like with LaTeX, maybe that's already common for you.
5.6.5 Console modus
For special character sets that need more than simple exchanging of the
codepage (e.g. Cyrillian), you will have to modify the console environment to
get the proper character translation scheme. This is achieved on Debian in the
file /etc/console-tools/config. The folowing example shows the
configuration for Russian (KOI8-R) charset:
SCREEN_FONT=Cyr_a8x8
APP_CHARSET_MAP_vc1=koi2alt.trans
APP_CHARSET_MAP_vc2=koi2alt.trans
APP_CHARSET_MAP_vc3=koi2alt.trans
APP_CHARSET_MAP_vc4=koi2alt.trans
APP_CHARSET_MAP_vc5=koi2alt.trans
APP_CHARSET_MAP_vc6=koi2alt.trans
APP_CHARSET_MAP_vc7=koi2alt.trans
APP_CHARSET_MAP_vc8=koi2alt.trans
APP_CHARSET_MAP_vc9=koi2alt.trans
APP_CHARSET_MAP_vc10=koi2alt.trans
Furthermore, if you use SVGATextMode, you should set the proper fonts in it's configuration file too.
The Debian Maintenance HOWTO
November 23rd, 2014Joey Schulze, joey@infodrom.org
