customizing.sgml 14.7 KB
Newer Older
1
<!-- retain these comments for translator revision tracking -->
2
<!-- Original version: $Revision: 1.14 $ -->
3
<chapt id="customizing">Customizing your &debian; system
4 5 6 7

<sect id="papersize">How can I ensure that all programs use the same
  paper size?

8
<p>Install the <package/libpaper1/ package, and it will ask you for a
9 10 11 12 13 14
system-wide default paper size. This setting will be kept in the file
<tt>/etc/papersize</tt>.

<p>Users can override the paper size setting using the <tt>PAPERSIZE</tt>
environment variable. For details, see the manual page
<manref name="papersize" section="5">.
15

16

17 18 19
<sect id="hardwareaccess">How can I provide access to hardware peripherals,
  without compromising security?

Josip Rodin's avatar
Josip Rodin committed
20
<p>Many device files in the <tt>/dev</tt> directory belong to some
21 22
predefined groups. For example, <tt>/dev/sr0</tt> belongs to the
<tt>cdrom</tt> group.
23

Josip Rodin's avatar
Josip Rodin committed
24
<p>If you want a certain user to have access to one of these devices, just
Josip Rodin's avatar
Josip Rodin committed
25 26
add the user to the group the device belongs to, i.e. do:
  <example>adduser user group</example>
27
This way you won't have to change the file permissions on the device.
28

29 30 31 32 33
<p>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 <tt>groups</tt>.

<p>Notice that, since the introduction of <tt>udev</tt> if you change
34 35 36
the permissions of a hardware peripheral, they might be adjusted for some
devices when the system starts; if this happens to the hardware peripherals you
are interested in, you will have to adjust the rules at <tt>/etc/udev</tt>.
37

38

39 40
<sect id="consolefont">How do I load a console font on startup the Debian way?

41 42
<p>The <package/kbd/ package supports this,
edit the <tt>/etc/kbd/config</tt> file.
43

44

45 46 47
<sect id="appdefaults">How can I configure an X11 program's application
  defaults?

48 49 50 51 52
<p>Debian's X programs will install their application resource data in the
<tt>/etc/X11/app-defaults/</tt> 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.
53 54


Joost van Baal's avatar
Joost van Baal committed
55
<sect id="booting">How does a Debian system boot?
56 57 58

<p>Like all Unices, Debian boots up by executing the program <tt>init</tt>.
Like most Linux distributions, a default Debian system uses <tt>systemd</tt> as
59 60 61
the implementation of <tt>init</tt>.  Traditional System-V style init and
other methods are also supported.  <footnote>In 2014, Debian changed its default
init system from System V init to systemd.  Debian 8 "jessie" in April 2015 was
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
the first release to ship with systemd as default init.  Four <url
id='https://www.debian.org/devel/tech-ctte#status' name='decisions'> of the
Debian Technical Committee were involved:

<url id='https://lists.debian.org/20140211193904.GX24404@rzlab.ucr.edu'
name='Bug #727708'> 2014-02-11: "The committee decided that the default init
system for Linux architectures in jessie should be systemd."

<url
id='https://lists.debian.org/20140801023630.GF12356@teltox.donarmstrong.com'
name='Bug #746715'> 2014-08-01: "The technical committee expects maintainers to
continue to support the multiple available init systems", and merge reasonable
contributions.

<url
id='https://lists.debian.org/20141116001628.GO32192@teltox.donarmstrong.com'
name='Bug #746578'> 2014-11-15: "The committee decided that systemd-shim should
be the first listed alternative dependency of libpam-systemd instead of
systemd-sysv." This decision made it easier to keep running a non-systemd
Debian system.

<url
id='https://lists.debian.org/21592.61064.527547.410074@chiark.greenend.org.uk'
name='Bug #762194'>2017-11-04: "On automatic init system switching on upgrade"

</footnote>

89

90 91 92 93
<p>To control the order in which services are started, traditional System-V
style Unix systems use <em>runlevels</em>.  These are replaced by
<em>targets</em> under systemd.  To display the default target to which systemd
will bring the system, run the command
94 95 96

  <example>systemctl get-default</example>

97
<p>During boot-up, systemd starts the services or other targets listed in the
98
default target file <tt>/lib/systemd/system/default.target</tt>.  The files for
99 100 101 102
these services and targets are installed and the service is <em>enabled</em>
during Debian package installation.
If you specifically wish not to start a service during boot-up, instead
of removing the corresponding package, you can run the command
103
<example>systemctl disable <var>service</var>.service</example>
104 105 106
using the name of the service file installed in
<tt>/lib/systemd/system</tt> (usually based on the name of the
package).</p>
107

Joost van Baal's avatar
Joost van Baal committed
108
<p>The <em>service file</em> <tt>/lib/systemd/rc.local.service</tt> provides an easy way to
109 110
run customized scripts in the file <tt>/etc/rc.local</tt> after boot-up,
similar to what's offered on Debian systems running System-V style init.
111
Beware: this script will fail if it tries to interact with the console such as
112
asking for a user password or trying to clear the screen.</p>
113 114 115

<p>You can check the status of any service by the command

116 117 118 119 120 121 122 123 124 125 126 127 128 129
  <example>service <var>package</var> status</example>

.  To start or stop a service, run

  <example>service <var>package</var> start</example>

and

  <example>service <var>package</var> stop</example>

.  The <tt>service</tt> command works with any init system supported on a
Debian system, not just with systemd.  If you however prefer to use the same
command on any systemd-supported Linux system, for checking the status run

130
  <example>systemctl status <var>package</var>.service</example>
131

132
to get the same information.</p>
133

134
<p>For more information on systemd for Debian, see <url
135 136 137
id="https://wiki.debian.org/systemd">.


Joost van Baal's avatar
Joost van Baal committed
138
<sect id="sysvinit">And how about Debian and traditional System V init?
139

Joost van Baal's avatar
Joost van Baal committed
140 141
<p>Debian supports booting using traditional System V init, via the
sysvinit-core package.
142
The configuration file for System V <tt>init</tt> (which is <tt>/etc/inittab</tt>)
143 144
specifies that the first script to be executed should be
<tt>/etc/init.d/rcS</tt>.  This script runs all of the scripts in
145
<tt>/etc/rcS.d/</tt> by forking subprocesses 
146
to perform initialization such as to check and to mount file systems,
147
to load modules, to start the network services, to set the clock, and to
148
perform other initialization.  
149 150 151 152

<p>After completing the boot process, <tt>init</tt> executes all start
scripts in a directory specified by the default runlevel (this runlevel
is given by the entry for <tt>id</tt> in <tt>/etc/inittab</tt>).
Josip Rodin's avatar
Josip Rodin committed
153
Like most <!-- all? SGK --> System V compatible Unices, Linux has 7 runlevels:
154 155 156 157 158 159 160
<list>
  <item>0 (halt the system),
  <item>1 (single-user mode),
  <item>2 through 5 (various multi-user modes), and
  <item>6 (reboot the system).
</list>
Debian systems come with id=2, which indicates that the default
Josip Rodin's avatar
Josip Rodin committed
161 162
runlevel will be '2' when the multi-user state is entered, and the
scripts in <tt>/etc/rc2.d/</tt> will be run.
163

164 165 166 167 168 169
<p>Debian uses dependency-based boot ordering through <prgn/insserv/, using the
LSB headers in each script under <tt>/etc/init.d/</tt>, as well as
parallel concurrent booting through the use of <prgn/startpar/ to speed
up the boot process.

<p>The scripts in any of the directories, <tt>/etc/rcN.d/</tt>
170
are just symbolic links back to scripts in <tt>/etc/init.d/</tt>.  However,
Josip Rodin's avatar
Josip Rodin committed
171 172 173
the <em>names</em> of the files in each of the <tt>/etc/rcN.d/</tt>
directories are selected to indicate the <em>way</em> the scripts in
<tt>/etc/init.d/</tt> will be run.  Specifically, before entering any
174 175 176 177 178 179
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.

Josip Rodin's avatar
Josip Rodin committed
180 181 182 183 184 185 186 187
<p>This approach works because the scripts in <tt>/etc/init.d/</tt> 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.

