# ansible kerberos library is not installed

**URL:** <https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021>\
**Category:** Ansible Project\
**Tags:** windows, ubuntu\
**Created:** [May 25, 2020, 1:43pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021 "2020-05-25T13:43:57Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 25, 2020, 1:43pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/1 "2020-05-25T13:43:57Z")

</div>

not sure what happened but this was working last week.

now I am getting this error

tony@ubuntu:~/windows$ ansible windows -i hosts -m win\_ping -vvvvvvvvv  
ansible 2.9.0  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/home/tony/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /home/tony/.local/lib/python2.7/site-packages/ansible  
executable location = /home/tony/.local/bin/ansible  
python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]  
Using /etc/ansible/ansible.cfg as config file  
setting up inventory plugins  
host\_list declined parsing /home/tony/windows/hosts as it did not pass its verify\_file() method  
script declined parsing /home/tony/windows/hosts as it did not pass its verify\_file() method  
auto declined parsing /home/tony/windows/hosts as it did not pass its verify\_file() method  
Parsed /home/tony/windows/hosts inventory source with ini plugin  
Loading callback plugin minimal of type stdout, v2.0 from /home/tony/.local/lib/python2.7/site-packages/ansible/plugins/callback/minimal.pyc  
META: ran handlers  
Using module file /home/tony/.local/lib/python2.7/site-packages/ansible/modules/windows/win\_ping.ps1  
Using module file /home/tony/.local/lib/python2.7/site-packages/ansible/modules/windows/win\_ping.ps1  
Pipelining is enabled.  
Pipelining is enabled.  
 ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxx on PORT 5986 TO pa-mgt01  
\<rw-ctxweb-02\> ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxxx on PORT 5986 TO rw-ctxweb-02  
[pa-mgt01.wsgr.com](http://pa-mgt01.wsgr.com) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “kerberos: the python kerberos library is not installed”,  
“unreachable”: true  
}  
[rw-ctxweb-02.wsgr.com](http://rw-ctxweb-02.wsgr.com) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “kerberos: the python kerberos library is not installed”,  
“unreachable”: true

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 25, 2020, 2:00pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/2 "2020-05-25T14:00:15Z")

</div>

any idea? I cant connect to my windows machines now and winrm is setup correctly

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 25, 2020, 3:39pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/3 "2020-05-25T15:39:24Z")

</div>

maybe I am missing krb?

tony@ubuntu:~/windows$ sudo apt install -y krb5-user libpam-krb5 libpam-ccreds auth-client-config  
Reading package lists… Done  
Building dependency tree  
Reading state information… Done  
Some packages could not be installed. This may mean that you have  
requested an impossible situation or if you are using the unstable  
distribution that some required packages have not yet been created  
or been moved out of Incoming.  
The following information may help to resolve the situation:

The following packages have unmet dependencies:  
krb5-user : Depends: libkrb5-3 (= 1.16-2ubuntu0.1) but 1.16-2ubuntu1.1 is to be installed  
E: Unable to correct problems, you have held broken packages.

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 25, 2020, 4:18pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/4 "2020-05-25T16:18:02Z")

</div>

any ieea? I am able to chem ntlm auth is working fine. its just kerberos is failed

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 25, 2020, 6:56pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/5 "2020-05-25T18:56:37Z")

</div>

I would advise speaking to your AD Team or your GPO Administrator, They may have updated their GPO Policies to stop communication over the ports used for Kerberos: This Issue doesn’t seem to be an Ansible issue but an issue with your Environment setup.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 25, 2020, 10:21pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/6 "2020-05-25T22:21:02Z")

</div>

The error message is saying

> The python kerberos library is not installed

Make sure you have installed pykerberos by running ‘pip install pykerberos’ or if you are managing Python packages through your system package manager ‘apt install python-kerberos’.

You can verify whether it is installed with ‘python -c “import kerberos”’. Make sure the Python you use to execute this check is the same Python that Ansible runs with.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 25, 2020, 11:10pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/7 "2020-05-25T23:10:53Z")

</div>

getting this error

