Skip to content

linuxmuster-api.service crashes: pexpect missing from linuxmusterTools/requirements.txt #28

Description

@HappyBasher

Problem

After upgrading to 7.4 (linuxmuster-tools7 7.4.13), linuxmuster-api.service
fails to start:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/linuxmusterApi/main.py", line 19, in <module>
    from utils.checks import check_tmp_dir
  File "/usr/lib/python3/dist-packages/linuxmusterApi/utils/checks.py", line 6, in <module>
    from linuxmusterTools.passwords import PasswordRules
  File "/usr/lib/python3/dist-packages/linuxmusterTools/passwords/__init__.py", line 1, in <module>
    from .policy import *
  File "/usr/lib/python3/dist-packages/linuxmusterTools/passwords/policy.py", line 21, in <module>
    from linuxmusterTools.samba_util import DomainPasswordSettings, DomainPasswordSettingsManager
  File "/usr/lib/python3/dist-packages/linuxmusterTools/samba_util/__init__.py", line 7, in <module>
    from .dns import *
  File "/usr/lib/python3/dist-packages/linuxmusterTools/samba_util/dns.py", line 4, in <module>
    import pexpect
ModuleNotFoundError: No module named 'pexpect'

Root cause

usr/lib/python3/dist-packages/linuxmusterTools/samba_util/dns.py imports
pexpect directly, but pexpect is not listed in
usr/lib/python3/dist-packages/linuxmusterTools/requirements.txt:

configobj
python-ldap
pyyaml
smbprotocol==1.14.0

It happens to already be present as a transitive dependency pulled in by
linuxmuster-webui7's own separate requirements (aj -> pexpect), which
apparently masked this for consumers that get installed alongside webui7,
but any consumer that doesn't happen to pull it in some other way -
linuxmuster-api7 in this case - crashes on import.

Fix

Add pexpect to linuxmusterTools/requirements.txt so it's installed for
every consumer of the shared library, not just ones that happen to need it
transitively for an unrelated reason.

How this was found

Discovered while testing linuxmuster-release-upgrade idempotency (linuxmuster-base7 #191) on a real Ubuntu 26.04 test server upgrading from 7.3 to 7.4.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions