I'm having trouble accessing ELPA on my Mac from behind a corporate proxy. Emacs 27.1.

I have http_proxy and https_proxy configured appropriately (I've also tried setting url-proxy-services).

From Emacs (M-x package-refresh-contents):

Using a proxy for https...
Contacting host: elpa.gnu.org:443
elpa.gnu.org/0 nodename nor servname provided, or not known
Package refresh done
Failed to download ‘gnu’ archive.

From Terminal:

hostname:~ 000$ gnutls-cli -V --ca-verification --x509cafile=/tmp/master.pem elpa.gnu.org
Processed 205 CA certificate(s).
Resolving 'elpa.gnu.org:443'...
Cannot resolve elpa.gnu.org:443: nodename nor servname provided, or not known

hostname:~ 000$ nslookup elpa.gnu.org
Server:     XXX.XXX.XXX.XXX
Address:    XXX.XXX.XXX.XXX#53

** server can't find elpa.gnu.org: NXDOMAIN

It looks like gnutls and nslookup are having trouble resolving the domain (nodename nor servname provided, or not known is the same error that Emacs is throwing).

However curl has no issues:

hostname:~ 000$ curl elpa.gnu.org|head
<!doctype html>
        <title>GNU Emacs Lisp Package Archive</title>

What am I missing?

  • Accroding to your last curl command, plain HTTP works, so you can 1) try curl elpa.gnu.org to see if it works too, according to my knowledge, with HTTP proxy, the local client doesn't need to resolve the domain, it sends GET http://elpa.gnu.org/ HTTP/1.1 to the proxy server 2) ask package.el to use HTTP, instead of HTTPS, GNU Elpa supports both. – xuchunyang Aug 20 at 3:53
  • Using http makes no difference. – EightyEight Aug 23 at 19:28
  • 1) use http instead of https for ease of debug 2) your network can't access elpa.gnu.org, and your above curl is indeed using your proxy, and your proxy does work, right? 3) "elpa.gnu.org/0 ... or not known" suggests something is wrong with your proxy setting, since you're using proxy, Emacs won't connect to elpa.gnu.org, it should ask your proxy to do. and where does the port number 0 come from? 4) here is an example setting, (setq url-proxy-services '(("http" . "localhost:1234") ...)) 5) you can test your proxy via curl -v -x http://localhost:1234 example.com – xuchunyang Aug 23 at 20:00

I was able to work around this issue by using Squid as described here. Note that I still see the elpa.gnu.org/0 nodename nor servname provided, or not known error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.