postinstall.sh
should detect chrooted environments to prevent dpkg failures
#767
Labels
postinstall.sh
should detect chrooted environments to prevent dpkg failures
#767
Description
When installing
otelcol
in chrooted environments (e.g.,chroot
orsystemd-nspawn
), the installation fails because thepostinstall.sh
script attempts to runsystemctl
commands to start and enable systemd services.In these environments,
systemd
is not running as PID 1, which causes the script to fail. As a result:dpkg
enters a broken state.dpkg
keeps retrying the failingpostinstall
script.This is extremely critical for automated workflows.
Error Output
Below is the error message observed during installation:
Steps to Reproduce
chroot
orsystemd-nspawn
environment.otelcol
usingdpkg
(e.g.,dpkg -i otelcol-contrib.deb
).systemctl
commands inpostinstall.sh
.Expected Behavior
The script should check whether
systemd
is running before executingsystemctl
commands. Ifsystemd
is not active, the script should safely skip service-related operations.Proposed Solution
Modify
postinstall.sh
to verify ifsystemd
is running as PID 1 before callingsystemctl
. For example:This ensures that the
systemctl
commands only run in appropriate environments, avoiding failures in chrooted setups.The text was updated successfully, but these errors were encountered: