Live manual Debian Live

# Debian Live Manual

# Dostosowywanie instalacji pakietów

367

# 8. Dostosowywanie instalacji pakietów

368

Perhaps the most basic customization of a live system is the selection of packages to be included in the image. This chapter guides you through the various build-time options to customize live-build's installation of packages. The broadest choices influencing which packages are available to install in the image are the distribution and archive areas. To ensure decent download speeds, you should choose a nearby distribution mirror. You can also add your own repositories for backports, experimental or custom packages, or include packages directly as files. You can define lists of packages, including metapackages which will install many related packages at once, such as packages for a particular desktop or language. Finally, a number of options give some control over apt, or if you prefer, aptitude, at build time when packages are installed. You may find these handy if you use a proxy, want to disable installation of recommended packages to save space, or need to control which versions of packages are installed via APT pinning, to name a few possibilities.

369

8.1 Źródła pakietu

370

8.1.1 Dystrybucja, działy archiwum i tryb

371

The distribution you choose has the broadest impact on which packages are available to include in your live image. Specify the codename, which defaults to testing. Any current distribution carried in the archive may be specified by its codename here. (See Terms for more details.) The `--distribution` option not only influences the source of packages within the archive, but also instructs live-build to enable other sources.

372

For example, to build against the stable release, with security, updates (enabled per default) and additionally proposed-updates and backports, specify:

373

$ lb config --distribution stable --proposed-updates true --backports true

374

Similarly, for the unstable release, sid, which has neither security nor updates, specify:

375

$ lb config --distribution sid

376

Within the distribution archive, archive areas are major divisions of the archive. In Debian, these are `main`, `contrib` and `non-free`. Only `main` contains software that is part of the Debian distribution, hence that is the default. One or more values may be specified, e.g.

377

$ lb config --archive-areas "main contrib non-free"

378

Experimental support is available for some Debian derivatives through a `--mode` option. By default, this option is set to `debian` only if you are building on a Debian or on an unknown system. If `lb config` is invoked on any of the supported derivatives, it will default to create an image of that derivative. If `lb config` is run in e.g. `ubuntu` mode, the distribution names and archive areas for the specified derivative are supported instead of the ones for Debian. The mode also modifies live-build behaviour to suit the derivatives.

379

Note: The projects for whom these modes were added are primarily responsible for supporting users of these options. The Debian Live Project, in turn, provides development support on a best-effort basis only, based on feedback from the derivative projects as we do not develop or support these derivatives ourselves.

380

8.1.2 Serwery lustrzane dystrybucji

381

The Debian archive is replicated across a large network of mirrors around the world so that people in each region can choose a nearby mirror for best download speed. Each of the `--mirror-*` options governs which distribution mirror is used at various stages of the build. Recall from Stages of the build that the bootstrap stage is when the chroot is initially populated by debootstrap with a minimal system, and the chroot stage is when the chroot used to construct the live system's filesystem is built. Thus, the corresponding mirror switches are used for those stages, and later, in the binary stage, the `--mirror-binary` and `--mirror-binary-security` values are used, superseding any mirrors used in an earlier stage.

382

8.1.3 Serwery lustrzane dystrybucji używane podczas budowania obrazu

383

To set the distribution mirrors used at build time to point at a local mirror, it is sufficient to set `--mirror-bootstrap` and `--mirror-chroot-security` as follows.

384

$ lb config --mirror-bootstrap http://localhost/debian/ \
--mirror-chroot-security http://localhost/debian-security/

385

Serwer lustrzany chroot, określony przez `--mirror-chroot`, domyślnie do wartości `--mirror-bootstrap`.

386

8.1.4 Serwery lustrzane dystrybucji użyte podczas uruchomienia

387

The `--mirror-binary*` options govern the distribution mirrors placed in the binary image. These may be used to install additional packages while running the live system. The defaults employ `deb.debian.org`, a service that chooses a geographically close mirror based, among other things, on the user's IP family and the availability of the mirrors. This is a suitable choice when you cannot predict which mirror will be best for all of your users. Or you may specify your own values as shown in the example below. An image built from this configuration would only be suitable for users on a network where "`mirror`" is reachable.

388

$ lb config --mirror-binary http://mirror/debian/ \
--mirror-binary-security http://mirror/debian-security/ \
--mirror-binary-backports http://mirror/debian-backports/

389

8.1.5 Dodatkowe repozytoria

390

You may add more repositories, broadening your package choices beyond what is available in your target distribution. These may be, for example, for backports, experimental or custom packages. To configure additional repositories, create `config/archives/your-repository.list.chroot`, and/or `config/archives/your-repository.list.binary` files. As with the `--mirror-*` options, these govern the repositories used in the chroot stage when building the image, and in the binary stage, i.e. for use when running the live system.

391

For example, `config/archives/live.list.chroot` allows you to install packages from the debian-live snapshot repository at live system build time.

392

deb http://debian-live.alioth.debian.org/ sid-snapshots main contrib non-free

393

If you add the same line to `config/archives/live.list.binary`, the repository will be added to your live system's `/etc/apt/sources.list.d/` directory.

394

Jeżeli takie pliki istnieją to zostaną wybrane automatycznie.

395

You should also put the ASCII-armored GPG key used to sign the repository into `config/archives/your-repository.key.{binary,chroot}` files.

396

Should you need custom APT pinning, such APT preferences snippets can be placed in `config/archives/your-repository.pref.{binary,chroot}` files and will be automatically added to your live system's `/etc/apt/preferences.d/` directory.

397

Similarly, if you need custom APT_AUTH.CONF(5) authentication configuration, this can be placed in `config/archives/your-repository.auth.{binary,chroot}` files and will be automatically added to your live system's `/etc/apt/auth.conf.d/` directory

398

8.2 Wybieranie pakietów do instalacji

399

There are a number of ways to choose which packages live-build will install in your image, covering a variety of different needs. You can simply name individual packages to install in a package list. You can also use metapackages in those lists, or select them using package control file fields. And finally, you may place package files in your `config/` tree, which is well suited to testing of new or experimental packages before they are available from a repository.

400

8.2.1 Lista pakietów

401

Listy pakietów są skutecznym sposobem wyrażenia, które pakiety powinny zostać zainstalowane.Składnia list obsługuje instrukcje warunkowe, które ułatwiają budowanie list i dostosowywanie ich do wykorzystania w wielu konfiguracjach. Nazwy pakietów mogą być także wstrzykiwane do listy za pomocą pomocników powłoki w czasie kompilacji.

402

Note: The behaviour of live-build when specifying a package that does not exist is determined by your choice of APT utility. See Choosing apt or aptitude for more details.

403

8.2.2 Używanie metapakietów

404

Najprostszym sposobem, aby wypełnić swoją listę pakietów jest użycie metapakietu zadań dostarczanych przez dystrybucję. Na przykład:

405

$ lb config
$ echo task-gnome-desktop > config/package-lists/desktop.list.chroot

406

This supersedes the older predefined list method supported in `live-build` 2.x. Unlike predefined lists, task metapackages are not specific to the Live System project. Instead, they are maintained by specialist working groups within the distribution and therefore reflect the consensus of each group about which packages best serve the needs of the intended users. They also cover a much broader range of use cases than the predefined lists they replace.

407

All task metapackages are prefixed `task-`, so a quick way to determine which are available (though it may contain a handful of false hits that match the name but aren't metapackages) is to match on the package name with:

408

$ apt-cache search --names-only ^task-

409

Oprócz tych, znajdziesz jeszcze inne metapakiety do różnych celów. Niektóre są podzbiorami szerszych pakietów zadań, jak `gnome-core`, podczas gdy inne są indywidualne specjalistyczne części czystego Debiana mieszanki, takie jak metapakiety `education-*`. Aby wyświetlić wszystkie metapakiety w archiwum, należy zainstalować pakiet `debtags` i wyświetlić wszystkie pakiety z tagiem `role::metapackage` w następujący sposób:

410

$ debtags search role::metapackage

411

8.2.3 Lokalna lista pakietów

412

Whether you list metapackages, individual packages, or a combination of both, all local package lists are stored in `config/package-lists/`. Since more than one list can be used, this lends itself well to modular designs. For example, you may decide to devote one list to a particular choice of desktop, another to a collection of related packages that might as easily be used on top of a different desktop. This allows you to experiment with different combinations of sets of packages with a minimum of fuss, sharing common lists between different live image projects.

413

Package lists that exist in this directory need to have a `.list` suffix in order to be processed, and then an additional stage suffix, `.chroot` or `.binary` to indicate which stage the list is for.

414

The packages in the `.list.chroot_install` list are present both in the live system and in the installed system.

415

Note: If you don't specify the stage suffix, the list will be used for both stages. Normally, you want to specify `.list.chroot` so that the packages will only be installed in the live filesystem and not have an extra copy of the `.deb` placed on the medium.

416

8.2.4 Lokalna lista pakietów binarnych

417

To make a binary stage list, place a file suffixed with `.list.binary` in `config/package-lists/`. These packages are not installed in the live filesystem, but are included on the live medium under `pool/`. You would typically use such a list with one of the non-live installer variants. As mentioned above, if you want this list to be the same as your chroot stage list, simply use the `.list` suffix by itself.

418

8.2.5 Wygenerowana lista pakietów

419

It sometimes happens that the best way to compose a list is to generate it with a script. Any line starting with an exclamation point indicates a command to be executed within the chroot when the image is built. For example, one might include the line `! grep-aptavail -n -sPackage -FPriority standard | sort` in a package list to produce a sorted list of available packages with `Priority: standard`.

420

In fact, selecting packages with the `grep-aptavail` command (from the `dctrl-tools` package) is so useful that `live-build` provides a `Packages` helper script as a convenience. This script takes two arguments: `field` and `pattern`. Thus, you can create a list with the following contents:

421

$ lb config
$ echo '! Packages Priority standard' > config/package-lists/standard.list.chroot

422

8.2.6 Używanie instrukcji warunkowych w listach pakietów.

423

Any of the live-build configuration variables stored in `config/*` (minus the `LB_` prefix) may be used in conditional statements in package lists. Generally, this means any `lb config` option uppercased and with dashes changed to underscores. But in practice, it is only the ones that influence package selection that make sense, such as `DISTRIBUTION`, `ARCHITECTURES` or `ARCHIVE_AREAS`.

424

Na przykład, aby zainstalować `ia32-libs` jeżeli wybrano `--architectures amd64`:

425

#if ARCHITECTURES amd64
ia32-libs
#endif

426

Można przetestować dowolny szereg wartości, na przykład zainstalować memtest86+, jeżeli ustalono `--architectures i386` lub `--architectures amd64`:

427

#if ARCHITECTURES i386 amd64
memtest86+
#endif

428

You may also test against variables that may contain more than one value, e.g. to install vrms if either `contrib` or `non-free` is specified via `--archive-areas`:

429

#if ARCHIVE_AREAS contrib non-free
vrms
#endif

430

Zagnieżdżanie instrukcji warunkowych jest nie obsługiwane.

431

8.2.7 Usuwanie pakietu podczas instalacji

432

You can list packages in files with `.list.chroot_live` and `.list.chroot_install` suffixes inside the `config/package-lists` directory. If both a live and an install list exist, the packages in the `.list.chroot_live` list are removed with a hook after the installation (if the user uses the installer). The packages in the `.list.chroot_install` list are present both in the live system and in the installed system. This is a special tweak for the installer and may be useful if you have `--debian-installer live` set in your config, and wish to remove live system-specific packages at install time.

433

8.2.8 Summary

434

The table below shows which configuration files are required to achieve the desired availability of the package.

435

| X.chroot | X.chroot_live | X | X.binary
--- | --- | --- | --- | ---
Package is installed in the live system | Yes | Yes | Yes | No
Package is removed after installing the live system | No | Yes | No | N/A
Package can be installed from the live system without network | N/A | N/A | Yes *1 | Yes

436

*1: Because the installer needs this package

437

`X` = `config/package-lists/custom_name.list`

438

8.2.9 Pulpit i zadania językowe

439

Desktop and language tasks are special cases that need some extra planning and configuration. Live images are different from Debian Installer images in this respect. In the Debian Installer, if the medium was prepared for a particular desktop environment flavour, the corresponding task will be automatically installed. Thus, there are internal `gnome-desktop`, `kde-desktop`, `lxde-desktop` and `xfce-desktop` tasks, none of which are offered in `tasksel`'s menu. Likewise, there are no menu entries for tasks for languages, but the user's language choice during the install influences the selection of corresponding language tasks.

440

When developing a desktop live image, the image typically boots directly to a working desktop, the choices of both desktop and default language having been made at build time, not at run time as in the case of the Debian Installer. That's not to say that a live image couldn't be built to support multiple desktops or multiple languages and offer the user a choice, but that is not live-build's default behaviour.

441

Because there is no provision made automatically for language tasks, which include such things as language-specific fonts and input-method packages, if you want them, you need to specify them in your configuration. For example, a GNOME desktop image containing support for German might include these task metapackages:

442

$ lb config
$ echo "task-gnome-desktop task-laptop" >> config/package-lists/my.list.chroot
$ echo "task-german task-german-desktop task-german-gnome-desktop" >> config/package-lists/my.list.chroot

443

8.2.10 Rodzaj jądra i wersja

444

One or more kernel flavours will be included in your image by default, depending on the architecture. You can choose different flavours via the `--linux-flavours` option. Each flavour is suffixed to the default stub `linux-image` to form each metapackage name which in turn depends on an exact kernel package to be included in your image.

445

Thus by default, an `amd64` architecture image will include the `linux-image-amd64` flavour metapackage, and an `i386` architecture image will include the `linux-image-586` metapackage.

446

When more than one kernel package version is available in your configured archives, you can specify a different kernel package name stub with the `--linux-packages` option. For example, supposing you are building an `amd64` architecture image and add the experimental archive for testing purposes so you can install the `linux-image-3.18.0-trunk-amd64` kernel. You would configure that image as follows:

447

$ lb config --linux-packages linux-image-3.18.0-trunk
$ echo "deb http://deb.debian.org/debian/ experimental main" > config/archives/experimental.list.chroot

448

8.2.11 Niestandardowe jądra

449

You can build and include your own custom kernels, so long as they are integrated within the Debian package management system. The live-build system does not support kernels not built as `.deb` packages.

450

The proper and recommended way to deploy your own kernel packages is to follow the instructions in the `kernel-handbook`. Remember to modify the ABI and flavour suffixes appropriately, then include a complete build of the `linux` and matching `linux-latest` packages in your repository.

451

If you opt to build the kernel packages without the matching metapackages, you need to specify an appropriate `--linux-packages` stub as discussed in Kernel flavour and version. As we explain in Installing modified or third-party packages, it is best if you include your custom kernel packages in your own repository, though the alternatives discussed in that section work as well.

452

It is beyond the scope of this document to give advice on how to customize your kernel. However, you must at least ensure your configuration satisfies these minimum requirements:

453

- Użyj startowego dysku RAM.

454

- Include the union filesystem module (i.e. usually `OverlayFS`).

455

- Include any other filesystem modules required by your configuration (i.e. usually `squashfs`).

456

8.3 Instalowanie zmodyfikowanych pakietów lub pakietów innych firm

457

While it is against the philosophy of a live system, it may sometimes be necessary to build a live system with modified versions of packages that are in the Debian repository. This may be to modify or support additional features, languages and branding, or even to remove elements of existing packages that are undesirable. Similarly, "third-party" packages may be used to add bespoke and/or proprietary functionality.

458

This section does not cover advice regarding building or maintaining modified packages. Joachim Breitner's 'How to fork privately' method from ‹http://www.joachim-breitner.de/blog/archives/282-How-to-fork-privately.html› may be of interest, however. The creation of bespoke packages is covered in the Debian New Maintainers' Guide at ‹https://www.debian.org/doc/manuals/maint-guide/› and elsewhere.

459

Istnieją dwa sposoby instalacji niestandardowych pakietów:

460

- `packages.chroot`

461

- Używanie niestandardowego repozytorium APT

462

Using `packages.chroot` is simpler to achieve and useful for "one-off" customizations but has a number of drawbacks, while using a custom APT repository is more time-consuming to set up.

463

8.3.1 Używanie `packages.chroot`do instalacji niestandardowych pakietów

464

To install a custom package, simply copy it to the `config/packages.chroot/` directory. Packages that are inside this directory will be automatically installed into the live system during build - you do not need to specify them elsewhere.

465

Packages must be named in the prescribed way. One simple way to do this is to use `dpkg-name`.

466

Korzystanie z `packages.chroot` do instalacji niestandardowych pakietów ma wady:

467

- Nie jest możliwe użycie bezpiecznego APT.

468

- You must install all appropriate packages in the `config/packages.chroot/` directory.

469

- It does not lend itself to storing live system configurations in revision control.

470

8.3.2 Używanie repozytoriium APT aby zainstalować niestandarkowe pakiety

471

Unlike using `packages.chroot`, when using a custom APT repository you must ensure that you specify the packages elsewhere. See Choosing packages to install for details.

472

While it may seem unnecessary effort to create an APT repository to install custom packages, the infrastructure can be easily re-used at a later date to offer updates of the modified packages.

473

The APT repository does not necessarily need to be online, you can use a local repository instead. However, in both cases the repository needs to be signed.

474

Example:

475

$ gpg --armor --output config/archives/custom_repo.gpg.key${EXTENSION} --export-options export-minimal --export ${SIGNING_KEY}
$ cat << EOF > config/archives/custom_repo.list${EXTENSION}
deb [signed-by=/etc/apt/trusted.gpg.d/custom_repo.gpg.key${EXTENSION}.asc] ${URI} ${SUITE} ${COMPONENTS}
EOF
$ echo "${PACKAGES_FROM_REPOSITORY}" > config/package-lists/custom_repo.list${EXTENSION}

476

Where:

477

- `${EXTENSION}` : the optional stage suffix, see the summary

478

- `${SIGNING_KEY}`: the keyID of the signature of the repository

479

- `${URI}`: the URI to the repository, e.g. `http://deb.debian.org/debian/` or `file://$(pwd)/my_local_repository`

480

- `${SUITE}`: the suite within the repository, e.g. `my-debian-based-distro`

481

- `${COMPONENTS}`: the components within the repository, e.g. `main`

482

- `${PACKAGES_FROM_REPOSITORY}`: the names of the packages to install (dependencies will automatically be installed as well)

483

8.3.3 Niestandardowe pakiety i APT

484

live-build uses APT to install all packages into the live system so will therefore inherit behaviours from this program. One relevant example is that (assuming a default configuration) given a package available in two different repositories with different version numbers, APT will elect to install the package with the higher version number.

485

Because of this, you may wish to increment the version number in your custom packages' `debian/changelog` files to ensure that your modified version is installed over one in the official Debian repositories. This may also be achieved by altering the live system's APT pinning preferences - see APT pinning for more information.

486

8.4 Konfigurowanie APT podczas kompilacji

487

You can configure APT through a number of options applied only at build time. (APT configuration used in the running live system may be configured in the normal way for live system contents, that is, by including the appropriate configurations through `config/includes.chroot/`.) For a complete list, look for options starting with `apt` in the `lb_config` man page.

488

8.4.1 Wybieranie apt lub aptitude

489

You can elect to use either apt or aptitude when installing packages at build time. Which utility is used is governed by the `--apt` argument to `lb config`. Choose the method implementing the preferred behaviour for package installation, the notable difference being how missing packages are handled.

490

- `apt`: Używając tej metody, jeśli zaznaczono brakujący pakiet, instalacja pakietu zakończy się niepowodzeniem. To jest domyślne ustawienie.

491

- `aptitude`: Używając tej metody, jeśli zaznaczono brakujący pakiet, instalacja pakietu zakończy się powodzeniem.

492

8.4.2 Używanie serwera proxy z APT

493

One commonly required APT configuration is to deal with building an image behind a proxy. You may specify your APT proxy with the `--apt-http-proxy` option as needed, e.g.

494

$ lb config --apt-http-proxy http://proxy/

495

8.4.3 Podkręcanie APT celu zaoszczędzenia miejsca

496

You may find yourself needing to save some space on the image medium, in which case one or the other or both of the following options may be of interest.

497

Jeśli nie chcesz zawierać indeksów APT w obrazie, można je pominąć z:

498

$ lb config --apt-indices false

499

This will not influence the entries in `/etc/apt/sources.list`, but merely whether `/var/lib/apt` contains the indices files or not. The tradeoff is that APT needs those indices in order to operate in the live system, so before performing `apt-cache search` or `apt-get install`, for instance, the user must `apt-get update` first to create those indices.

500

If you find the installation of recommended packages bloats your image too much, provided you are prepared to deal with the consequences discussed below, you may disable that default option of APT with:

501

$ lb config --apt-recommends false

502

The most important consequence of turning off recommends is that `live-boot` and `live-config` themselves recommend some packages that provide important functionality used by most Live configurations.

503

Two packages which you most probably will want to add again are:

504

- `user-setup` which `live-config` recommends is used to create the live user.

505

- `sudo` which `live-config` recommends is used to obtain root access in the live-image, which is needed to shutdown the computer.

506

$ lb config --apt-recommends false
$ echo "user-setup sudo" > config/package-lists/recommends.list.chroot

507

In all but the most exceptional circumstances you need to add back at least some of these recommends to your package lists or else your image will not work as expected, if at all. Look at the recommended packages for each of the `live-*` packages included in your build and if you are not certain you can omit them, add them back into your package lists.

508

The more general consequence is that if you don't install recommended packages for any given package, that is, "packages that would be found together with this one in all but unusual installations" ( Debian Policy Manual, section 7.2 ), some packages that users of your Live system actually need may be omitted. Therefore, we suggest you review the difference turning off recommends makes to your packages list (see the `binary.packages` file generated by `lb build`) and re-include in your list any missing packages that you still want installed. Alternatively, if you find you only want a small number of recommended packages left out, leave recommends enabled and set a negative APT pin priority on selected packages to prevent them from being installed, as explained in APT pinning.

509

8.4.4 Przekazywanie opcji do apt lub aptitude

510

If there is not a `lb config` option to alter APT's behaviour in the way you need, use `--apt-options` or `--aptitude-options` to pass any options through to your configured APT tool. See the man pages for `apt` and `aptitude` for details. Note that both options have default values that you will need to retain in addition to any overrides you may provide. So, for example, suppose you have included something from `snapshot.debian.org` for testing purposes and want to specify `Acquire::Check-Valid-Until=false` to make APT happy with the stale `Release` file, you would do so as per the following example, appending the new option after the default value `--yes`:

511

$ lb config --apt-options "--yes -oAcquire::Check-Valid-Until=false"

512

Please check the man pages to fully understand these options and when to use them. This is an example only and should not be construed as advice to configure your image this way. This option would not be appropriate for, say, a final release of a live image.

513

For more complicated APT configurations involving `apt.conf` options you might want to create a `config/apt/apt.conf` file instead. See also the other `apt-*` options for a few convenient shortcuts for frequently needed options.

514

8.4.5 Pinning APT

515

For background, please first read the `apt_preferences(5)` man page. APT pinning can be configured either for build time, or else for run time. For the former, create `config/archives/*.pref`, `config/archives/*.pref.chroot`, and `config/apt/preferences`. For the latter, create `config/includes.chroot/etc/apt/preferences`.

516

Let's say you are building a trixie live system but need all the live packages that end up in the binary image to be installed from sid at build time. You need to add sid to your APT sources and pin the live packages from it higher, but all other packages from it lower, than the default priority. Thus, only the packages you want are installed from sid at build time and all others are taken from the target system distribution, trixie. The following will accomplish this:

517

$ echo "deb http://mirror/debian/ sid main" > config/archives/sid.list.chroot
$ cat >> config/archives/sid.pref.chroot << EOF
Package: live-*
Pin: release n=sid
Pin-Priority: 600
Package: *
Pin: release n=sid
Pin-Priority: 1
EOF

518

Negative pin priorities will prevent a package from being installed, as in the case where you do not want a package that is recommended by another package. Suppose you are building an LXDE image using `task-lxde-desktop` in `config/package-lists/desktop.list.chroot`, but don't want the user prompted to store wifi passwords in the keyring. This metapackage depends on lxde-core, which recommends gksu, which in turn recommends gnome-keyring. So you want to omit the recommended gnome-keyring package. This can be done by adding the following stanza to `config/apt/preferences`:

519

Package: gnome-keyring
Pin: version *
Pin-Priority: -1