common-lispsbclwindows-subsystem-for-linuxquicklisp

Socket error while installing Quicklisp in WSL2


Similarly to Connection refused error installing quicklisp, I am encountering this error when installing Quicklisp in WSL2:

* (quicklisp-quickstart:install)

debugger invoked on a SB-BSD-SOCKETS:OPERATION-TIMEOUT-ERROR in thread
#<THREAD "main thread" RUNNING {1000560083}>:
  Socket error in "connect": ETIMEDOUT (Connection timed out)

As I could download the file using wget and I was able to set up Quicklisp in a docker container on the same machine, I believe that this has something to do with how WSL2 handles networks. Nonetheless, I am unable to identify a proxy that I can feed as a parameter during installation.

This is the backtrace:

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1000560083}>
0: (SB-BSD-SOCKETS:SOCKET-ERROR "connect" 110)
1: (SB-BSD-SOCKETS::CALL-WITH-SOCKET-ADDR #<SB-BSD-SOCKETS:INET-SOCKET 0.0.0.0:34844, fd: 5 {10030B2293}> (#(205 251 195 105) 80) #<CLOSURE (FLET SB-BSD-SOCKETS::WITH-SOCKET-ADDR-THUNK :IN SB-BSD-SOCKETS:SOCKET-CONNECT) {7FF9E2E9733B}>)
2: ((:METHOD SB-BSD-SOCKETS:SOCKET-CONNECT (SB-BSD-SOCKETS:SOCKET)) #<SB-BSD-SOCKETS:INET-SOCKET 0.0.0.0:34844, fd: 5 {10030B2293}> #(205 251 195 105) 80) [fast-method]
3: ((:METHOD QLQS-NETWORK::%OPEN-CONNECTION (QLQS-IMPL:SBCL T T)) #<QLQS-IMPL:SBCL {1004DADD23}> "beta.quicklisp.org" 80) [fast-method]
4: ((:METHOD QLQS-NETWORK::%CALL-WITH-CONNECTION (T T T T)) #<QLQS-IMPL:SBCL {1004DADD23}> "beta.quicklisp.org" 80 #<CLOSURE (LAMBDA (QLQS-HTTP::CONNECTION) :IN QLQS-HTTP:FETCH) {10030B022B}>) [fast-method]
5: (QLQS-HTTP:FETCH #<QLQS-HTTP::URL "http://beta.quicklisp.org/client/quicklisp.sexp"> #P"/home/user/quicklisp/tmp/fetch.dat" :FOLLOW-REDIRECTS T :QUIETLY NIL :MAXIMUM-REDIRECTS NIL)
6: (QUICKLISP-QUICKSTART::RENAMING-FETCH "http://beta.quicklisp.org/client/quicklisp.sexp" #P"/home/user/quicklisp/tmp/client-info.sexp")
7: (QUICKLISP-QUICKSTART::FETCH-CLIENT-INFO-PLIST "http://beta.quicklisp.org/client/quicklisp.sexp")
8: (QUICKLISP-QUICKSTART::FETCH-CLIENT-INFO "http://beta.quicklisp.org/client/quicklisp.sexp")
9: (QUICKLISP-QUICKSTART::INITIAL-INSTALL :CLIENT-URL "http://beta.quicklisp.org/client/quicklisp.sexp" :DIST-URL NIL)
10: ((:METHOD QLQS-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<QLQS-IMPL:SBCL {1004DADD23}> #<CLOSURE (LAMBDA NIL :IN QUICKLISP-QUICKSTART:INSTALL) {10030AD26B}>) [fast-method]
11: ((:METHOD QLQS-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QLQS-IMPL:SBCL T)) #<QLQS-IMPL:SBCL {1004DADD23}> #<CLOSURE (LAMBDA NIL :IN QUICKLISP-QUICKSTART:INSTALL) {10030AD26B}>) [fast-method]
12: (QUICKLISP-QUICKSTART:INSTALL :PATH NIL :PROXY NIL :CLIENT-URL NIL :CLIENT-VERSION NIL :DIST-URL NIL :DIST-VERSION NIL)
13: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-QUICKSTART:INSTALL) #<NULL-LEXENV>)
14: (EVAL (QUICKLISP-QUICKSTART:INSTALL))
15: (INTERACTIVE-EVAL (QUICKLISP-QUICKSTART:INSTALL) :EVAL NIL)
16: (SB-IMPL::REPL-FUN NIL)
17: ((FLET "LAMBDA0" :IN "SYS:SRC;CODE;TOPLEVEL.LISP"))
18: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (FLET "LAMBDA0" :IN "SYS:SRC;CODE;TOPLEVEL.LISP") {7FF9E2E97B7B}>)
19: (SB-IMPL::TOPLEVEL-REPL NIL)
20: (SB-IMPL::TOPLEVEL-INIT)
21: ((FLET SB-UNIX::BODY :IN SAVE-LISP-AND-DIE))
22: ((FLET "WITHOUT-INTERRUPTS-BODY-14" :IN SAVE-LISP-AND-DIE))
23: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))

Solution

  • I've played with this a bit and the solution that works in my case is to run HTTP proxy inside WSL2, e.g., https://mitmproxy.org

    sudo pip3 install mitmproxy
    mitmproxy
    

    Once the proxy is up and running, Quicklist has to be installed in the following way:

    (quicklisp-quickstart:install :proxy "http://localhost:8080/")