0

If in Ubuntu Server is executed:

curl https://services.gradle.org/distributions/gradle-7.5.1-bin.zip -O

appears:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:19 --:--:--     0curl: (6) Could not resolve host: services.gradle.org

Observe the curl: (6) Could not resolve host: services.gradle.org part.

If in Fedora Server is executed the same command, it shows:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

No error, but the gradle-7.5.1-bin.zip file is empty.

If you open a web browser and put the https://services.gradle.org/distributions/gradle-7.5.1-bin.zip in the address bar the download process automatically starts.

So how to fix this situation?

Note Just in case, both Linux are running as VM in VirtualBox

1 Answer 1

1

Apparently there is some problem with your DNS resolution in the ubuntu Server

Try to set an other DNS server like 8.8.8.8 or 1.1.1.1

See the contents of /etc/resolv.conf and set nameserver 8.8.8.8

update:

After fixing the issue with DNS , add -L option to curl which allows it to "follow redirects"

The problem here was that the URL does not actually provide the file, but it redirects to another URL that actually hosts the file. This is done automatically in the browser but in curl the -L option is needed.

See the output of wget as example:

% wget https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
--2022-11-07 11:16:12--  https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
Resolving services.gradle.org (services.gradle.org)... 104.18.191.9, 104.18.190.9
Connecting to services.gradle.org (services.gradle.org)|104.18.191.9|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://downloads.gradle-dn.com/distributions/gradle-7.5.1-bin.zip [following]
--2022-11-07 11:16:12--  https://downloads.gradle-dn.com/distributions/gradle-7.5.1-bin.zip
Resolving downloads.gradle-dn.com (downloads.gradle-dn.com)... 104.18.164.99, 104.18.165.99
Connecting to downloads.gradle-dn.com (downloads.gradle-dn.com)|104.18.164.99|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120635534 (115M) [application/zip]
Saving to: ‘gradle-7.5.1-bin.zip.1’

gradle-7.5.1-bin.zip.1                             100%[================================>] 115,05M  5,31MB/s    in 21s

2022-11-07 11:16:34 (5,43 MB/s) - ‘gradle-7.5.1-bin.zip.1’ saved [120635534/120635534]

301 Moved Permanently is the redirect and after that the new URL

3
  • Can you share your curl execution with the same URL used? It through a Figure - I want confirm that works in your side - once confirmed that - can you share your /etc/resolv.conf file content? - Can you indicate why nameserver 8.8.8.8 should be used? - Indicate your Linux distribution. Thanks Commented Nov 3, 2022 at 14:23
  • My response was related to the error "Could not resolve host: services.gradle.org" which shows a problem with DNS resolution. So my suggestion is about using a known good DNS server (like 8.8.8.8) to overcome this problem. Commented Nov 7, 2022 at 8:24
  • 1
    Thanks for the feedback - was only necessary add at the end of the command the -L option Commented Nov 7, 2022 at 16:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.