tony@ubuntu:~$ sudo pip install pykerberos  
[sudo] password for tony:  
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at [https://pip.pypa.io/en/latest/development/release-process/#python-2-support](https://pip.pypa.io/en/latest/development/release-process/#python-2-support)  
WARNING: The directory ‘/home/tony/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.  
Collecting pykerberos  
Downloading pykerberos-1.2.1.tar.gz (24 kB)  
Building wheels for collected packages: pykerberos  
Building wheel for pykerberos (setup.py) … error  
ERROR: Command errored out with exit status 1:  
command: /usr/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-sZaCg1/pykerberos/setup.py’“'”‘; **file** =’“'”‘/tmp/pip-install-sZaCg1/pykerberos/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)( **file** );code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, **file** , ‘"’“‘exec’”’"‘))’ bdist\_wheel -d /tmp/pip-wheel-sAbKUA  
cwd: /tmp/pip-install-sZaCg1/pykerberos/  
Complete output (14 lines):  
running bdist\_wheel  
running build  
running build\_ext  
building ‘kerberos’ extension  
creating build  
creating build/temp.linux-x86\_64-2.7  
creating build/temp.linux-x86\_64-2.7/src  
x86\_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D\_FORTIFY\_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UKCoZ3/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/kerberos.c -o build/temp.linux-x86\_64-2.7/src/kerberos.o  
In file included from src/kerberos.c:19:  
src/kerberosbasic.h:17:10: fatal error: gssapi/gssapi.h: No such file or directory  
#include \<gssapi/gssapi.h\>  
^ ~~~~~~~~~~~~~~~~  
compilation terminated.  
error: command ‘x86\_64-linux-gnu-gcc’ failed with exit status 1

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [May 25, 2020, 11:22pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/8 "2020-05-25T23:22:55Z")

</div>

> getting this error
> 
> tony@ubuntu:~$ sudo pip install pykerberos

Why use sudo?

> WARNING: The directory '/home/tony/.cache/pip' or its parent directory is  
> not owned or is not writable by the current user. The cache has been  
> disabled. Check the permissions and owner of that directory. If executing  
> pip with sudo, you may want sudo's -H flag.

Regards,

Antony.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 26, 2020, 1:40am UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/9 "2020-05-26T01:40:05Z")

</div>

Please read the docs, there are a few packages that need to be installed for pip to compile the pykerberos library [https://docs.ansible.com/ansible/latest/user\_guide/windows\_winrm.html#installing-the-kerberos-library](https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#installing-the-kerberos-library).

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 26, 2020, 12:47pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/10 "2020-05-26T12:47:30Z")

</div>

this is error i keep getting

tony@ubuntu:~$ pip install pykerberos  
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at [https://pip.pypa.io/en/latest/development/release-process/#python-2-support](https://pip.pypa.io/en/latest/development/release-process/#python-2-support)  
Defaulting to user installation because normal site-packages is not writeable  
Collecting pykerberos  
Downloading pykerberos-1.2.1.tar.gz (24 kB)  
Building wheels for collected packages: pykerberos  
Building wheel for pykerberos (setup.py) … error  
ERROR: Command errored out with exit status 1:  
command: /usr/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-e0nO8N/pykerberos/setup.py’“'”‘; **file** =’“'”‘/tmp/pip-install-e0nO8N/pykerberos/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)( **file** );code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, **file** , ‘"’“‘exec’”’"‘))’ bdist\_wheel -d /tmp/pip-wheel-CFz0Gh  
cwd: /tmp/pip-install-e0nO8N/pykerberos/  
Complete output (14 lines):  
running bdist\_wheel  
running build  
running build\_ext  
building ‘kerberos’ extension  
creating build  
creating build/temp.linux-x86\_64-2.7  
creating build/temp.linux-x86\_64-2.7/src  
x86\_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D\_FORTIFY\_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UKCoZ3/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/kerberos.c -o build/temp.linux-x86\_64-2.7/src/kerberos.o  
In file included from src/kerberos.c:19:  
src/kerberosbasic.h:17:10: fatal error: gssapi/gssapi.h: No such file or directory  
#include \<gssapi/gssapi.h\>  
^ ~~~~~~~~~~~~~~~~  
compilation terminated.  
error: command ‘x86\_64-linux-gnu-gcc’ failed with exit status 1

---

<div class="post-metadata">

**Author:** ![Werner\_Flamme](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@Werner\_Flamme](https://forum.ansible.com/u/Werner_Flamme)\
**Post date:** [May 26, 2020, 1:45pm UTC](https://forum.ansible.com/t/ansible-kerberos-library-is-not-installed/33021/11 "2020-05-26T13:45:17Z")

</div>

At his point, I'd try something like "apt-get -f install" to fix the  
installed packages.

Obviously some executable is invoked here, and it depends on another  
operating system package. The required package is named libkrb5-3 and  
should have version 1.16-2ubuntu0.1, but there seems to be only version  
1.16-2ubuntu1.1 available.

Try to fix this, since all the following output should depend on that.

HTH, Werner
