Subject: gnutls errors on multiple guix commands
From: Maxim Cournoyer <[email-masked]>
To: bug-guix <[email-masked]>
Date: Mon, 15 May 2017 22:19:26 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello Guix!

This problem has been ongoing for some time. It prevents me from using
things such as "guix lint" or "guix import" (seems to be related to
certs and gnutls). I thought a guix system reconfigure (I'm on GuixSD)
would fix it but it hasn't, even after rebooting the system.

It is reminiscent of bug#25200, but there doesn't appear to be any
dangling symlinks this time around.

The nss-certs package is present in my operating system declaration, and
the /etc/ssl/certs directory is populated ('/etc/ssl' is a symbolic link
pointing to /run/current-system/profile/etc/ssl).

SSL_CERT_DIR is set to "/etc/ssl/certs"
SSL_CERT_FILE is set to "/etc/ssl/certs/ca-certificates.crt"

A couple examples of how things break:

* guix lint

--8<---------------cut here---------------start------------->8---
guix lint emacs
Backtrace:[email-masked] [cve]...
           9 (primitive-load "/gnu/store/80k8kz7qk9palbn0ccw7y3fgym8&")
In guix/ui.scm:
   1257:8  8 (run-guix-command _ . _)
In srfi/srfi-1.scm:
    640:9  7 (for-each #<procedure 183c060 at guix/scripts/lint.scm&> &)
In guix/scripts/lint.scm:
    982:4  6 (run-checkers _ _)
In srfi/srfi-1.scm:
    640:9  5 (for-each #<procedure 1f252a0 at guix/scripts/lint.scm&> &)
In guix/scripts/lint.scm:
    805:4  4 (check-vulnerabilities _)
    800:9  3 (_ _)
In unknown file:
           2 (force #<promise #<procedure 7f1db4d41f88 at guix/scrip&>)
In guix/scripts/lint.scm:
   789:24  1 (_)
In ice-9/boot-9.scm:
    837:9  0 (catch srfi-34 #<procedure 7f1db4d4d3a8 at guix/script&> &)

ice-9/boot-9.scm:837:9: In procedure catch:
ice-9/boot-9.scm:837:9: Throw to key `gnutls-error' with args `(#<gnutls-error-enum Error while reading file.> set-certificate-credentials-x509-trust-file!)'.

--8<---------------cut here---------------end--------------->8---

* Using guix import

--8<---------------cut here---------------start------------->8---
guix import pypi flask-migrate
Backtrace:
          12 (primitive-load "/gnu/store/80k8kz7qk9palbn0ccw7y3fgym8&")
In guix/ui.scm:
   1257:8 11 (run-guix-command _ . _)
In guix/scripts/import.scm:
   114:11 10 (guix-import . _)
In guix/scripts/import/pypi.scm:
    84:19  9 (guix-import-pypi . _)
In guix/import/pypi.scm:
   279:17  8 (pypi->guix-package _)
In ice-9/boot-9.scm:
    837:9  7 (catch srfi-34 #<procedure 29a3300 at guix/import/json&> &)
In guix/import/json.scm:
    32:17  6 (_)
In guix/http-client.scm:
   239:25  5 (http-fetch _ #:port _ #:text? _ #:buffered? _ # _ # _ # &)
In guix/build/download.scm:
    520:4  4 (open-connection-for-uri _ #:timeout _ # _)
   391:34  3 (tls-wrap #<input-output: socket 14> "pypi.python.org" # &)
    308:4  2 (make-credendials-with-ca-trust-files _)
In srfi/srfi-1.scm:
    640:9  1 (for-each #<procedure 29a9680 at guix/build/download.s&> &)
In unknown file:
           0 (set-certificate-credentials-x509-trust-file! #<certif&> &)

ERROR: In procedure set-certificate-credentials-x509-trust-file!:
ERROR: Throw to key `gnutls-error' with args `(#<gnutls-error-enum Error while reading file.> set-certificate-credentials-x509-trust-file!)'.
--8<---------------cut here---------------end--------------->8---

* Using lint from emacs-guix

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,m (emacs-guix)
scheme@(emacs-guix)> (guix-command "lint" "grub")
;;; Failed to autoload make-session in (gnutls):
;;; ERROR: missing interface for module (gnutls)
guix/scripts/lint.scm:466:16: In procedure validate-uri:
guix/scripts/lint.scm:466:16: In procedure module-lookup: Unbound variable: make-session

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(emacs-guix) [1]> ,bt
In ice-9/boot-9.scm:
    837:9  5 (catch quit #<procedure 1eeb960 at emacs-guix/commands.scm:51:4 ()> #<procedure 1eeb940 at ice-9/boot-9.scm:1057:2 _> _)
In guix/ui.scm:
   1257:8  4 (run-guix-command _ . _)
In srfi/srfi-1.scm:
    640:9  3 (for-each #<procedure 1eeb7e0 at guix/scripts/lint.scm:1075:20 (spec)> ("grub"))
In guix/scripts/lint.scm:
    982:4  2 (run-checkers #<package [email-masked] gnu/packages/bootloaders.scm:64 3352540> _)
In srfi/srfi-1.scm:
    640:9  1 (for-each #<procedure 39fb4c0 at guix/scripts/lint.scm:982:14 (checker)> _)
In guix/scripts/lint.scm:
   466:16  0 (validate-uri #<<uri> scheme: https userinfo: #f host: "www.gnu.org" port: #f path: "/software/grub/" query: #f fragment: #f> #<package [email-masked] g&> &)
--8<---------------cut here---------------end--------------->8---

Any pointer welcome.

Maxim