LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Curl, git, other commands hang while trying to download file on Ubuntu 18 (https://www.linuxquestions.org/questions/linux-networking-3/curl-git-other-commands-hang-while-trying-to-download-file-on-ubuntu-18-a-4175662643/)

Sbrizzu 10-16-2019 03:26 PM

Curl, git, other commands hang while trying to download file on Ubuntu 18
 
Currently on Ubuntu 18.04.12, when I try to download something from the terminal, or push to git or any similar command it always hangs on the download either indefinitely or for a very long time. However when I Ctrl+C and try again it usually works after a couple of tries.

I was able to diagnose a bit and the hanging happens when curl tries to resolve the ipv6 address of the server instead of the ipv4. Problem is, I don't have ipv6 configured or an ipv6 DNS server setup for that matter, so I'm really lost why it would try that (or at least why it would try that so many times and not revert back to ipv4). I disabled ipv6 with sysctl but it doesn't make a difference.

I'm a bit lost here since this doesn't seem to happen on other machines in the same network, but I believe this one is the only one with Ubuntu 18.

ondoho 10-17-2019 02:51 AM

Sounds like a general networking problem.
Let's start with
Code:

ping -4 archive.org
ping -6 google.com


Sbrizzu 10-17-2019 03:12 AM

Quote:

Originally Posted by ondoho (Post 6047667)
Sounds like a general networking problem.
Let's start with
Code:

ping -4 archive.org
ping -6 google.com


I don't have any ipv6 connection set up except for link local.
ping -4 works fine, ping -6 gives
Code:

connect: Network is unreachable
.

ondoho 10-17-2019 02:12 PM

Quote:

Originally Posted by Sbrizzu (Post 6047675)
I don't have any ipv6 connection set up except for link local.

So that's on purpose?
AFAIK, an IPv4 nameserver can still return IPv6 addrsses, so... have you completely disabled IPv6 on your system?
There's something in /etc, sysctl.conf IIRC, that needs to be edited accordingly. or kernel command line.

Sbrizzu 10-17-2019 03:27 PM

Quote:

Originally Posted by ondoho (Post 6047852)
So that's on purpose?
AFAIK, an IPv4 nameserver can still return IPv6 addrsses, so... have you completely disabled IPv6 on your system?
There's something in /etc, sysctl.conf IIRC, that needs to be edited accordingly. or kernel command line.

I don't care for ipv6 so I haven't set anything up. I already tried disabling ipv6 with everything you mentioned but I got nothing out of it, curl would still try to resolve ipv6 addresses. I have some degree of control over the DNS server since I use pfSense as a resolver+forwarder, do you think I could do anything with that?

ondoho 10-18-2019 01:06 PM

what exactly did or did you not do?
we need information if you want help.
please read the first two links in my signature.

Firerat 10-18-2019 06:16 PM

make curl noisy

Code:

curl -v ifconfig.me
ifconfig.me will just return your external IP address

sometimes you may need to ask curl to follow redirects with -L

long shot
when you are having network troubles one of the causes can be your system clock being out of sync

Unlikely, and I have no idea why I thought of that.
still, confirm the date/time is correct

verndog 10-18-2019 08:40 PM

I have to disable ipv6 some times or my system will hang. Try this temp fix on ipv6. See if it makes a difference:
Code:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

Sbrizzu 10-24-2019 12:10 PM

Quote:

Originally Posted by Firerat (Post 6048364)
make curl noisy

Code:

curl -v ifconfig.me
ifconfig.me will just return your external IP address

sometimes you may need to ask curl to follow redirects with -L

long shot
when you are having network troubles one of the causes can be your system clock being out of sync

Unlikely, and I have no idea why I thought of that.
still, confirm the date/time is correct

I checked the clock and it is fine, however when I try to curl it gives me:
Code:

* Rebuilt URL to: ifconfig.me/
*  Trying 216.239.34.21...
* TCP_NODELAY set
* connect to 216.239.34.21 port 80 failed: Connection timed out
*  Trying 216.239.36.21...
* TCP_NODELAY set
* After 83934ms connect time, move on!
* connect to 216.239.36.21 port 80 failed: Connection timed out
*  Trying 216.239.38.21...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.38.21) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 24 Oct 2019 17:07:15 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 11
< x-cloud-trace-context: c711059e58d1e24f6fc97610cc424ef6/1629997535873016237
< Access-Control-Allow-Origin: *
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: strict-origin-when-cross-origin
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<
* Connection #0 to host ifconfig.me left intact

while on another machine it works immediately.

Sbrizzu 10-24-2019 12:10 PM

Quote:

Originally Posted by verndog (Post 6048387)
I have to disable ipv6 some times or my system will hang. Try this temp fix on ipv6. See if it makes a difference:
Code:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

I already tried that but it doesn't make a difference sadly.

Firerat 10-24-2019 12:31 PM

Quote:

Originally Posted by Sbrizzu (Post 6050296)
I checked the clock and it is fine, however when I try to curl it gives me:
Code:

<snip>
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<snip>

while on another machine it works immediately.

what does it look like on the working one

the one that fails is going through a local squid proxy

Sbrizzu 10-24-2019 12:32 PM

Quote:

Originally Posted by Firerat (Post 6050306)
what does it look like on the working one

the one that fails is going through a local squid proxy

Both are behind a pfSense with the squid proxy you see here.
This is the response on another machine:
Code:

* Rebuilt URL to: ifconfig.me/
*  Trying 216.239.34.21...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.34.21) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 24 Oct 2019 17:28:28 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 11
< x-cloud-trace-context: c41bc91ad31ee2624520e2827a5e9c3d/1184538786210428103
< Access-Control-Allow-Origin: *
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: strict-origin-when-cross-origin
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<
* Connection #0 to host ifconfig.me left intact


Firerat 10-24-2019 12:34 PM

Quote:

Originally Posted by Sbrizzu (Post 6050308)
Both are behind a pfSense with the squid proxy you see here.

both machines are not using the same squid proxy
they are each using their own ( localhost:3128 )


Edit

ahh, wait
I may have got confused a little

it is working, eventually
Code:

curl -v --proxy localhost:3128 ifconfig.me
<nip>
< Via: 1.1 google
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128


Firerat 10-24-2019 12:42 PM

are you getting an IP from ifconfig.me?

add on echo to the end, as it can get lost

Code:

curl ifconfig.me;echo
curl -v ifconfig.me;echo

does the working one get the timeouts?

Sbrizzu 10-24-2019 12:56 PM

Quote:

Originally Posted by Firerat (Post 6050311)
are you getting an IP from ifconfig.me?

add on echo to the end, as it can get lost

Code:

curl ifconfig.me;echo
curl -v ifconfig.me;echo

does the working one get the timeouts?

I am not familiar with the inner workings of squid but I can assure you there is no squid installed except on the router (unless Ubuntu now ships with it).

Yes, both get an IP from ifconfig.me (I clipped it from the code, sorry if that was confusing), and only one of them gets the timeouts, the other works perfectly.


All times are GMT -5. The time now is 08:15 PM.