Pygit2 openSSL error

Hi,

I’m trying to use snapcraft for the first time.

I followed the tutorial, and when I run snapcraft (using the tutorial .yaml file), I get the following error:

Traceback (most recent call last):
  File "/snap/snapcraft/10279/bin/snapcraft", line 5, in <module>
    from snapcraft.cli import run
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/cli.py", line 35, in <module>
    from snapcraft.remote import RemoteBuildError
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/remote/__init__.py", line 29, in <module>
    from .git import (
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/remote/git.py", line 27, in <module>
    import pygit2
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/__init__.py", line 275, in <module>
    settings = Settings()
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 55, in __init__
    self._initialize_tls_certificate_locations()
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 61, in _initialize_tls_certificate_locations
    self.set_ssl_cert_locations(
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 191, in set_ssl_cert_locations
    option(_pygit2.GIT_OPT_SET_SSL_CERT_LOCATIONS, cert_file, cert_dir)
_pygit2.GitError: OpenSSL error: failed to load certificates: error:00000000:lib(0)::reason(0)

I am using Arch, snapd was installed from the AUR.

Any assistence is appreciated.

Edit: I get this error running snapcraft even if there is no .yaml file. I also tried using the edge version of snapcraft, and got the same error.

1 Like

I have same error too after updating Rocky Linux.

[nasanbat@localhost bin]$ snapcraft
Traceback (most recent call last):
  File "/snap/snapcraft/10279/bin/snapcraft", line 5, in <module>
    from snapcraft.cli import run
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/cli.py", line 35, in <module>
    from snapcraft.remote import RemoteBuildError
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/remote/__init__.py", line 29, in <module>
    from .git import (
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/snapcraft/remote/git.py", line 27, in <module>
    import pygit2
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/__init__.py", line 275, in <module>
    settings = Settings()
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 55, in __init__
    self._initialize_tls_certificate_locations()
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 61, in _initialize_tls_certificate_locations
    self.set_ssl_cert_locations(
  File "/var/lib/snapd/snap/snapcraft/10279/lib/python3.10/site-packages/pygit2/settings.py", line 191, in set_ssl_cert_locations
    option(_pygit2.GIT_OPT_SET_SSL_CERT_LOCATIONS, cert_file, cert_dir)
_pygit2.GitError: OpenSSL error: failed to load certificates: error:00000000:lib(0)::reason(0)

Hi all,

Sorry about this error, we switched to using the pygit2 library in snapcraft 8 and are working through some rough edges.

As a workaround, you should be able to use snapcraft from the 7.x channel (snap install snapcraft --channel=7.x/stable) because it doesn’t use the pygit2 library.

We have a bug report here.

2 Likes

Thank you very much.

You can try the edge/pr-4526 channel branch once it exists, in the meantime, a workaround is to run like

SSL_CERT_DIR=/snap/core22/current/etc/ssl/certs snapcraft remote-build
2 Likes

This fix has been released in snapcraft 8.0.2

1 Like