salt icon indicating copy to clipboard operation
salt copied to clipboard

Salt-ssh traceback for msgpack and certifi on Arch

Open justinta opened this issue 11 years ago • 19 comments

When I create a vm then use Salt-SSH to access it, I get a traceback for failing to import msgpack and certifi.

salt-ssh -i ssh-minion test.ping
ssh-minion:
    ----------
    retcode:
        1
    stderr:
        [CRITICAL] Unable to import msgpack or msgpack_pure python modules
        [ERROR   ] An un-handled exception was caught by salt's global exception handler:
        ImportError: No module named certifi
        Traceback (most recent call last):
          File "/tmp/.root_3eed82_salt/salt-call", line 4, in <module>
            salt_call()
          File "/tmp/.root_3eed82_salt/salt/scripts.py", line 325, in salt_call
            import salt.cli.call
          File "/tmp/.root_3eed82_salt/salt/cli/call.py", line 8, in <module>
            import salt.cli.caller
          File "/tmp/.root_3eed82_salt/salt/cli/caller.py", line 20, in <module>
            import salt.minion
          File "/tmp/.root_3eed82_salt/salt/minion.py", line 83, in <module>
            import salt.pillar
          File "/tmp/.root_3eed82_salt/salt/pillar/__init__.py", line 15, in <module>
            import salt.fileclient
          File "/tmp/.root_3eed82_salt/salt/fileclient.py", line 29, in <module>
            import salt.utils.http
          File "/tmp/.root_3eed82_salt/salt/utils/http.py", line 58, in <module>
            import tornado.simple_httpclient
          File "/tmp/.root_3eed82_salt/tornado/simple_httpclient.py", line 8, in <module>
            from tornado.http1connection import HTTP1Connection, HTTP1ConnectionParameters
          File "/tmp/.root_3eed82_salt/tornado/http1connection.py", line 30, in <module>
            from tornado import iostream
          File "/tmp/.root_3eed82_salt/tornado/iostream.py", line 40, in <module>
            from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
          File "/tmp/.root_3eed82_salt/tornado/netutil.py", line 39, in <module>
            import certifi
        ImportError: No module named certifi
        Traceback (most recent call last):
          File "/tmp/.root_3eed82_salt/salt-call", line 4, in <module>
            salt_call()
          File "/tmp/.root_3eed82_salt/salt/scripts.py", line 325, in salt_call
            import salt.cli.call
          File "/tmp/.root_3eed82_salt/salt/cli/call.py", line 8, in <module>
            import salt.cli.caller
          File "/tmp/.root_3eed82_salt/salt/cli/caller.py", line 20, in <module>
            import salt.minion
          File "/tmp/.root_3eed82_salt/salt/minion.py", line 83, in <module>
            import salt.pillar
          File "/tmp/.root_3eed82_salt/salt/pillar/__init__.py", line 15, in <module>
            import salt.fileclient
          File "/tmp/.root_3eed82_salt/salt/fileclient.py", line 29, in <module>
            import salt.utils.http
          File "/tmp/.root_3eed82_salt/salt/utils/http.py", line 58, in <module>
            import tornado.simple_httpclient
          File "/tmp/.root_3eed82_salt/tornado/simple_httpclient.py", line 8, in <module>
            from tornado.http1connection import HTTP1Connection, HTTP1ConnectionParameters
          File "/tmp/.root_3eed82_salt/tornado/http1connection.py", line 30, in <module>
            from tornado import iostream
          File "/tmp/.root_3eed82_salt/tornado/iostream.py", line 40, in <module>
            from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
          File "/tmp/.root_3eed82_salt/tornado/netutil.py", line 39, in <module>
            import certifi
        ImportError: No module named certifi
    stdout:

Versions Report:

Salt Version:
           Salt: 2015.8.0

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.22
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.10 (default, Sep  7 2015, 13:51:49)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.3
           cffi: 1.2.1
       cherrypy: 3.8.0
       dateutil: 2.4.2
          gitdb: 0.6.4
      gitpython: Not Installed
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.9.0
        timelib: 0.2.4

System Versions:
           dist:
        machine: x86_64
        release: 4.1.3

justinta avatar Oct 05 '15 20:10 justinta

I've been hit by this issue, luckily I'm using fabric too, as part of the bootstrap process so I did a quick pip install certifi for now. Hope this gets resolved soon.

mfzl avatar Oct 14 '15 09:10 mfzl

FYI @basepi

rallytime avatar Oct 14 '15 17:10 rallytime

@faxal What OS's are you seeing this on? I see it on centos and ubuntu but not debian8.

justinta avatar Oct 14 '15 17:10 justinta

@jtand I'm on Arch Linux, deploying on Ubuntu 14.04

Salt Version:
           Salt: 2015.8.0

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.22
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.10 (default, Sep  7 2015, 13:51:49)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.3
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist:   
        machine: x86_64
        release: 4.2.2-1-ARCH
Traceback (most recent call last):
          File "/tmp/.ubuntu_c87ee6_salt/salt-call", line 4, in <module>
            salt_call()
          File "/tmp/.ubuntu_c87ee6_salt/salt/scripts.py", line 325, in salt_call
            import salt.cli.call
          File "/tmp/.ubuntu_c87ee6_salt/salt/cli/call.py", line 8, in <module>
            import salt.cli.caller
          File "/tmp/.ubuntu_c87ee6_salt/salt/cli/caller.py", line 20, in <module>
            import salt.minion
          File "/tmp/.ubuntu_c87ee6_salt/salt/minion.py", line 83, in <module>
            import salt.pillar
          File "/tmp/.ubuntu_c87ee6_salt/salt/pillar/__init__.py", line 15, in <module>
            import salt.fileclient
          File "/tmp/.ubuntu_c87ee6_salt/salt/fileclient.py", line 29, in <module>
            import salt.utils.http
          File "/tmp/.ubuntu_c87ee6_salt/salt/utils/http.py", line 58, in <module>
            import tornado.simple_httpclient
          File "/tmp/.ubuntu_c87ee6_salt/tornado/simple_httpclient.py", line 8, in <module>
            from tornado.http1connection import HTTP1Connection, HTTP1ConnectionParameters
          File "/tmp/.ubuntu_c87ee6_salt/tornado/http1connection.py", line 30, in <module>
            from tornado import iostream
          File "/tmp/.ubuntu_c87ee6_salt/tornado/iostream.py", line 40, in <module>
            from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
          File "/tmp/.ubuntu_c87ee6_salt/tornado/netutil.py", line 39, in <module>
            import certifi
        ImportError: No module named certifi

mfzl avatar Oct 14 '15 17:10 mfzl

Seems to be caused by Python 2.7.6 on the remote end ssl.create_default_context() was added in 2.7.9, so the tornado check fails.

I have no idea why it is failing now, it was working 2-3 months back (last time I tried), maybe tornado updated in between?

mfzl avatar Oct 14 '15 18:10 mfzl

@faxal It's possible. I don't remember when we started depending on Tornado 4.2.1, though.

justinta avatar Oct 14 '15 20:10 justinta

2015.8.0 introduced that dependency.

rallytime avatar Oct 14 '15 20:10 rallytime

@rallytime Ah, right. Hmmm... I'll look into this more then.

justinta avatar Oct 15 '15 15:10 justinta

We ship certifi in the thin if available.... https://github.com/saltstack/salt/blob/develop/salt/utils/thin.py#L26-L30

basepi avatar Oct 15 '15 20:10 basepi

It should be added as a dependency for salt-ssh then, should it not?

mfzl avatar Oct 16 '15 06:10 mfzl

For some reason I thought it was already a dep of one of our other deps, so it was guaranteed to be there. We should definitely look into this.

basepi avatar Oct 16 '15 17:10 basepi

This issue is still around in 2015.8.3, is there any way to work around it without needing to install certifi with pip?

tongpu avatar Jan 31 '16 12:01 tongpu

Unfortunately I don't think there's another workaround at the moment.

basepi avatar Feb 01 '16 18:02 basepi

This still need to be fixed. Installing python2-certifi on the (arch) master also doesn't work as a workaround for me, it is apparently not added to the thin.

duk3luk3 avatar Mar 31 '17 06:03 duk3luk3

Happens to me when targeting RHEL 6.8 with Python 2.6.6 from Fedora 25:

salt-ssh --saltfile=Saltfile  '*' test.ping 
target-rhel6:
    ----------
    retcode:
        0
    stderr:
        Traceback (most recent call last):
          File "/var/tmp/.root_62a99a_salt/salt-call", line 15, in <module>
            salt_call()
          File "/var/tmp/.root_62a99a_salt/py2/salt/scripts.py", line 374, in salt_call
            import salt.cli.call
          File "/var/tmp/.root_62a99a_salt/py2/salt/cli/call.py", line 9, in <module>
            import salt.cli.caller
          File "/var/tmp/.root_62a99a_salt/py2/salt/cli/caller.py", line 18, in <module>
            import salt.loader
          File "/var/tmp/.root_62a99a_salt/py2/salt/loader.py", line 29, in <module>
            import salt.utils.event
          File "/var/tmp/.root_62a99a_salt/py2/salt/utils/event.py", line 68, in <module>
            import tornado.iostream
          File "/var/tmp/.root_62a99a_salt/py2/tornado/iostream.py", line 39, in <module>
            from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
          File "/var/tmp/.root_62a99a_salt/py2/tornado/netutil.py", line 38, in <module>
            import certifi
        ImportError: No module named certifi
    stdout:

I did pip install --user certifi on the master, but I don't even have pip on the target.

salt-ssh --versions-report
Salt Version:
           Salt: 2016.11.3
 
Dependency Versions:
           cffi: 1.7.0
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.13 (default, May 10 2017, 20:04:28)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.1.4
 
System Versions:
           dist: fedora 25 Twenty Five
        machine: x86_64
        release: 4.10.13-200.fc25.x86_64
         system: Linux
        version: Fedora 25 Twenty Five

I installed using the rpm from the repos dnf install salt-master salt-ssh.

DavidGamba avatar May 23 '17 22:05 DavidGamba

@duk3luk3 You can install python2-certifi from Arch repo, and delete the thin.tgz from /var/cache/salt/master/thin/ so it is regenerated on the next salt-ssh run.

oddfellow avatar May 28 '17 20:05 oddfellow

Started getting this during a salt-cloud installation of an EC2 server using Centos 7.1.1503

If I run the salt bootstrap using -D for debug I get:

 * ERROR: salt-minion was not found running
 * ERROR: Failed to run daemons_running()!!!
nohup: ignoring input
[DEBUG   ] Reading configuration from /etc/salt/minion
[ERROR   ] No module named certifi
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 200, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 546, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 1766, in setup_config
    ignore_config_errors=False)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 2164, in minion_config
    apply_sdb(opts)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 2298, in apply_sdb
    import salt.utils.sdb
  File "/usr/lib/python2.7/site-packages/salt/utils/sdb.py", line 14, in <module>
    import salt.loader
  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 26, in <module>
    import salt.utils.event
  File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 70, in <module>
    import tornado.iostream
  File "/usr/lib64/python2.7/site-packages/tornado/iostream.py", line 39, in <module>
    from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
  File "/usr/lib64/python2.7/site-packages/tornado/netutil.py", line 38, in <module>
    import certifi
ImportError: No module named certifi
Usage: salt-minion [options]

salt-minion: error: Error while processing <bound method Minion.process_config_dir of <salt.cli.daemons.Minion object at 0x2222350>>: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 200, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 546, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 1766, in setup_config
    ignore_config_errors=False)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 2164, in minion_config
    apply_sdb(opts)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 2298, in apply_sdb
    import salt.utils.sdb
  File "/usr/lib/python2.7/site-packages/salt/utils/sdb.py", line 14, in <module>
    import salt.loader
  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 26, in <module>
    import salt.utils.event
  File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 70, in <module>
    import tornado.iostream
  File "/usr/lib64/python2.7/site-packages/tornado/iostream.py", line 39, in <module>
    from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
  File "/usr/lib64/python2.7/site-packages/tornado/netutil.py", line 38, in <module>
    import certifi
ImportError: No module named certifi

I tried also updating the bootstrap module with salt-cloud -u but nothing changes. Any solution?

iplux avatar Sep 29 '17 12:09 iplux

Doing a yum upgrade to bring centos to version 7.4.1708 (without adding any additional package) solves the issue.

However the tricky part for us is that upgrading is usually done later as part of the Salt highstate and the initial image is always CentOS 7.1 so until this is fixed we cannot fully automate the process

iplux avatar Sep 29 '17 12:09 iplux

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Feb 07 '19 07:02 stale[bot]