# Package dependencies

Understand which extra packages a bundle includes and how to control recommended packages.

Source: https://debark.dev/docs/concepts/closure

---
A package often needs other packages to work. These are its **dependencies**. Dependencies can
have dependencies of their own; the complete set is sometimes called the **dependency closure**.

Debark asks apt to calculate this set using a target snapshot or the package assumptions of a
[baseline OS](/docs/get-started/no-target-machine). Packages already installed on the online
computer do not get skipped just because the builder has them.

## Why one package can mean several downloads

For example, `jq` uses libraries such as `libjq1` and `libonig5` on Debian 12. If the target
doesn’t have those libraries, they need to be included too.

```bash
debark build --snapshot target.tar.zst --out ./bundle \
  --sign operator.key jq
debark inspect ./bundle
```

The package count and download size depend on the target, its apt sources, and available
versions. The [lock file](/docs/concepts/lockfile) records the selected packages and why they
were included.

## Depends, Recommends and Suggests

| Relationship                | Meaning                                | What happens                                               |
| --------------------------- | -------------------------------------- | ---------------------------------------------------------- |
| `Depends` and `Pre-Depends` | Required for installation or operation | apt includes the needed packages                           |
| `Recommends`                | Normally installed with the package    | Follows the target’s captured `Install-Recommends` setting |
| `Suggests`                  | Optional related software              | Not normally included                                      |

To leave out recommended packages:

```bash
debark build --snapshot target.tar.zst --out ./bundle \
  --sign operator.key --no-recommends jq
```

This can reduce downloads, but it can also omit useful plugins or other expected features.
Use `--recommends` to explicitly include recommended packages instead. Do not combine the
two flags. Without either flag, Debark follows the captured setting.

## Requesting a version

Use `name=version` to request a specific version. That version and its dependencies must be
available from the target’s sources.

If apt cannot satisfy the request, the build reports an error. Check the package version,
the target’s apt sources, and any version restrictions in its settings.

## Vendor packages

A local .deb file or download URL can be part of the request. Debark also resolves its
dependencies from the target’s apt sources. See [vendor packages](/docs/guides/vendor-debs).

## What dependency checks cannot guarantee

A complete set of .deb files can still encounter installation problems:

- A package’s setup script may download extra software or contact a service.
- A DKMS driver may need headers for the kernel running on the offline machine.
- An Ubuntu package may be a small installer for a Snap app, which isn’t included in an apt bundle.
- The offline machine may have changed since you captured the snapshot.

Run [doctor](/docs/guides/policy-and-doctor) before transfer and preview the installation on
the target. Doctor looks for known patterns; it cannot prove that every package will work offline.

<NextSteps
  items={[
    {
      title: 'Vendor .deb files',
      href: '/docs/guides/vendor-debs',
      description: 'Include software downloaded outside apt.',
    },
    {
      title: 'Check a bundle',
      href: '/docs/guides/policy-and-doctor',
      description: 'Look for common offline installation problems.',
    },
  ]}
/>
