Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap fails in docker using ecl with: Socket error in "socket": EINVAL (Invalid argument). #22

Closed
Kreyren opened this issue Nov 13, 2020 · 6 comments

Comments

@Kreyren
Copy link

Kreyren commented Nov 13, 2020

SOLVED: #22 (comment) (Credit irc.freenode.net/#lisp)


kreyren@leonid:~/Repositories/s7i$ docker build --file docker/debian.Dockerfile --tag kreyren .
Sending build context to Docker daemon  19.97kB

Step 1/8 : FROM debian:testing
 ---> 03c237d6b0a4
Step 2/8 : ENV DEBIAN_FRONTEND=noninteractive
 ---> Using cache
 ---> c35184f3b94d
Step 3/8 : USER root
 ---> Using cache
 ---> 48682f2eac52
Step 4/8 : ENV LANG=en_US.UTF-8
 ---> Using cache
 ---> 9645af937249
Step 5/8 : ENV LC_ALL=C
 ---> Using cache
 ---> 70dc6401ff08
Step 6/8 : RUN true 	&& apt-get update -q 	&& apt-get install -qy 		apt-utils 		wget 	&& apt-get autoremove -qy 	&& rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 440537154b7e
Step 7/8 : RUN true 	&& apt-get update -q 	&& apt-get install -qy 		ecl 		clisp 	&& apt-get autoremove -qy 	&& rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 78ad929b927d
Step 8/8 : RUN true 	&& wget https://beta.quicklisp.org/quicklisp.lisp -O /tmp/quicklisp.lisp 	&& printf '%s\n' 		'(load #p"/tmp/quicklisp.lisp")' 		'(quicklisp-quickstart:install)' > /tmp/my.lisp 	&& ecl --norc --quiet --shell /tmp/my.lisp 	&& rm -r /tmp/*.lisp
 ---> Running in f86102fd934c
