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

Cannot install in Docker base image alpine (package crypto/ecdh is not in GOROOT) #259

Closed
cosad3s opened this issue Nov 21, 2023 · 5 comments

Comments

@cosad3s
Copy link

cosad3s commented Nov 21, 2023

Works fine in Debian image.

FROM alpine:latest
RUN apk update && apk add go
RUN go install -v github.com/refraction-networking/utls@latest

Error:

/root/go/pkg/mod/github.com/refraction-networking/utls@v1.5.4/cfkem.go:25:2: package crypto/ecdh is not in GOROOT (/usr/lib/go/src/crypto/ecdh)

Encountered that error when installing https://github.com/projectdiscovery/subfinder into a custom alpine image.

@zedifen
Copy link

zedifen commented Nov 21, 2023

May I know the purpose of go installing github.com/refraction-networking/utls in the Dockerfile?

@zedifen
Copy link

zedifen commented Nov 21, 2023

I just start an alpine distro with proot-distro on termux with:

apk update
apk upgrade
apk add go
CGO_ENABLED=0 go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
~/go/bin/subfinder --version

and it seems to work fine.

Maybe there's no need to go install this dependency explicitly. And please try go build without CGO_ENABLED=0 and only add it back if things are broken.

Here's also Go's documentation on dependency-related commands: https://pkg.go.dev/cmd/go#hdr-Add_dependencies_to_current_module_and_install_them.

@gaukas
Copy link
Contributor

gaukas commented Nov 22, 2023

crypto/ecdh is added in Go 1.20. And that is the reason why uTLS requires a minimal version of Go 1.20+.

@cosad3s
Copy link
Author

cosad3s commented Nov 22, 2023

You're right @gaukas , last version of Go installed from apk for Alpine Linux is go version go1.19.9 linux/amd64.
So I think this issue can be closed as the prerequisites are not meet.

Thanks @zedifen , but I still got an error in my environment root/go/pkg/mod/github.com/refraction-networking/utls@v1.5.2/cfkem.go:25:2: package crypto/ecdh is not in GOROOT (/usr/lib/go/src/crypto/ecdh). But anyway, I will get the last Go binary instead of the package from Alpine repository.

@cosad3s cosad3s closed this as completed Nov 22, 2023
@zedifen
Copy link

zedifen commented Nov 22, 2023

Glad the issue is solved! Just for everyone's information, I searched for alpine Docker image and saw this page https://hub.docker.com/_/alpine. Looks like the latest alpine is 3.18.4.

And it turns out that my alpine is on edge branch of package repositories. I got Go 1.21.4 from there.

I also searched for go in alpine package repositories site and it seems it has Go 1.20 on v3.18 branch, while it's Go 1.19 on v3.17 branch. By the way, they are all under community repository.

Sorry that I'm not running Docker, so I'm not sure what's in your /etc/apk/repositories. Please check it if you'd like. 😊

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

3 participants