RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Git clone and apt not working.

Fri Jun 29, 2018 11:02 pm

Hi there, I have recently been having issues with my Pi. I can't seem to do anything download related on my pi.

When trying to do apt update, I get this:

Code: Select all

Err:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
  Cannot initiate the connection to raspbian.raspberrypi.org:80 (2a00:1098:0:80:1000:75:0:3). - connect (101: Network is unreachable) [IP: 2a00:1098:0:80:1000:75:0:3 80]
0% [Connecting to archive.raspberrypi.org (93.93.130.39)]
Additionally, when trying to clone using git it gets stuck at

Code: Select all

Cloning into 'Repository Name'
and then gives me a timeout error.

However, the internet connection to the pi is fine since Apache, FTP server, ssh, and wget work fine.

User avatar
Roken
Posts: 310
Joined: Sun Dec 31, 2017 4:35 pm
Location: UK

Re: Git clone and apt not working.

Sat Jun 30, 2018 5:42 am

Have you been playing with your dns settings? It seems that incoming connections are fine, whilst outgoing are failing.

What's the output of cat /etc/resolv.conf?
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Sat Jun 30, 2018 10:16 am

Try these commands and post the outputs:

Code: Select all

ip route
cat /etc/resolv.conf
ping -c4 8.8.8.8
ping -c4 google.com

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Sat Jun 30, 2018 2:10 pm

Roken wrote:
Sat Jun 30, 2018 5:42 am
Have you been playing with your dns settings? It seems that incoming connections are fine, whilst outgoing are failing.

What's the output of cat /etc/resolv.conf?
The only thing I've really done is set a static local IP which shouldn't affect those.

The output I get is

Code: Select all

# Generated by resolvconf
nameserver 192.168.0.1

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Sat Jun 30, 2018 2:13 pm

lmarmisa wrote:
Sat Jun 30, 2018 10:16 am
Try these commands and post the outputs:

Code: Select all

ip route
cat /etc/resolv.conf
ping -c4 8.8.8.8
ping -c4 google.com
The output I get is this:

Code: Select all

root@raspberrypi:/home/pi# ip route
default via 192.168.0.1 dev wlan0 src 192.168.0.111 metric 303
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.111 metric 303
root@raspberrypi:/home/pi# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.0.1
root@raspberrypi:/home/pi# ping -c4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=59 time=31.8 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=59 time=21.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=59 time=20.9 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=59 time=15.2 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 15.253/22.420/31.873/5.992 ms
root@raspberrypi:/home/pi# ping -c4 google.com
PING google.com (216.58.204.46) 56(84) bytes of data.
64 bytes from lhr25s12-in-f46.1e100.net (216.58.204.46): icmp_seq=1 ttl=54 time=16.2 ms
64 bytes from lhr25s12-in-f46.1e100.net (216.58.204.46): icmp_seq=2 ttl=54 time=23.2 ms
64 bytes from lhr25s12-in-f46.1e100.net (216.58.204.46): icmp_seq=3 ttl=54 time=16.8 ms
64 bytes from lhr25s12-in-f46.1e100.net (216.58.204.46): icmp_seq=4 ttl=54 time=15.5 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 15.520/17.980/23.268/3.091 ms

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Sat Jun 30, 2018 5:08 pm

Your network seems to work fine at this time.

But according to your comments, two completely independent commands are not completed due to network problems:

Code: Select all

sudo apt-get update
git clone xxxx
Is your RPi connected to the network via wifi?.

Check if this command is completed correctly:

Code: Select all

wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Sat Jun 30, 2018 5:56 pm

lmarmisa wrote:
Sat Jun 30, 2018 5:08 pm
Your network seems to work fine at this time.

But according to your comments, two completely independent commands are not completed due to network problems:

Code: Select all

sudo apt-get update
git clone xxxx
Is your RPi connected to the network via wifi?.

Check if this command is completed correctly:

Code: Select all

wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
My Pi is connected via WiFi.

The wget command is giving me timeouts.

Code: Select all

pi@raspberrypi:~/Desktop/test $ wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
--2018-06-30 17:50:00--  https://downloads.raspberrypi.org/raspbian_lite_latest
Resolving downloads.raspberrypi.org (downloads.raspberrypi.org)... 93.93.130.214, 93.93.128.211, 93.93.128.230, ...
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|93.93.130.214|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|93.93.128.211|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|93.93.128.230|:443...

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Sun Jul 01, 2018 6:22 am

The ICMP protocol (ping) works but https does not. What about http?:

Code: Select all

ping -c25 google.com
wget http://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Sat Jul 07, 2018 5:14 pm

lmarmisa wrote:
Sun Jul 01, 2018 6:22 am
The ICMP protocol (ping) works but https does not. What about http?:

Code: Select all

ping -c25 google.com
wget http://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
Hi, it still timeouts.

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Sat Jul 07, 2018 7:19 pm

Code: Select all

ping -c25 google.com
wget http://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
Hi, it still timeouts.
Hmmm. Including ping?.

I believe that the problem could be related to your router in such a way that it is filtering the traffic of protocols http and https with origin your RPi destined to the Internet.

According to /etc/resolv.conf, the IP address of your router is 192.168.0.1:
# Generated by resolvconf
nameserver 192.168.0.1
Open a browser and try connecting to http://192.168.0.1

You can type this command too:

Code: Select all

wget http://192.168.0.1 -O /dev/null
If you are able to connect to your router via http, the router is the source of your problem.

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Mon Jul 09, 2018 4:30 pm

lmarmisa wrote:
Sat Jul 07, 2018 7:19 pm

Code: Select all

ping -c25 google.com
wget http://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
wget https://downloads.raspberrypi.org/raspbian_lite_latest -O /dev/null
Hi, it still timeouts.
Hmmm. Including ping?.

I believe that the problem could be related to your router in such a way that it is filtering the traffic of protocols http and https with origin your RPi destined to the Internet.

According to /etc/resolv.conf, the IP address of your router is 192.168.0.1:
# Generated by resolvconf
nameserver 192.168.0.1
Open a browser and try connecting to http://192.168.0.1

You can type this command too:

Code: Select all


If you are able to connect to your router via http, the router is the source of your problem.
Oh sorry, the google ping did work. I forgot to do it as I overlooked it.

The wget http://192.168.0.1 -O /dev/null command worked.

Code: Select all

--2018-07-09 15:36:01--  http://192.168.0.1/
Connecting to 192.168.0.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘/dev/null’

/dev/null                         [ <=>                                              ]   7.36K  --.-KB/s    in 0.006s

2018-07-09 15:36:02 (1.23 MB/s) - ‘/dev/null’ saved [7533]

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Mon Jul 09, 2018 6:45 pm

The behaviour of your Pi seems good. The protocol http works fine inside your LAN but it fails when you try to access to the internet. The default route looks good. The gateway (your router, 192.168.0.1) is apparently dropping your http connections to the Internet.

I believe that the problem is due to your router. You should check its configuration. Why is your router filtering the outgoing http/https traffic with origin your RPi destined to the Internet?. I can not give an answer to that question at this time.

Have you assigned a static IP address to your RPi?. Have you changed the default network configuration (dhcp)?.

RealistikDash
Posts: 8
Joined: Wed Jun 06, 2018 9:18 pm

Re: Git clone and apt not working.

Wed Jul 11, 2018 6:31 pm

lmarmisa wrote:
Mon Jul 09, 2018 6:45 pm
The behaviour of your Pi seems good. The protocol http works fine inside your LAN but it fails when you try to access to the internet. The default route looks good. The gateway (your router, 192.168.0.1) is apparently dropping your http connections to the Internet.

I believe that the problem is due to your router. You should check its configuration. Why is your router filtering the outgoing http/https traffic with origin your RPi destined to the Internet?. I can not give an answer to that question at this time.

Have you assigned a static IP address to your RPi?. Have you changed the default network configuration (dhcp)?.
I have assigned a static IP. Apt used to work (I don't know if it was before or after the static IP change).

User avatar
lmarmisa
Posts: 1233
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Git clone and apt not working.

Wed Jul 11, 2018 10:10 pm

You assigned the IP 192.168.0.111. This address belongs very probably to the dhcp pool managed by your router. So, according to that IP address, the router could consider your RPi as a intruder and therefore it could drop its TCP/UDP traffic to the Internet.

Try defining a static IP not belonging to the pool. Maybe 192.168.0.2 could be a candidate. Then check if the access to the Internet works again.

pfletch101
Posts: 545
Joined: Sat Feb 24, 2018 4:09 am
Location: Illinois, USA

Re: Git clone and apt not working.

Wed Jul 11, 2018 10:18 pm

RealistikDash wrote:
Wed Jul 11, 2018 6:31 pm
lmarmisa wrote:
Mon Jul 09, 2018 6:45 pm
The behaviour of your Pi seems good. The protocol http works fine inside your LAN but it fails when you try to access to the internet. The default route looks good. The gateway (your router, 192.168.0.1) is apparently dropping your http connections to the Internet.

I believe that the problem is due to your router. You should check its configuration. Why is your router filtering the outgoing http/https traffic with origin your RPi destined to the Internet?. I can not give an answer to that question at this time.

Have you assigned a static IP address to your RPi?. Have you changed the default network configuration (dhcp)?.
I have assigned a static IP. Apt used to work (I don't know if it was before or after the static IP change).
If you wish to use a fixed IP address for your Pi (which is often a good idea), have the router assign it (based on the Pi's MAC address, which the router can usually display). Fixing the IP address at the device level is a recipe for (at best) confusion.

User avatar
davidcoton
Posts: 4260
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Git clone and apt not working.

Wed Jul 11, 2018 11:10 pm

pfletch101 wrote:
Wed Jul 11, 2018 10:18 pm
If you wish to use a fixed IP address for your Pi (which is often a good idea), have the router assign it (based on the Pi's MAC address, which the router can usually display). Fixing the IP address at the device level is a recipe for (at best) confusion.
+1.

There are three possibilities as to what has happened.
  • The router thinks it can assign 192.168.0.111 and has blocked a device using that address that it didn't assign.
  • The router has assigned that address to another device, so the two devices conflict.
  • Two devices have the same device-level IP assignment.
If you assign an IP address at device level, YOU are responsible for making sure it is in the sub-net, otherwise unused, and NOT in the DHCP pool.
You may also have problems if the network configuration is changed, or if you move your Pi to another network.

As quoted above, it is far better to get the router to assign a "reserved" address based on the Pi's MAC. This solution is more robust and keeps the Pi portable (it will get a DHCP address on any other network that allows new devices).
Signature retired

Return to “Troubleshooting”