Skip to content

[Bug]: salt-proxy reports Proxymodule napalm is missing an init() or a shutdown() or both #69139

Closed

Description

@z900collector

What happened?

Brand new "clean" RHEL/OL9.7 Minimal OS install with 3006.23 salt-minion

used salt-pip install napalm
no errors during install also rebuild VM and tried pip3 install napalm from /opt/saltstack/salt/bin

salt-proxy --proxyid=n9ktest

then:

[root@tri-net-proxy-01 extras-3.10]# salt-proxy --proxyid=n9ktest
[ERROR   ] Proxymodule napalm is missing an init() or a shutdown() or both. Check your proxymodule.  Salt-proxy aborted.
[ERROR   ] Proxymodule napalm is missing an init() or a shutdown() or both. Check your proxymodule.  Salt-proxy aborted.
The Salt ProxyMinion is shutdown.
Proxymodule napalm is missing an init() or a shutdown() or both. Check your proxymodule.  Salt-proxy aborted.
[root@tri-net-proxy-01 extras-3.10]#

Attempted restarts of the salt-minion
pillar file on master: /srv/pillar/n9ktest.sls

proxy:
  id: n9ktest
  proxytype: napalm
  driver: nxos
  host: 192.168.1.1
  user: admin
  username: admin
  password: password
  passwd: password
  key_accept: True
  optional_args:
    secret: password
    keepalive: 30

/etc/salt/proxy contains:

master: <salt-master-here>
mine_enabled: true
multiprocessing: false

I've followed all the guides and the same error occurs... any help appreciated.

Type of salt install

Official rpm

Major version

3006.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)

oraclelinux-9

salt --versions-report output

# salt-minion --versions-report
Salt Version:
          Salt: 3006.23

Python Version:
        Python: 3.10.19 (main, Feb 17 2026, 23:32:03) [GCC 11.2.0]

Dependency Versions:
          cffi: 2.0.0
      cherrypy: 18.10.0
  cryptography: 46.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.3
         PyZMQ: 23.2.0
        relenv: 0.22.4
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: oracle 9.7
        locale: utf-8
       machine: x86_64
       release: 6.12.0-200.74.27.1.el9uek.x86_64
        system: Linux
       version: Oracle Linux Server 9.7




salt-pip list
...
napalm             5.1.0
...

Activity

  1. added
    bug
    on May 13, 2026
  2. z900collector commented on May 13, 2026

    @z900collector
    Author

    ls -la /opt/saltstack/salt/extras-3.10/

    drwxr-xr-x.  13 root root   4096 May 13 13:26 napalm
    drwxr-xr-x.   3 root root    144 May 13 13:26 napalm-5.1.0.dist-info
    
    
  3. z900collector commented on May 14, 2026

    @z900collector
    Author

    Some progress on this, rebuilt a new VM OS is RHEL 9.7 with salt 3007.13
    There appears to be some versioning issues:

    /opt/saltstack/salt/bin/python3 -m pip uninstall setuptools
    /opt/saltstack/salt/bin/python3 -m pip install setuptools==81.0.0
    /opt/saltstack/salt/bin/python3 -m pip uninstall -y ssh paramiko netmiko napalm
    /opt/saltstack/salt/bin/python3 -m pip install paramiko==2.12.0 netmiko==4.3.0 napalm

    Edit napalm.py (Need to recheck this):

    vi /opt/saltstack/salt/lib/python3.10/site-packages/salt/proxy/napalm.py

    __virtualname__ = 'napalm'
    def __virtual__():
         import salt.utils.platform
         if salt.utils.platform.is_proxy():
            return __virtualname__
         return (False, "Not a proxy minion")
    
    salt-proxy --proxyid=n9ktest -l debug
    .......
    [DEBUG   ] The functions from module 'core' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'extra' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'napalm' are being loaded by dir() on the loaded module
    [DEBUG   ] Override  __utils__: <module 'salt.loaded.int.grains.zfs' from '/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/zfs.py'>
    [DEBUG   ] Unable to derive osmajorrelease from osrelease_info '('proxy',)'. The osmajorrelease grain will not be set.
    [DEBUG   ] Starting new HTTPS connection (1): 172.16.252.250:443
    [DEBUG   ] https://172.16.252.250:443 "POST /ins HTTP/1.1" 200 None
    [DEBUG   ] Starting new HTTPS connection (1): 172.16.252.250:443
    

    Still need to test out the rest of the functionality but installing specific packages appears to be a "fix".

  4. added a commit that references this issue on Jun 6, 2026
    2d6ce34
  5. added this to the Sulphur v3006.26 milestone on Jun 6, 2026
  6. added 4 commits that reference this issue on Jun 7, 2026
    41e5f9e
    0568f1f
    fe1f8cd
    43b2d98
  7. ggiesen commented on Jul 11, 2026

    @ggiesen
    Contributor

    I hit this same "Proxymodule napalm is missing an init()" on 3006.x and traced it to a Salt loader bug rather than a napalm/paramiko version problem. The clearer error text from #69330 helped confirm it: the real failure is that import napalm raises inside salt.utils.napalm, so HAS_NAPALM is False and the napalm proxy/execution modules never pass their __virtual__ gate.

    Root cause. Salt's LazyLoader puts its own source directories on the global sys.path while a module body executes (salt/loader/lazy.py: __populate_sys_path, and the fpath_dirname append in _load_module). When salt.utils.napalm runs its top-level import napalm, that pulls in jnpr.junos -> ncclient.transport, and ncclient does a bare import ssh to detect ssh-python (libssh). With salt/utils on sys.path, that bare import ssh binds to Salt's own salt/utils/ssh.py (a plain module, not the ssh-python package) and gets cached in sys.modules['ssh']. ncclient then runs from ssh.channel import Channel and hits:

    ModuleNotFoundError: No module named 'ssh.channel'; 'ssh' is not a package
    

    which aborts import napalm. HAS_NAPALM is then False for the life of the process, and the proxy reports "missing an init()".

    Two things line up to trigger it:

    • junos-eznc 2.8.2 pins ncclient==0.7.0, and ncclient 0.7.0 is the first release to probe for libssh with try: import ssh (ncclient PR saltutil module documentation missing from RTD #639). Salt's ssh shadow turns that probe into a false positive, so ncclient imports its libssh transport, which then fails on the shadowed module. ncclient 0.7.1 switched the probe to importlib.metadata (ncclient PR Add ability to set PKG_PATH env var before running FreeBSD pkg state #652) and is immune to the shadow, but the junos-eznc pin keeps 0.7.0 in place.
    • ssh-python is only an optional ncclient[libssh] extra, so it is normally absent. Without Salt's shadow, the bare import ssh would just ImportError and ncclient would skip libssh cleanly.

    The workaround in this thread (downgrade paramiko/netmiko, remove ssh-python) works because it stops anything from wanting the libssh path. But the underlying bug is the loader shadowing top-level imports, and it is general: any salt/utils/*.py (or salt/modules/*.py, etc.) whose stem matches a top-level package that some third-party library imports can shadow it the same way. ssh is just the one that bites napalm.

    Fix. Stop the loader from putting Salt-internal directories on sys.path. Salt-internal modules are imported via their fully-qualified salt.* names, so they never needed sys.path; only external/custom module dirs do (so a custom module's bare sibling imports still resolve). Two small edits in salt/loader/lazy.py, gated on SALT_BASE_PATH:

    • __populate_sys_path: skip any directory under SALT_BASE_PATH.
    • _load_module: only append fpath_dirname when fpath is not under SALT_BASE_PATH.

    I validated this on a real 3006.26 onedir install (Rocky 9) running a napalm deltaproxy against live Junos devices: with the loader fix applied and the pinned, still-"broken" ncclient 0.7.0 in place, napalm loads and the sub-proxies initialize with no KeyError: 'napalm.init'. Reverting the two edits reproduces the failure.

    Happy to open a PR with the two edits plus a loader regression test (load an internal module whose import chain does a bare import <stem> matching a salt/utils file, and assert sys.modules['<stem>'] stays the real package). Since this is the actual root cause and the loader shadow affects more than just napalm, it may be worth reopening this or tracking it separately from the message fix in #69330.

  8. ggiesen commented on Jul 11, 2026

    @ggiesen
    Contributor

    Opened #69787 with the loader fix (skip Salt-internal dirs when populating sys.path) plus a regression test. Validated on a real 3006.26 onedir + live-Junos napalm deltaproxy with the pinned ncclient 0.7.0 still in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions