Skip to content

[TECH DEBT] DeprecationWarning: 'spwd' is deprecated and slated for removal in Python 3.13 #64264

Closed

Description

@j5k

Description of the tech debt to be addressed, include links and screenshots

/usr/lib/python3.11/site-packages/salt/modules/linux_shadow.py:21: DeprecationWarning: 'spwd' is deprecated and slated for removal in Python 3.13
  import spwd

Versions Report

Salt Version:
          Salt: 3006.1
 
Python Version:
        Python: 3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201]
 
Dependency Versions:
          cffi: 1.15.1
      cherrypy: Not Installed
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.1.2
      M2Crypto: 0.38.0
          Mako: 1.2.4
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.12.0
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 25.0.2
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: Arch Linux | Kernel: 6.3.1 
        locale: utf-8
       machine: x86_64
       release: 6.3.1-arch1-1
        system: Linux
       version: Arch Linux | Kernel: 6.3.1

Activity

  1. added this to the Chlorine v3007.0 milestone on May 9, 2023
  2. OrangeDog commented on Nov 29, 2023

    @OrangeDog
    Contributor

    Also from PEP-594:

    In general, it’s a bad idea to use spwd. It circumvents system security policies, does not use the PAM stack, and is only compatible with local user accounts, because it ignores NSS. The use of the spwd module for access control must be considered a security bug, as it bypasses PAM’s access control.

    It is currently imported by salt.modules.linux_shadow and salt.modules.solaris_shadow.

  3. foudfou commented on Nov 20, 2025

    @foudfou

    Yep. So now it's actually gone:

          File "/var/tmp/.ubuntu_8f32de_salt/pyall/salt/modules/linux_shadow.py", line 74, in info
            getspnam = functools.partial(spwd.getspnam)
                                         ^^^^
        NameError: name 'spwd' is not defined
    

    Any patch/mitigation anyone?

    Salt-report:

     Salt Version:
              Salt: 3007.8
    
    Python Version:
            Python: 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
    
    Dependency Versions:
              cffi: 2.0.0
          cherrypy: 18.10.0
      cryptography: 46.0.3
          dateutil: 2.9.0
         docker-py: 7.1.0
             gitdb: Not Installed
         gitpython: Not Installed
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.3.0
          M2Crypto: Not Installed
              Mako: 1.3.10
           msgpack: 1.1.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 25.0
         pycparser: 2.23
          pycrypto: 3.23.0
      pycryptodome: 3.23.0
            pygit2: Not Installed
      python-gnupg: 0.5.5
            PyYAML: 6.0.3
             PyZMQ: 27.1.0
            relenv: Not Installed
             smmap: Not Installed
           timelib: Not Installed
           Tornado: 6.5.2
               ZMQ: 4.3.5
    
    Salt Package Information:
      Package Type: Not Installed
    
    System Versions:
              dist: arch
            locale: utf-8
           machine: x86_64
           release: 6.12.58-1-lts
            system: Linux
           version: Arch Linux
    
  4. dwoz commented on Jul 2, 2026

    @dwoz
    Contributor

    Fix merged and shipped in a supported release. Closing per bulk triage. Reopen if this reproduces on a currently supported release (3006.x, 3007.x, 3008.x, master).

  5. added a commit that references this issue on Jul 3, 2026
    8e1e974
  6. lcsiki commented on Jul 7, 2026

    @lcsiki

    This persists on 3006.27 I'm afraid.

    $ date
    Tue Jul  7 03:59:43 AM EDT 2026
    $ salt-call replicate.64264
    /opt/saltstack/salt/lib/python3.11/site-packages/salt/utils/pycrypto.py:27: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
      import crypt  # pylint: disable=deprecated-module
    /opt/saltstack/salt/lib/python3.11/site-packages/salt/modules/linux_shadow.py:21: DeprecationWarning: 'spwd' is deprecated and slated for removal in Python 3.13
      import spwd  # pylint: disable=deprecated-module
    'replicate.64264' is not available.
    $ rpm -qf /opt/saltstack/salt/lib/python3.11/site-packages/salt/modules/linux_shadow.py
    salt-3006.27-0.x86_64
    $ salt-call --versions-report
    Salt Version:
              Salt: 3006.27
    
    Python Version:
            Python: 3.11.15 (main, Jun 29 2026, 22:21:49) [GCC 11.2.0]
    
    Dependency Versions:
              cffi: 2.0.0
          cherrypy: 18.10.0
      cryptography: 47.0.0
          dateutil: 2.9.0.post0
         docker-py: Not Installed
             gitdb: 4.0.12
         gitpython: 3.1.50
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.3.0
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.1.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 24.0
         pycparser: 3.00
          pycrypto: Not Installed
      pycryptodome: 3.23.0
            pygit2: Not Installed
      python-gnupg: 0.5.6
            PyYAML: 6.0.3
             PyZMQ: 27.1.0
            relenv: 0.22.16
             smmap: 5.0.2
           timelib: 0.3.0
           Tornado: 6.5.5
               ZMQ: 4.3.5
    
    System Versions:
              dist: cloudlinux 9.8 Talgat Musabayev
            locale: utf-8
           machine: x86_64
           release: 5.14.0-611.49.2.el9_7.x86_64
            system: Linux
           version: CloudLinux 9.8 Talgat Musabayev
    
  7. foudfou commented on Jul 30, 2026

    @foudfou

    Definitely still an issue in

    Salt Version:
              Salt: 3007.14
    
    Python Version:
            Python: 3.14.6 (main, Jun 15 2026, 11:36:54) [GCC 16.1.1 20260430]
    
    Dependency Versions:
              cffi: 2.1.0
          cherrypy: 18.10.0
      cryptography: 48.0.0
          dateutil: 2.9.0
         docker-py: 7.1.0
             gitdb: Not Installed
         gitpython: Not Installed
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.3.0
          M2Crypto: Not Installed
              Mako: 1.3.12
           msgpack: 1.1.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 26.2
         pycparser: 3.00
          pycrypto: 3.23.0
      pycryptodome: 3.23.0
            pygit2: Not Installed
      python-gnupg: 0.5.6
            PyYAML: 6.0.3
             PyZMQ: 27.1.0
            relenv: Not Installed
             smmap: Not Installed
           timelib: Not Installed
           Tornado: 6.5.7
               ZMQ: 4.3.5
    
    Salt Package Information:
      Package Type: Not Installed
    
    System Versions:
              dist: arch
            locale: utf-8
           machine: x86_64
           release: 6.18.40-3-lts
            system: Linux
           version: Arch Linux
    
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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions