> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/configuration/bindplane-otel-collector/linux-package-configuration.md).

# Linux Package Configuration

Configure the Bindplane OTEL Collector Linux package installation behavior

The Bindplane OTEL Collector Linux packages (deb and rpm) read an optional configuration file that changes how the collector is installed: where it is installed, which user it runs as, and whether the package creates that user. A default install doesn't need this file. If you need these settings, create the file **before** the first install, and keep it in place, unchanged, for as long as the collector is installed.

### Configuration File

Create the configuration file at one of the following locations:

* Debian-based distributions: `/etc/default/observiq-otel-collector`
* RHEL-based distributions: `/etc/sysconfig/observiq-otel-collector`

The package reads both locations on every distribution. If both files exist, a value set in `/etc/sysconfig/observiq-otel-collector` overrides the same value in `/etc/default/observiq-otel-collector`. Use one file.

The file uses shell variable syntax, one `NAME=value` setting per line. See [Example Configuration](#example-configuration).

#### File Permissions

The configuration file should have the following permissions:

* Owner: `root`
* Group: `root`
* Permissions: `0644` (readable by all users, writable only by root)

```bash
sudo chown root:root /etc/default/observiq-otel-collector
sudo chmod 0644 /etc/default/observiq-otel-collector
```

The configuration file is read by:

* The install script.
* The package manager, each time it installs, upgrades, or removes the package.
* The collector's updater, during upgrades started from Bindplane. On a non-root install the updater runs as the runtime user, so that user needs read access to the file.

#### Keep the File for the Life of the Install

{% hint style="warning" %}
**IMPORTANT**

Write the configuration file before the first install, and don't change or remove it while the collector is installed. Every install, upgrade, and uninstall reads it.

As of collector v1.113.0, the package refuses an install or upgrade that would change `BDOT_UNPRIVILEGED` or `BDOT_USER` on an existing install. To change any setting, uninstall the collector and install it again. See [Change the Runtime User](#change-the-runtime-user).
{% endhint %}

On RHEL-based distributions, uninstalling the package (`rpm -e`, `dnf remove`, or `yum remove`) deletes `/etc/sysconfig/observiq-otel-collector`. Write the file again before you reinstall.

### Change the Runtime User

The runtime user is the user the collector service runs as. It is `root` by default, or the `BDOT_USER` user (`bdot` by default) when `BDOT_UNPRIVILEGED=true` is set. It is set when the collector is first installed.

As of collector v1.113.0, the package refuses an install or upgrade that would change the runtime user of an existing install. This includes:

* Switching a non-root install to root, for example by removing `BDOT_UNPRIVILEGED=true` from the configuration file, or by deleting the file.
* Switching a non-root install to a different `BDOT_USER`.
* Switching an existing root install to non-root by adding `BDOT_UNPRIVILEGED=true`.

The package refuses the install before it changes any files, and the installed collector is left as it was. For a non-root install that runs as `bdot`, the error looks like this:

```
ERROR: The collector service runs as "bdot", set by /etc/systemd/system/observiq-otel-collector.service.d/10-package-customizations-username.conf.
Changing BDOT_UNPRIVILEGED or BDOT_USER on an existing install is not supported. To change them, uninstall the package, remove /opt/observiq-otel-collector, and install it again.
To keep the existing install, set these values in /etc/default/observiq-otel-collector, as described at https://docs.bindplane.com/configuration/bindplane-otel-collector/linux-package-configuration:
    BDOT_UNPRIVILEGED=true
    BDOT_USER=bdot
Then install the package again.
```

For a root install, the first line reads `ERROR: The collector service runs as "root", since there is no /etc/systemd/system/observiq-otel-collector.service.d/10-package-customizations-username.conf.`, and the value to set is `BDOT_UNPRIVILEGED=false`.

You have two ways forward: keep the existing install, or switch the runtime user by reinstalling.

#### Keep the Existing Install

To keep the collector running as its current user, set the values the error prints in the configuration file it names, then run the same install or upgrade again.

{% hint style="danger" %}
If the error says the service runs as `"root"` because there is no `10-package-customizations-username.conf`, but the collector was installed with `BDOT_UNPRIVILEGED=true`, the package's drop-in was deleted, for example by `systemctl revert observiq-otel-collector`. Don't set `BDOT_UNPRIVILEGED=false`. The former runtime user owns the collector's files, and installing as root over them isn't safe. Reinstall the collector as described in [Switch Between Root and Non-Root](#switch-between-root-and-non-root).
{% endhint %}

#### Switch Between Root and Non-Root

To change the runtime user, remove the collector and its installation directory, then install it again with the new configuration. The same steps apply when moving from root to non-root, from non-root to root, or to a different `BDOT_USER`.

{% hint style="warning" %}
**Data loss**

Deleting the installation directory removes:

* `manager.yaml`, which holds the collector's agent ID. The reinstalled collector connects to Bindplane as a new collector. The old collector shows as disconnected, and you can delete it.
* `storage/`, which holds persistent queue data and file read positions. Data waiting in a persistent queue is lost, and file sources start reading again from their configured start position.
* `config.yaml`. Bindplane sends the configuration to the new collector when it connects.
  {% endhint %}

1. Uninstall the collector:

   ```bash
   sudo sh -c "$(curl -fsSlL https://github.com/observIQ/bindplane-otel-collector/releases/latest/download/install_unix.sh)" install_unix.sh -r
   ```

   You can also remove the package with your package manager, for example `sudo apt remove observiq-otel-collector` or `sudo dnf remove observiq-otel-collector`.
2. Remove any `User=` or `Group=` settings you added to the service yourself, for example by following an earlier version of the [Downgrade Collector Privileges](https://docs.bindplane.com/how-to-guides/collector-management/downgrade-collector-privileges.md) guide. Uninstalling removes only the package's own drop-in. List the remaining drop-ins:

   ```bash
   ls /etc/systemd/system/observiq-otel-collector.service.d/
   ```

   Delete a file such as `override.conf` if it only sets `User=` or `Group=`, or edit it to remove those lines. Keep any other settings you rely on, such as `Environment=` lines. Then reload systemd:

   ```bash
   sudo systemctl daemon-reload
   ```
3. Delete the installation directory. If you set `BDOT_CONFIG_HOME`, delete that directory instead.

   ```bash
   sudo rm -rf /opt/observiq-otel-collector
   ```
4. Write the configuration file with the new values:

   * To run as non-root, set `BDOT_UNPRIVILEGED=true`, and optionally `BDOT_USER` and `BDOT_GROUP`. Make sure the `sudo` package is installed, so that upgrades from Bindplane work. See [Remote Upgrades](#remote-upgrades).
   * To run as root, remove `BDOT_UNPRIVILEGED` and `BDOT_USER` from the file, or set `BDOT_UNPRIVILEGED=false`.

   On RHEL-based distributions, uninstalling deleted `/etc/sysconfig/observiq-otel-collector`, so write it again.
5. Install the collector with the install command from Bindplane. See [Install Your First Collector](https://docs.bindplane.com/readme/install-your-first-collector.md).
6. Check that the collector runs as the expected user:

   ```bash
   ps -o user=,pid=,cmd= -C observiq-otel-collector
   ```
7. In Bindplane, delete the old, disconnected collector.

{% hint style="danger" %}
**Always delete the installation directory after uninstalling a non-root install**

On a non-root install, the runtime user owns the installation directory and the files in it, but the package installs and upgrades as root. If you reinstall without deleting the directory, root works on files the former runtime user controlled. Those can include symbolic links planted to redirect root's writes.

This applies even to a plain reinstall. On RHEL-based distributions, uninstalling deletes `/etc/sysconfig/observiq-otel-collector`, so a reinstall without that file installs as root. The package can't detect this case, because uninstalling also removes the drop-in it checks.
{% endhint %}

### Configuration Options

#### BDOT\_SKIP\_RUNTIME\_USER\_CREATION

Controls whether the package creates the runtime user and group (`bdot` by default) during installation. This option is useful if you have advanced user requirements, such as a specific uid and gid, or you are integrating with an external authentication system such as LDAP.

{% hint style="info" %}
**NOTE**

This configuration option is supported as of collector version v1.82.0.
{% endhint %}

* **Default**: `false`
* **Values**: `true` or `false`

When set to `true`, the package skips creating the user and group. In this case, you must create them before installation. If the user doesn't exist, the install fails.

The following commands create the `bdot` user and group. If you set `BDOT_USER` or `BDOT_GROUP`, use those names instead.

```bash
groupadd bdot
useradd \
  --shell /sbin/nologin \
  --system bdot \
  -g bdot
```

You can verify this parameter is working correctly by inspecting the output from the package installation.

The following is logged when skipping user and group creation:

> BDOT\_SKIP\_RUNTIME\_USER\_CREATION is set to true, checking if bdot user exists
>
> User bdot exists, skipping user and group creation

#### BDOT\_CONFIG\_HOME

Specifies the directory where the Bindplane OTEL Collector is installed and stores its data.

{% hint style="info" %}
**NOTE**

This configuration option is supported as of collector version v1.82.0.
{% endhint %}

* **Default**: `/opt/observiq-otel-collector`
* **Values**: Any valid directory path

This directory contains:

* The collector and updater binaries
* Configuration files, including `config.yaml`, `logging.yaml`, and `manager.yaml`
* Log files, in `log/`
* Persistent data, such as persistent queues and file read positions, in `storage/`

The directory is owned by the runtime user (`BDOT_USER`). Choose a location that meets your storage and backup requirements before installation.

You can verify this parameter is working correctly by checking the installation directory and the Systemd service file for the Bindplane OTEL Collector service.

Read the Systemd service file for the Bindplane OTEL Collector service:

```bash
sudo systemctl cat observiq-otel-collector
```

The output will contain the working directory and executable path matching the value you set in the configuration file.

```ini
# /usr/lib/systemd/system/observiq-otel-collector.service
[Unit]
Description=observIQ's distribution of the OpenTelemetry collector
After=network.target
StartLimitIntervalSec=120
StartLimitBurst=5
[Service]
Type=simple
User=root
Group=bdot
Environment=PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=BINDPLANE_COLLECTOR_HOME=/opt/observiq-otel-collector
Environment=BINDPLANE_COLLECTOR_STORAGE=/opt/observiq-otel-collector/storage
WorkingDirectory=/opt/observiq-otel-collector
ExecStart=/opt/observiq-otel-collector/observiq-otel-collector --config config.yaml
LimitNOFILE=65000
SuccessExitStatus=0
TimeoutSec=20
StandardOutput=journal
Restart=on-failure
RestartSec=5s
KillMode=process
[Install]
WantedBy=multi-user.target
```

Collector versions before v1.103.0 set `OIQ_OTEL_COLLECTOR_HOME` and `OIQ_OTEL_COLLECTOR_STORAGE` instead of `BINDPLANE_COLLECTOR_HOME` and `BINDPLANE_COLLECTOR_STORAGE`.

#### BDOT\_UNPRIVILEGED

Controls whether the Bindplane OTEL Collector runs as the `BDOT_USER` user (`bdot` by default) instead of `root`.

{% hint style="info" %}
**NOTE**

This configuration option is supported as of collector version v1.82.0. Remote upgrades of non-root collectors are supported as of v1.113.0. See [Remote Upgrades](#remote-upgrades).
{% endhint %}

* **Default**: `false`
* **Values**: `true` or `false`

When set to `true`, the collector runs as the `BDOT_USER` user. This follows the principle of least privilege, and suits collectors that don't need access to host resources, such as gateways that receive OTLP.

When set to `false`, the collector runs as `root`. Some sources need root, for example to read log files owned by other users, bind to ports below 1024, collect per-process metrics, or capture packets.

Set this option before the first install. It can't be changed on an existing install. See [Change the Runtime User](#change-the-runtime-user).

{% hint style="info" %}
**NOTE**

Running as non-root requires systemd. On hosts without systemd, the collector runs as `root` even when `BDOT_UNPRIVILEGED=true` is set.
{% endhint %}

When `BDOT_UNPRIVILEGED=true` is set, the package:

* Writes a systemd drop-in, `/etc/systemd/system/observiq-otel-collector.service.d/10-package-customizations-username.conf`, that sets `User=bdot`. The main unit file still shows `User=root`, and the drop-in overrides it.
* Makes the runtime user the owner of the installation directory, and copies files into it as that user.
* Writes a sudoers rule so the collector can be upgraded from Bindplane. See [Remote Upgrades](#remote-upgrades).

{% hint style="warning" %}
**IMPORTANT**

Root owns the package's drop-in, and the package uses it to tell which user an install runs as. Don't edit or delete it, and don't run `systemctl revert observiq-otel-collector`, which deletes it. Don't set `User=` or `Group=` in drop-ins of your own.
{% endhint %}

You can verify this parameter is working correctly by checking the runtime user of the Bindplane OTEL Collector process:

```bash
ps -o user=,pid=,cmd= -C observiq-otel-collector
```

The output shows the process running as the `bdot` user when unprivileged mode is enabled. `sudo systemctl cat observiq-otel-collector` also shows the package's drop-in, with `User=bdot`, after the main unit file.

**Remote Upgrades**

{% hint style="info" %}
**NOTE**

Upgrades from Bindplane work for non-root collectors running v1.113.0 or later, on systemd hosts with `sudo` installed. A non-root collector running an earlier version must first be upgraded to v1.113.0 or later with the install script or the package manager. That upgrade writes the sudoers rule, and later upgrades can be made from Bindplane.
{% endhint %}

The updater runs as the runtime user, so it uses `sudo` to stop and start the collector service while it replaces the collector's files. The package writes a sudoers rule, `/etc/sudoers.d/bindplane-otel-collector`, that allows the runtime user to run exactly these two commands as root:

```
Defaults:bdot !requiretty
bdot ALL=(root) NOPASSWD: /usr/bin/systemctl start observiq-otel-collector.service
bdot ALL=(root) NOPASSWD: /usr/bin/systemctl stop observiq-otel-collector.service
```

The file also contains comments, and the path to `systemctl` is the one found on the host. The `Defaults` line turns off `requiretty` for the runtime user only, because the updater has no terminal. It grants nothing.

* Don't edit the sudoers file. The package writes it again on every install and upgrade, and removes it when the collector is uninstalled.
* Install `sudo` before you install the collector. If `sudo` isn't installed, the collector still runs, but the package doesn't write the rule and prints the following warning. Install `sudo`, then reinstall or upgrade the collector with the install script or the package manager.

  ```
  WARNING: sudo is not installed (visudo not found), so the sudoers drop-in was not written and remote updates will fail. Install sudo, then reinstall or upgrade this package.
  ```
* Upgrades from Bindplane don't update the systemd unit file, because the runtime user can't write it. Changes to the unit file in a new version apply the next time you upgrade with the install script or the package manager.

#### BDOT\_USER and BDOT\_GROUP

Controls the runtime user and group. Usually used in conjunction with `BDOT_UNPRIVILEGED`.

{% hint style="info" %}
**NOTE**

This configuration option is supported as of collector version v1.84.0.
{% endhint %}

* **Default**: `bdot` for both
* **Values**: Any valid user or group name

The package creates the user and group unless `BDOT_SKIP_RUNTIME_USER_CREATION=true` is set. The service always runs with `BDOT_GROUP` as its group. It runs as `BDOT_USER` only when `BDOT_UNPRIVILEGED=true` is set.

When `BDOT_UNPRIVILEGED=true` is set on a systemd host, `BDOT_USER` must be a plain user name, because it is written into the sudoers rule. It may contain only letters, digits, `_`, `.`, and `-`. It must not start with `-` and must not be all upper case. Otherwise the install fails with:

```
ERROR: BDOT_USER "<name>" can't be used in a sudoers rule
```

Like `BDOT_UNPRIVILEGED`, `BDOT_USER` can't be changed on an existing non-root install. See [Change the Runtime User](#change-the-runtime-user).

### Example Configuration

A configuration file that runs the collector as the `bdot` user:

```ini
# Run the collector as the bdot user instead of root
BDOT_UNPRIVILEGED=true
```

A configuration file that uses every option:

```ini
# Skip user creation for LDAP integration.
# The system administrator must create the
# user and group before installing.
BDOT_SKIP_RUNTIME_USER_CREATION=true

# Install collector in a custom location
BDOT_CONFIG_HOME=/opt/custom-collector

# Run collector as unprivileged user
BDOT_UNPRIVILEGED=true

# Run collector as user "otelu" and group "otelg"
BDOT_USER=otelu
BDOT_GROUP=otelg
```

### Troubleshooting

#### Install or Upgrade Refused

If installing or upgrading the collector fails with an error that starts with `ERROR: The collector service runs as`, the install or upgrade would change the user the collector runs as. The package refuses before it changes any files, and the installed collector keeps running as before. To keep the existing install, or to switch the runtime user by reinstalling, see [Change the Runtime User](#change-the-runtime-user).

#### Remote Upgrade Fails on a Non-Root Collector

When an upgrade from Bindplane fails on a non-root collector, it usually fails when the updater runs `sudo -n systemctl stop observiq-otel-collector.service`. The updater logs to `/opt/observiq-otel-collector/log/updater.log`. The package checks for the following problems when it installs, and prints a warning for each one it finds.

**Service settings that block `sudo`.** These systemd settings turn on `no_new_privs` for a non-root service, which stops `sudo` from working inside it. Don't add them to the service's drop-ins:

`NoNewPrivileges=`, `RestrictSUIDSGID=`, `PrivateDevices=`, `ProtectKernelTunables=`, `ProtectKernelModules=`, `ProtectKernelLogs=`, `ProtectClock=`, `MemoryDenyWriteExecute=`, `RestrictRealtime=`, `LockPersonality=`, `DynamicUser=`, `SystemCallFilter=`, `SystemCallArchitectures=`, and `RestrictAddressFamilies=`.

The package warns with `WARNING: observiq-otel-collector.service sets ..., which turns on no_new_privs and stops sudo from working inside the service, so remote updates will fail.` To fix it, remove the settings, then run `sudo systemctl daemon-reload` and `sudo systemctl restart observiq-otel-collector`.

**Sudo doesn't use the rule.** The package warns with `WARNING: sudo does not allow bdot to run the commands in /etc/sudoers.d/bindplane-otel-collector, so remote updates will fail.` Check the following:

* `/etc/sudoers` must have an `@includedir /etc/sudoers.d` line, or sudo doesn't read the rule.
* If `/etc/nsswitch.conf` has a `sudoers:` line, it must list `files`.
* A `Defaults requiretty` line that sudo reads after the rule overrides the rule's `!requiretty`.
* Run `sudo -l -U bdot` to see the rules sudo applies to the runtime user.

**Sudo isn't installed.** Install `sudo`, then reinstall or upgrade the collector with the install script or the package manager, so the package writes the rule.

**The package's drop-in was deleted.** If `systemctl revert observiq-otel-collector` or another change removed `10-package-customizations-username.conf`, the service runs as `root` after its next restart, and the next install or upgrade is refused. Reinstall the collector as described in [Switch Between Root and Non-Root](#switch-between-root-and-non-root).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bindplane.com/configuration/bindplane-otel-collector/linux-package-configuration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
