nextcloud / all-in-one

📦 The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.
https://hub.docker.com/r/nextcloud/all-in-one
GNU Affero General Public License v3.0
5.6k stars 651 forks source link

Curl 8.5.0 bug in Alpine 3.19 #4440

Closed leosamuele221 closed 4 months ago

leosamuele221 commented 7 months ago

Steps to reproduce

  1. Install nextcloud with latest label
  2. Install "Memories" app and Memories external container

Expected behavior

Normal work of memories transcoder

Actual behavior

Nextcloud container can't connect to memories transcoder container Screenshot 2024-03-25 122745

Screenshot 2024-03-25 123047

Host OS

CentOS 9

Nextcloud AIO version

Nextcloud AIO v8.0.0

Current channel

Latest

Possible solution

Downgrade to Alpine 3.18 Upgrade to Alpine 3.20 (as soon as available) Install curl 8.6.0 (see below)

Other valuable info

The problem is curl 8.5.0 that is affected by https://github.com/curl/curl/issues/12558. This bug is actually solved in curl 8.6.0 so you just need to update curl. Screenshot 2024-03-25 123023

Curl 8.6.0 isn't available from alpine package manager (in Alpine 3.19 the only version available is 8.5.0 https://pkgs.alpinelinux.org/packages?name=curl&branch=v3.19&repo=main) The only way to install curl 8.6.0 is to build it from source

To install from source follow this steps:

  1. enter in nextcloud-aio-nextcloud container docker exec -it nextcloud-aio-nextcloud bash

  2. remove curl 8.5.0 apk del curl

  3. download curl 8.6.0 (you can do it in any folder you want, personally I did it in "/home/test") wget https://github.com/curl/curl/releases/download/curl-8_6_0/curl-8.6.0.tar.gz

  4. unpack it tar -xf curl-8.6.0.tar.gz

  5. move to it cd curl-8.6.0

  6. install dependecies apk add openssl-dev g++ make autoconf libpsl-dev

  7. configure ./configure --with-openssl

  8. make and install make && make install

image

With curl 8.6.0 the problem is solved!

image

If you want more info on how to build curl here is the docs https://github.com/curl/curl/blob/master/docs/INSTALL.md#unix

Zoey2936 commented 7 months ago

https://gitlab.alpinelinux.org/alpine/aports/-/issues/15690 can you try running apk upgrade --no-cache -a inside the nextcloud container and then retry with the preinstalled curl?

leosamuele221 commented 7 months ago

Tried with no luck image

(I did cd home to make sure I had reset the container)

Zoey2936 commented 7 months ago

can you check if my prebuilt static curl binaries work? https://github.com/ZoeyVid/curl-quic/releases/latest

leosamuele221 commented 7 months ago

For some reason it works from CLI Screenshot 2024-03-25 142758

But not from nextcloud image

I also tried to execute it as www-data and it worked (obviously I change curl exec to 777) from CLI but not from nextcloud image

I did multiple reboots before trying

Zoey2936 commented 7 months ago

yes, because nextcloud trys to use libcurl

Zoey2936 commented 7 months ago

can you try apk add curl libcurl --repository http://dl-cdn.alpinelinux.org/alpine/edge/main inside the nextcloud container and retry?

leosamuele221 commented 7 months ago

Still nothing... image

leosamuele221 commented 7 months ago

The problem is in c-ares 1.24.0 https://github.com/c-ares/c-ares/issues/683 fixed with https://github.com/c-ares/c-ares/pull/685, and released in c-ares 1.26.0.

curl 8.6.0 from edge repository uses c-ares 1.24.0 so the problem still persist. When you build curl from source even if it's 8.6.0 it doesn't use c-ares, nor your build of curl uses c-ares @Zoey2936 that's why it worked

leosamuele221 commented 7 months ago

I did apk add curl libcurl --repository http://dl-cdn.alpinelinux.org/alpine/edge/main and apk upgrade c-ares installing c-ares 1.27.0. But still doesn't work. Now i'm confused

image

leosamuele221 commented 7 months ago

I made a script to automate build https://gist.github.com/leosamuele221/aed36a3b9135032b6a8ffe7274e58ce7

Zoey2936 commented 7 months ago

can you report this here: https://gitlab.alpinelinux.org/alpine/aports/-/issues

leosamuele221 commented 7 months ago

Yes i can, I'll do it as soon as possible. But until the problem isn't solved somebody should add a good build of curl in the nextcloud-aio-nextcloud container as a patch

One option is to run this script https://gist.github.com/leosamuele221/aed36a3b9135032b6a8ffe7274e58ce7 when creating nextcloud container (maybe in the Dockerfile) so it builds a working curl

Another better option is to build a working curl and download it from github when creating the container

szaimen commented 7 months ago

Hi, can you update to v8.1.0 beta and check if that improves things?

leosamuele221 commented 7 months ago

Hi, yes i updated it to 8.1.0 The problem is still there Obv is a curl problem, not a concern of nextcloud. image

leosamuele221 commented 6 months ago

image

Problem is still here, even after updating to Alpine 3.19

szaimen commented 6 months ago

can you report this here: https://gitlab.alpinelinux.org/alpine/aports/-/issues

Have you done so?

szaimen commented 6 months ago

Actually, I just tested and it works on my test instance: image

leosamuele221 commented 6 months ago

do curl -V

szaimen commented 6 months ago

image

phroggar commented 5 months ago

I'm coming here periodically, because we have noticed a similar issue in our setup.

I just want to share a solution which was working for us:

Specify a hostname for the container you are unable to resolve internally: e.g. setting "--hostname=mycontainer.domain.local"

You might need to take all containers down and restart them, to have them pickup the change in the local network.

This is not brilliant and i wish things would be resolved on the CURL or C-ARES side of things - but i just upgraded to Alpine 3.20 (curl 8.7.1 (aarch64-alpine-linux-musl) libcurl/8.7.1 ... c-ares/1.28.1) and i still see the problematic behaviour (everything (ping, wget, etc.) is resolving fine, but curl is not able to resolve if the hostname is missing)

szaimen commented 5 months ago

All right, that is annoying. Can someone please log an issue upstream?

AvivAvital2 commented 5 months ago

Encountered the issue while running Alpine 3.19. Initially upgraded from curl 8.5.0 to 8.7.1, but that alone did not resolve the issue for me. Was able to resolve the issue by disabling c-ares, libidn2 and libpsl by using LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --with-openssl

# curl --version
curl 8.7.1 (x86_64-pc-linux-musl) libcurl/8.7.1 OpenSSL/3.1.4 zlib/1.3.1 nghttp2/1.58.0
Release-Date: 2024-03-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets

Hope this helps

leosamuele221 commented 5 months ago

I reinstalled CentOS, a complete reset, reinstalled fresh nextcloud-aio and now everything works.

szaimen commented 4 months ago

This should hopefully be resolved with https://github.com/nextcloud/all-in-one/pull/4857

szaimen commented 4 months ago

This should hopefully be resolved with #4857

This is now released with v9.1.0 Beta. Testing and feedback is welcome! See https://github.com/nextcloud/all-in-one#how-to-switch-the-channel