<p>For example, with the argument `reload' the command
  <example>/etc/init.d/sendmail reload</example>
188 189 190 191
sends the sendmail daemon a signal to reread its configuration file.  

<p>Note that <prgn/invoke-rc.d/ should not be used to call the 
<tt>/etc/init.d/</tt> scripts, <prgn/service/ should be used instead.
192

193

Joost van Baal's avatar
Joost van Baal committed
194
<sect id='altboot'>And are there yet other ways of booting a Debian system?
195 196 197 198 199 200 201

<p>If you do like System V init, but don't like the /etc/rc?.d/* links, you
could install the <package/file-rc/ package.  That will convert the links into
one single configuration file /etc/runlevel.conf instead.</p>

<p>If you like neither System V nor systemd, you might like <package/openrc/ or
<package/runit/ or <package/daemontools/.</p>
202 203 204 205 206 207



<sect id="interconffiles">How does the package management system deal with
  packages that contain configuration files for other packages?

Josip Rodin's avatar
Josip Rodin committed
208
<p>Some users wish to create, for example, a new server by installing a
209
group of Debian packages and a locally generated package consisting of
210
configuration files.  This is not generally a good idea, because <prgn/dpkg/
211 212 213 214
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.

Josip Rodin's avatar
Josip Rodin committed
215
<p>Instead, create a local package that modifies the configuration files
216
of the "group" of Debian packages of interest.  Then <prgn/dpkg/ and the
217 218 219 220 221 222 223 224
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.

<!-- check against dpkg-divert description -->
<sect id="divert">How do I override a file installed by a package, so that
  a different version can be used instead?

Josip Rodin's avatar
Josip Rodin committed
225
<p>Suppose a sysadmin or local user wishes to use a program "login-local"
226 227 228 229
rather than the program "login" provided by the Debian <package/login/
package.

<p>Do <strong/not/:
230 231 232 233 234 235 236
<list>
  <item>Overwrite <tt>/bin/login</tt> with <tt>login-local</tt>.
</list>
The package management system will not know about this change, and will simply
overwrite your custom <tt>/bin/login</tt> whenever <tt>login</tt> (or any
package that provides <tt>/bin/login</tt>) is installed or updated.

237
<p>Rather, do
238
<list>
Josip Rodin's avatar
Josip Rodin committed
239 240 241 242
  <item>Execute:
    <example>dpkg-divert --divert /bin/login.debian /bin/login</example>
  in order to cause all future installations of the Debian <package/login/
  package to write the file <tt>/bin/login</tt> to <tt>/bin/login.debian</tt>
243
  instead.
Josip Rodin's avatar
Josip Rodin committed
244 245 246
  <item>Then execute:
    <example>cp login-local /bin/login</example>
  to move your own locally-built program into place.
247 248
</list>

249 250 251
<p>Run <tt>dpkg-divert --list</tt> to see which diversions are currently active
on your system.

Josip Rodin's avatar
Josip Rodin committed
252
<p>Details are given in the manual page <manref name="dpkg-divert" section="8">.
253 254 255 256 257

<sect id="localpackages">How can I have my locally-built package included in
  the list of available packages that the package management system knows
  about?

258 259 260 261 262 263 264
<p>Execute the command:

<example>
dpkg-scanpackages BIN_DIR OVERRIDE_FILE [PATHPREFIX] > my_Packages
</example>

<p>where:
265 266 267 268 269 270 271
  <list>
    <item>BIN-DIR is a directory where Debian archive files (which usually
    have an extension of ".deb") are stored.
    <item>OVERRIDE_FILE is a file that is edited by the distribution
    maintainers and is usually stored on a Debian FTP archive at
    <tt>indices/override.main.gz</tt> for the Debian packages in
    the "main" distribution. You can ignore this for local packages.
272 273
    <item>PATHPREFIX is an <em>optional</em> string that can be prepended
    to the <tt>my_Packages</tt> file being produced.
274
  </list>
275 276 277 278 279 280 281

<p>Once you have built the file <tt>my_Packages</tt>, tell the package
management system about it by using the command:

<example>
dpkg --merge-avail my_Packages
</example>
282

283 284 285
<p>If you are using APT, you can add the local repository to your
<manref name="sources.list" section="5"> file, too.

286 287 288 289
<sect id="diverse">Some users like mawk, others like gawk; some like vim,
  others like elvis; some like trn, others like tin; how does Debian
  support diversity?

Josip Rodin's avatar
Josip Rodin committed
290
<p>There are several cases where two packages provide two different versions
291 292 293 294 295
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.

Josip Rodin's avatar
Josip Rodin committed
296
<p>Debian uses a "virtual" package system to allow system administrators
297 298 299 300
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.

Josip Rodin's avatar
Josip Rodin committed
301
<p>For example, there might exist two different versions of newsreaders on
302 303 304 305 306 307 308 309 310
a system.  The news server package might 'recommend' that there exist
<em>some</em> news reader on the system, but the choice of <tt>tin</tt>
or <tt>trn</tt> is left up to the individual user.  This is satisfied by
having both the <package/tin/ and <package/trn/ packages provide the
virtual package <package/news-reader/.  <em>Which</em> program is
invoked is determined by a link pointing from a file with the virtual
package name <tt>/etc/alternatives/news-reader</tt> to the selected file,
e.g., <tt>/usr/bin/trn</tt>.

Josip Rodin's avatar
Josip Rodin committed
311
<p>A single link is insufficient to support full use of an alternate
312 313 314 315 316
program; normally, manual pages, and possibly other supporting files
must be selected as well.  The Perl script <tt>update-alternatives</tt>
provides a way of ensuring that all the files associated with a specified
package are selected as a system default.

Josip Rodin's avatar
Josip Rodin committed
317 318 319 320 321 322
<p>For example, to check what executables provide `x-window-manager', run:
  <example>update-alternatives --display x-window-manager</example>
If you want to change it, run:
  <example>update-alternatives --config x-window-manager</example>
And follow the instructions on the screen (basically, press the number
next to the entry you'd like better).
Josip Rodin's avatar
Josip Rodin committed
323 324 325 326 327

<p>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:
Josip Rodin's avatar
Josip Rodin committed
328 329
  <example>update-alternatives --install /usr/bin/x-window-manager \
  x-window-manager /usr/local/bin/wmaker-cvs 50</example>
Josip Rodin's avatar
Josip Rodin committed
330 331 332 333 334 335 336

<p>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).

Josip Rodin's avatar
Josip Rodin committed
337 338
<p>To remove an alternative you added, simply run:
  <example>update-alternatives --remove x-window-manager /usr/local/bin/wmaker-cvs</example>