�[91m--2020-11-13 16:25:11--  https://beta.quicklisp.org/quicklisp.lisp
�[0m�[91mResolving beta.quicklisp.org (beta.quicklisp.org)... �[0m�[91m99.86.243.53, 99.86.243.113, 99.86.243.74, ...
Connecting to beta.quicklisp.org (beta.quicklisp.org)|99.86.243.53|:443... �[0m�[91mconnected.
�[0m�[91mHTTP request sent, awaiting response... �[0m�[91m200 OK
Length: 57144 (56K) [text/plain]
Saving to: '/tmp/quicklisp.lisp'
�[0m�[91m
     0K .......... ......�[0m�[91m.... ....�[0m�[91m...... ..�[0m�[91m........ ........�[0m�[91m.. 89% 2.13M 0s
    50K .....�[0m�[91m                 �[0m�[91m                                �[0m�[91m100% 92.7M=0.02s

�[0m�[91m2020-11-13 16:25:11 (2.37 MB/s) - '/tmp/quicklisp.lisp' saved [57144/57144]

�[0m;;; Loading "/tmp/quicklisp.lisp"
;;; Loading #P"/usr/lib/x86_64-linux-gnu/ecl-20.4.24/sockets.fas"

  ==== quicklisp quickstart 2015-01-28 loaded ====

    To continue with installation, evaluate: (quicklisp-quickstart:install)

    For installation options, evaluate: (quicklisp-quickstart:help)

�[91mAn error occurred during initialization:
�[0m�[91mSocket error in "socket": EINVAL (Invalid argument).
�[0mThe command '/bin/sh -c true 	&& wget https://beta.quicklisp.org/quicklisp.lisp -O /tmp/quicklisp.lisp 	&& printf '%s\n' 		'(load #p"/tmp/quicklisp.lisp")' 		'(quicklisp-quickstart:install)' > /tmp/my.lisp 	&& ecl --norc --quiet --shell /tmp/my.lisp 	&& rm -r /tmp/*.lisp' returned a non-zero code: 1
FROM debian:testing

# To avoid bricked workspaces (https://github.com/gitpod-io/gitpod/issues/1171)
ENV DEBIAN_FRONTEND=noninteractive

USER root

ENV LANG=en_US.UTF-8
ENV LC_ALL=C

# Get dependencies
RUN true \
	&& apt-get update -q \
	&& apt-get install -qy \
		apt-utils \
		wget \
	&& apt-get autoremove -qy \
	&& rm -rf /var/lib/apt/lists/*

# Get implementations
RUN true \
	&& apt-get update -q \
	&& apt-get install -qy \
		ecl \
		clisp \
	&& apt-get autoremove -qy \
	&& rm -rf /var/lib/apt/lists/*

# Install quicklisp
RUN true \
	&& wget https://beta.quicklisp.org/quicklisp.lisp -O /tmp/quicklisp.lisp \
	&& printf '%s\n' \
		'(load #p"/tmp/quicklisp.lisp")' \
		'(quicklisp-quickstart:install)' > /tmp/my.lisp \
	&& ecl --norc --quiet --shell /tmp/my.lisp \
	&& rm -r /tmp/*.lisp

Works using clisp -> Assuming bug

Backtrace: http://ix.io/2E1U

/usr/lib/x86_64-linux-gnu/libecl.so.20.4(cl_error+0xf0) [0x7fadebe796a0]
/usr/lib/x86_64-linux-gnu/ecl-20.4.24/sockets.fas(+0x4080) [0x7fade9073080]

Strace: http://ix.io/2E1Z / https://rust-lang.github.io/rust-log-analyzer/log-viewer/#https://cors-anywhere.herokuapp.com/ix.io/2E1Z

socket(AF_INET, SOCK_STREAM, 0xffffffff /* IPPROTO_??? */) = -1 EINVAL (Invalid argument)

@Kreyren
Copy link
Author

Kreyren commented Nov 13, 2020

works outside of docker -> Docker related issue?

Console log
kreyren@leonid:~$ ecl
ECL (Embeddable Common-Lisp) 20.4.24 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2013 Juan J. Garcia-Ripoll
Copyright (C) 2018 Daniel Kochmanski
Copyright (C) 2020 Daniel Kochmanski and Marius Gerbershagen
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level in: #<process TOP-LEVEL 0x7fb9cbecff80>.
> (load #p"/tmp/quicklisp.lisp")

;;; Loading "/tmp/quicklisp.lisp"
;;; Loading #P"/usr/lib/x86_64-linux-gnu/ecl-20.4.24/sockets.fas"

  ==== quicklisp quickstart 2015-01-28 loaded ====

    To continue with installation, evaluate: (quicklisp-quickstart:install)

    For installation options, evaluate: (quicklisp-quickstart:help)

#P"/tmp/quicklisp.lisp"
> (quicklisp-quickstart:install)

; Fetching #<url "http://beta.quicklisp.org/client/quicklisp.sexp">
; 0.82KB
==================================================
838 bytes in 0.00 seconds (818.36KB/sec)
; Fetching #<url "http://beta.quicklisp.org/client/2020-01-04/quicklisp.tar">
; 250.00KB
==================================================
256,000 bytes in 0.05 seconds (5434.78KB/sec)
; Fetching #<url "http://beta.quicklisp.org/client/2015-09-24/setup.lisp">
; 4.94KB
==================================================
5,054 bytes in 0.00 seconds (0.00KB/sec)
; Fetching #<url "http://beta.quicklisp.org/asdf/2.26/asdf.lisp">
; 194.07KB
==================================================
198,729 bytes in 0.03 seconds (6064.73KB/sec)
; Fetching #<url "http://beta.quicklisp.org/dist/quicklisp.txt">
; 0.40KB
==================================================
408 bytes in 0.00 seconds (398.44KB/sec)
Installing dist "quicklisp" version "2020-10-16".
; Fetching #<url "http://beta.quicklisp.org/dist/quicklisp/2020-10-16/releases.txt">
; 468.69KB
==================================================
479,939 bytes in 0.08 seconds (6249.21KB/sec)
; Fetching #<url "http://beta.quicklisp.org/dist/quicklisp/2020-10-16/systems.txt">
; 341.59KB
==================================================
349,788 bytes in 0.05 seconds (7267.87KB/sec)

  ==== quicklisp installed ====

    To load a system, use: (ql:quickload "system-name")

    To find systems, use: (ql:system-apropos "term")

    To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)

    For more information, see http://www.quicklisp.org/beta/

NIL

@Kreyren
Copy link
Author

Kreyren commented Nov 13, 2020

Allegedly seems to be issue at https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/contrib/sockets/sockets.lisp#L361

seems that in L355 the function FF-SOCKET is called to create the socket, and its third argument is proto-num, quite possibly computed by get-protocol-by-name in L348 -- Anonymous

and that function is allowed to return -1, so 0xffffffff, if the system does not recognize the protocol via getprotobyname - see https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/contrib/sockets/sockets.lisp#L582 -- Anonymous

try apt install netbase in your docker image -- Anonymous

you don't have libnss available in your docker image -- Anonymous

maybe your idea about the missing /etc/protocols is correct; the netbase package will install this file -- Anonymous

@Kreyren
Copy link
Author

Kreyren commented Nov 13, 2020

Solved by installing package netbase.

CC @xach is this something actionable by quicklisp? Maybe adding check for /etc/protocols presence on ecl assuming that it seems that lack of it is causing fatal err?

@Kreyren
Copy link
Author

Kreyren commented Nov 13, 2020

Notice: Patch submitted by the lisp community, waiting for hyperlink to close this issue.

@phoe
Copy link

phoe commented Nov 13, 2020

Not actionable by Quicklisp; it's a ECL-related issue.

Merge request at https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/233

@Kreyren
Copy link
Author

Kreyren commented Nov 13, 2020

@Kreyren Kreyren closed this as completed Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants