Can't fileserver.update from GitHub repos, pygit2 libgit2 are installed...
Description of Issue
My original salt system got hosed and I had to start from scratch, so I took the opportunity to upgrade everything to the latest recommended versions. This time around I can't pull my files from my GitHub repos.
[ERROR ] gitfs is configured but could not be loaded, are pygit2 and libgit2 installed?
[ERROR ] GitPython is installed, you may wish to set gitfs_provider to 'gitpython' to use GitPython for gitfs support.
[CRITICAL] No suitable gitfs provider module is installed.
[DEBUG ] Could not LazyLoad gitfs.envs: 'gitfs' __virtual__ returned False
[ERROR ] Failed to load function git.envs because its module (git) is not in the whitelist: ['gitfs', 'roots']
I have a clean install of the latest salt-master version 2019.2.2 with Python3. With requirements met according to the salt documentation:
root@master:/etc/salt# apt list | grep pygit2
python-pygit2/bionic,now 0.26.2-2 amd64 [installed]
root@master:/etc/salt# apt list | grep libgit2
libgit2-26/bionic,now 0.26.0+dfsg.1-1.1build1 amd64 [installed,automatic]
Setup
Successful SSH Connection to GitHub:
root@master:/etc/salt# ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address '#####' to the list of known hosts.
Hi LaughHammers! You've successfully authenticated, but GitHub does not provide shell access.
Master configuration file:
This is the same conf file that was used in my last setup which worked fine for the last year.
fileserver_backend:
- gitfs
- roots
gitfs_provider: pygit2
gitfs_root: salt
gitfs_pubkey: '/root/.ssh/id_rsa.pub'
gitfs_privkey: '/root/.ssh/id_rsa'
gitfs_remotes:
- [email protected]:LaughHammers/spase-top.git:
- pubkey: /root/.ssh/id_rsa.pub
- privkey: /root/.ssh/id_rsa
- [email protected]:LaughHammers/spase-linux.git:
- pubkey: /root/.ssh/id_rsa.pub
- privkey: /root/.ssh/id_rsa
- [email protected]:LaughHammers/spase-windows.git:
- pubkey: /root/.ssh/id_rsa.pub
- privkey: /root/.ssh/id_rsa
Steps to Reproduce Issue
root@master:/etc/salt# salt-run fileserver.update -l debug
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/spase.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/spase.conf
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] LazyLoaded fileserver.update
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: master
[DEBUG ] Grains refresh requested. Refreshing grains.
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/spase.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/spase.conf
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG ] Popen(['git', 'version'], cwd=/etc/salt, universal_newlines=False, shell=None)
[DEBUG ] Popen(['git', 'version'], cwd=/etc/salt, universal_newlines=False, shell=None)
[DEBUG ] Sending event: tag = salt/run/20191107171008337229/new; data = {'fun': 'runner.fileserver.update', 'jid': '20191107171008337229', 'user': 'sudo_mother', 'fun_args': [], '_stamp': '2019-11-07T17:10:12.271266'}
[ERROR ] gitfs is configured but could not be loaded, are pygit2 and libgit2 installed?
[ERROR ] GitPython is installed, you may wish to set gitfs_provider to 'gitpython' to use GitPython for gitfs support.
[CRITICAL] No suitable gitfs provider module is installed.
[DEBUG ] Could not LazyLoad gitfs.envs: 'gitfs' __virtual__ returned False
[ERROR ] Failed to load function git.envs because its module (git) is not in the whitelist: ['gitfs', 'roots']
[DEBUG ] Updating roots fileserver cache
[DEBUG ] LazyLoaded local_cache.prep_jid
[DEBUG ] Sending event: tag = salt/run/20191107171008337229/ret; data = {'fun': 'runner.fileserver.update', 'jid': '20191107171008337229', 'user': 'sudo_mother', 'fun_args': [], '_stamp': '2019-11-07T17:10:12.306288', 'return': True, 'success': True}
[DEBUG ] LazyLoaded nested.output
True
[INFO ] Runner completed: 20191107171008337229
[DEBUG ] Closing IPCMessageClient instance
[DEBUG ] Runner return: True
Versions Report
Note that pygit2 and libgit2 indicate Not Installed????
Salt Version:
Salt: 2019.2.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Oct 7 2019, 12:59:55)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: Ubuntu 18.04 bionic
locale: UTF-8
machine: x86_64
release: 4.15.0-66-generic
system: Linux
version: Ubuntu 18.04 bionic
what happens when you do python3 -c import pygit2.
the python-pygit2 package could possibly be the python2 version of the package. Is there a python3-pygit2 package by chacne?
Nothing happens if I run this command:
python -c 'import pygit2'
This the output from apt list when searching for pygit2, if that's what you're asking for:
python-pygit2/bionic,now 0.26.2-2 amd64 [installed]
python-pygit2-doc/bionic 0.26.2-2 all
python3-pygit2/bionic 0.26.2-2 amd64
yeah if your using python3 for salt then you will want to install python3-pygit2 instead of python-pygit2`.
if nothing happens with that import command I had you run that means the library is properly installed but i wonder if python binary is python2 instead of python3?
Yeah, I got it to work finally. Thank you so much for that!
apt-get install python3-pygit2
It is my understanding that according to your website, many salt-master log warnings, and debug warnings, Python2 is being deprecated very soon and we should be upgrading to Python3? If that is the case it seems prudent to update documentation where necessary, like in my case. It doesn't say anywhere that I can see that if I am running Python3 and I want to connect to my GitHub repos I would need to first install python3-pygit2 and not python-pygit2 like I have been instructed to via salt docs. Just adding the 3 makes a difference between getting it to work right away and troubleshooting for literally hours or even days!!
@LaughHammers FYI most python-xxxx have their equivalents in python3-xxxx, except for RHEL 7 where you might see python36-xxxx, but RHEL 8 has moved to using python3-xxxx similar to Fedora.
Also RHEL 7 has moved some Python 2.7 python-xxxx packages to python2-xxxx.
Hence for Python 3 support typical packages start with python3-xxxx
@dmurphy18 Good to know, thank you. I think it would be a good idea to include this information in some form on the Git Fileserver Backend Walkthrough page for people like me who are primarily Windows admins and Linux is more of a second language at best.
Hello, I have also stumbled upon this issue with SaltStack version 3000 running on Python3 on CentOS7. If possible, I also vote for updating official documentation here to highlight differences in pygit2 packages.
The naming convention python, python2, vs python3 packages are not specific to just pygit2 but all python packages in general. If you are installing any dependency that salt uses you would need to ensure to install the correct python version of the package depending on what version of python your salt instance is running under. Just the same if you are pip installing a python package you would need to ensure you are using the correct pip version to install the correct version. I am not against accepting a pull request if you want to add one to highlight this difference for the pygit2 dependency, but different OSs might have different naming conventions for the different python versions, so it would need to state a warning to ensure the dependency your installing is the correct python version and not include the name python-pygit2, etc since the naming convention can be different across different OSs.
Hi guys, I'm here with a simple(r) solution in case anyone else will stumble upon this issue in the future.
Long story short, there two things we should pay attention to when installing pygit2 through pip3:
- the version of pygit2
- the path to which to install pygit2
The latest version of pygit2 that salt can use is 0.28 (at least it used to be a couple of months ago) pip3 will usually attempt to install packages in /usr/local/lib64/python3.6 (if its a 64-bit machine). And the salt-master will look for this package in /usr/lib/python3.6/site-packages (just like it should)
aaaaannnnnd that being that, the command line below should quickly solve the pygit3 issue everyone got after upgrading to py3 salt.
pip3.6 install --target=/usr/lib/python3.6/site-packages --ignore-installed pygit2==0.28.0
hi guys, is this same for GitPython, as i am getting same error , gitfs is not avaiable when i recycle my salt-master after i installed GitPython 2.0.8 on salt 2019.2.4. i am running rhel 7 with python 2.7