Skip to content

[Bug]: Debian salt-minion 3007.8 package pre-installation script fails #68460

@votdev

Description

@votdev

What happened?

When the Debian salt-minion 3007.8 package is installed and an older (non-onedir) package is already installed, the upgrade code path is taken into action in salt-minion.preinst.

dpkg: considering deconfiguration of salt-common, which would be broken by installation of salt-minion ...
dpkg: yes, will deconfigure salt-common (broken by salt-minion)
Preparing to unpack .../salt-minion_3007.8_amd64.deb ...
De-configuring salt-common (3006.0+ds-1+240.1), to allow installation of salt-minion (3007.8) ...
/var/lib/dpkg/tmp.ci/preinst: 27: /opt/saltstack/salt/bin/python3: not found
dpkg: error processing archive /var/cache/apt/archives/salt-minion_3007.8_amd64.deb (--unpack):
 new salt-minion package pre-installation script subprocess returned error exit status 127
/usr/lib/python3/dist-packages/salt/ext/tornado/test/web_test.py:360: SyntaxWarning: invalid escape sequence '\?'
  'http://example.com/login\?next=http%3A%2F%2F127.0.0.1%3A[0-9]+%2Fabsolute',
/usr/lib/python3/dist-packages/salt/ext/tornado/util.py:250: SyntaxWarning: invalid escape sequence '\d'
  ``\d`` cannot be unescaped).
salt-minion.service is a disabled or a static unit not running, not starting it.
dpkg: considering deconfiguration of salt-minion, which would be broken by installation of salt-common ...
dpkg: yes, will deconfigure salt-minion (broken by salt-common)
Preparing to unpack .../salt-common_3007.8_amd64.deb ...
De-configuring salt-minion (3006.0+ds-1+240.1), to allow installation of salt-common (3007.8) ...
Adding group salt....done
Adding system user salt....done
Unpacking salt-common (3007.8) over (3006.0+ds-1+240.1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/salt-minion_3007.8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

In the salt-minion.preinst script an attempt is made to determine the Python version. To do this, /opt/saltstack/salt/bin/python3 is called. However, if an upgrade is performed from a version (e.g., 3006.0+ds-1+240.1) that is not yet an onedir installation, /opt/saltstack/salt/bin/python3 simply does not yet exist and the script fails hard due to set -e.

This call is not necessary because the local variable PY_VER is not used anywhere in the script nor is it exported so that other scripts might consume it.

To prevent the error simply remove the useless line

PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();")

Type of salt install

Official deb

Major version

3007.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

debian-12

salt --versions-report output

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions