salt icon indicating copy to clipboard operation
salt copied to clipboard

Error Starting salt-minion

Open charleshbaker opened this issue 12 years ago • 8 comments

Recently installed some salt-minions.

[cbaker1@SomeHost ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)
[cbaker1@SomeHost ~]$ rpm -qa | grep salt
salt-2014.1.4-1.el6.noarch
salt-minion-2014.1.4-1.el6.noarch
[cbaker1@SomeHost ~]$

Here is the output of salt --versions-report.

[root@saltmasterl001 ~]# salt --versions-report
           Salt: 2014.1.4
         Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
         Jinja2: unknown
       M2Crypto: 0.20.2
 msgpack-python: 0.1.13
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
         PyYAML: 3.09
          PyZMQ: 2.2.0.1
            ZMQ: 3.2.4
[root@saltmasterl001 ~]#

They appeared to be starting but weren't really. When I started in the foreground in debug mode I got the following. Other than upgrading the OS, which I can't do for business reasons, any suggestions?

[root@SomeHost ~]# service salt-minion start
Starting salt-minion daemon:                               [  OK  ]
[root@SomeHost ~]# ps auxwww | grep salt
root     24780  0.0  0.0 103292   868 pts/0    S+   17:39   0:00 grep salt
[root@SomeHost ~]# salt-minion -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[INFO    ] Using cached minion ID from /etc/salt/minion_id: $SOME_HOST
[DEBUG   ] Configuration file path: /etc/salt/minion
[INFO    ] Setting up the Salt Minion "$SOME_HOST"
[DEBUG   ] Created pidfile: /var/run/salt-minion.pid
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] The `dmidecode` binary is not available on the system. GPU grains will not be available.
[DEBUG   ] Attempting to authenticate with the Salt Master at 172.22.0.91
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[INFO    ] Authentication with master successful!
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
NameError: global name 'AES' is not defined
Traceback (most recent call last):
  File "/usr/bin/salt-minion", line 14, in <module>
    salt_minion()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 35, in salt_minion
    minion.start()
  File "/usr/lib/python2.6/site-packages/salt/__init__.py", line 221, in start
    self.prepare()
  File "/usr/lib/python2.6/site-packages/salt/__init__.py", line 209, in prepare
    self.minion = salt.minion.Minion(self.config)
  File "/usr/lib/python2.6/site-packages/salt/minion.py", line 549, in __init__
    opts['environment'],
  File "/usr/lib/python2.6/site-packages/salt/pillar/__init__.py", line 73, in compile_pillar
    ret_pillar = self.sreq.crypted_transfer_decode_dictentry(load, dictkey='pillar', tries=3, timeout=7200)
  File "/usr/lib/python2.6/site-packages/salt/transport/__init__.py", line 59, in crypted_transfer_decode_dictentry
    ret = self.sreq.send('aes', self.auth.crypticle.dumps(load), tries, timeout)
  File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 499, in dumps
    return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj))
  File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 467, in encrypt
    cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes)
NameError: global name 'AES' is not defined
Traceback (most recent call last):
  File "/usr/bin/salt-minion", line 14, in <module>
    salt_minion()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 35, in salt_minion
    minion.start()
  File "/usr/lib/python2.6/site-packages/salt/__init__.py", line 221, in start
    self.prepare()
  File "/usr/lib/python2.6/site-packages/salt/__init__.py", line 209, in prepare
    self.minion = salt.minion.Minion(self.config)
  File "/usr/lib/python2.6/site-packages/salt/minion.py", line 549, in __init__
    opts['environment'],
  File "/usr/lib/python2.6/site-packages/salt/pillar/__init__.py", line 73, in compile_pillar
    ret_pillar = self.sreq.crypted_transfer_decode_dictentry(load, dictkey='pillar', tries=3, timeout=7200)
  File "/usr/lib/python2.6/site-packages/salt/transport/__init__.py", line 59, in crypted_transfer_decode_dictentry
    ret = self.sreq.send('aes', self.auth.crypticle.dumps(load), tries, timeout)
  File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 499, in dumps
    return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj))
  File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 467, in encrypt
    cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes)
NameError: global name 'AES' is not defined

charleshbaker avatar Jun 20 '14 18:06 charleshbaker

Can you show us your minion/master config? I'm guessing this is the same issue as #12172, and has been fixed in the newly-released 2014.1.5.

basepi avatar Jun 20 '14 20:06 basepi

Sorry, I was on vacation and I pretty much unplugged. I haven't changed the hashing algorithm. But here are the master config and the minion config of one of the problem systems.

Here is a gist instead of the markdown mangled configs.

https://gist.github.com/96fcde022f27845badf0.git

charleshbaker avatar Jun 30 '14 17:06 charleshbaker

I'm sorry about all the HUGE boldface type. Would it be better to gist the files and just include an URL here?

charleshbaker avatar Jun 30 '14 18:06 charleshbaker

I upgraded the saltmaster to 2014.1.5 and upgrade on the problem minions also. Still get the same error.

salt-call --versions-report Salt: 2014.1.5 Python: 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) Jinja2: unknown M2Crypto: 0.20.2 msgpack-python: 0.1.13 msgpack-pure: Not Installed pycrypto: Not Installed PyYAML: 3.09 PyZMQ: 2.2.0.1 ZMQ: 3.2.4

salt-minion -l debug [DEBUG ] Reading configuration from /etc/salt/minion [INFO ] Using cached minion ID from /etc/salt/minion_id: $SOME_HOST [DEBUG ] Configuration file path: /etc/salt/minion [INFO ] Setting up the Salt Minion "$SOME_HOST" [DEBUG ] Created pidfile: /var/run/salt-minion.pid [DEBUG ] Reading configuration from /etc/salt/minion [DEBUG ] The dmidecode binary is not available on the system. GPU grains will not be available. [DEBUG ] Attempting to authenticate with the Salt Master at 172.22.0.91 [DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem [DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem [DEBUG ] Decrypting the current master AES key [DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem [INFO ] Authentication with master successful! [DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem [DEBUG ] Decrypting the current master AES key [DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem [ERROR ] An un-handled exception was caught by salt's global exception handler: NameError: global name 'AES' is not defined Traceback (most recent call last): File "/usr/bin/salt-minion", line 14, in salt_minion() File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 35, in salt_minion minion.start() File "/usr/lib/python2.6/site-packages/salt/init.py", line 221, in start self.prepare() File "/usr/lib/python2.6/site-packages/salt/init.py", line 209, in prepare self.minion = salt.minion.Minion(self.config) File "/usr/lib/python2.6/site-packages/salt/minion.py", line 552, in init opts['environment'], File "/usr/lib/python2.6/site-packages/salt/pillar/init.py", line 73, in compile_pillar ret_pillar = self.sreq.crypted_transfer_decode_dictentry(load, dictkey='pillar', tries=3, timeout=7200) File "/usr/lib/python2.6/site-packages/salt/transport/init.py", line 59, in crypted_transfer_decode_dictentry ret = self.sreq.send('aes', self.auth.crypticle.dumps(load), tries, timeout) File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 499, in dumps return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj)) File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 467, in encrypt cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes) NameError: global name 'AES' is not defined Traceback (most recent call last): File "/usr/bin/salt-minion", line 14, in salt_minion() File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 35, in salt_minion minion.start() File "/usr/lib/python2.6/site-packages/salt/init.py", line 221, in start self.prepare() File "/usr/lib/python2.6/site-packages/salt/init.py", line 209, in prepare self.minion = salt.minion.Minion(self.config) File "/usr/lib/python2.6/site-packages/salt/minion.py", line 552, in init opts['environment'], File "/usr/lib/python2.6/site-packages/salt/pillar/init.py", line 73, in compile_pillar ret_pillar = self.sreq.crypted_transfer_decode_dictentry(load, dictkey='pillar', tries=3, timeout=7200) File "/usr/lib/python2.6/site-packages/salt/transport/init.py", line 59, in crypted_transfer_decode_dictentry ret = self.sreq.send('aes', self.auth.crypticle.dumps(load), tries, timeout) File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 499, in dumps return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj)) File "/usr/lib/python2.6/site-packages/salt/crypt.py", line 467, in encrypt cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes) NameError: global name 'AES' is not defined

charleshbaker avatar Jun 30 '14 18:06 charleshbaker

Thanks for changing that to a gist -- it was quite the e-mail with all the bold stuff! Remember that you can use triple backticks to define code blocks that won't be markdown-interpreted.

Turns out you haven't defined a non-standard hash_type, so I guess your issue is not quite the one I was hoping it was. We will have to investigate more closely.

basepi avatar Jun 30 '14 23:06 basepi

Found it! Salt depends on pycrypto, which your versions-report lists as not installed. Not sure how you managed to get salt installed without pycrypto, but if you get pycrypto installed it should make your problem go away.

basepi avatar Jun 30 '14 23:06 basepi

I just had the same problem, and I installed it using:

sudo apt-get install python-pip python-dev

pip install pycrypto

leitao avatar Feb 19 '15 18:02 leitao

Its incorrect pycrypto module.

Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher

Steps to fix. Remove CentOS system package pycrypto Reinstall pycrypto via pip.

rootvm avatar Apr 20 '16 07:04 rootvm