2

I have a problem with my Raspberry Pi 4B running Raspbian

When I boot it, internet through wifi works, but after some hours (between 6 and 24 hours, approximately), wifi is still working but nothing works. Web pages are not found, pinging doesn't get any response, apt is not able to download anything, I can't ssh nor vnc my Pi 4B, etc...

I also have a Raspberry Zero and I don't have any problem with it.

When connectivity works, I have this output:

pi@raspberrypi:~ $ sudo ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether dc:a6:32:22:b9:84  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 9  bytes 524 (524.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9  bytes 524 (524.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.68  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a091:e8d0:2ce:89e3  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:22:b9:85  txqueuelen 1000  (Ethernet)
        RX packets 91025  bytes 136099814 (129.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35550  bytes 3194179 (3.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

pi@raspberrypi:~ $ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0
pi@raspberrypi:~ $ 

But when the connectivity is lost, the state of the net is the following:

pi@raspberrypi:~ $ sudo ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether dc:a6:32:22:b9:84  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 5018  bytes 676532 (660.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5018  bytes 676532 (660.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.197.68  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::a091:e8d0:2ce:89e3  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:22:b9:85  txqueuelen 1000  (Ethernet)
        RX packets 18856  bytes 3990231 (3.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2883  bytes 228805 (223.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

pi@raspberrypi:~ $ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     303    0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     303    0        0 wlan0
pi@raspberrypi:~ $ 

So, I've lost the gateway in the wlan interface according to the route command. I'm sure that the problem is related to this. Some people has the problem that the net interface changes to the eth0 interface, but not in this case.

I'm using the official 3A power supply, so that shouldn't be the problem.

Someone has a clearer idea of what to try?

EDIT 1:

The following commands provide extra information:

pi@raspberrypi:~ $ systemctl status dhcpcd.service 
● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-02-08 21:58:54 CET; 1 day 23h ago
  Process: 351 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -b (code=exited, status=0/SUCCESS)
 Main PID: 395 (dhcpcd)
    Tasks: 2 (limit: 4915)
   Memory: 4.9M
   CGroup: /system.slice/dhcpcd.service
           ├─395 /sbin/dhcpcd -q -b
           └─503 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext

Feb 10 21:01:13 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:02:16 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:03:21 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:04:24 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:05:28 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:06:33 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:07:37 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:08:41 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:09:44 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 10 21:10:49 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
~
~
~
~

Also this other command:

pi@raspberrypi:~ $ journalctl --boot --unit=dhcpcd.service
-- Logs begin at Sat 2020-02-08 21:58:50 CET, end at Mon 2020-02-10 21:20:04 CET. --
Feb 08 21:58:53 raspberrypi systemd[1]: Starting dhcpcd on all interfaces...
Feb 08 21:58:54 raspberrypi dhcpcd[351]: dev: loaded udev
Feb 08 21:58:54 raspberrypi dhcpcd[351]: forked to background, child pid 395
Feb 08 21:58:54 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: connected to Access Point `'
Feb 08 21:58:55 raspberrypi dhcpcd[395]: eth0: waiting for carrier
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: waiting for carrier
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: carrier acquired
Feb 08 21:58:55 raspberrypi dhcpcd[395]: DUID 00:01:00:01:25:1e:c6:d7:dc:a6:32:22:b9:85
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: IAID 32:22:b9:85
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: adding address fe80::8d8f:2125:37e7:18b6
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: carrier lost
Feb 08 21:58:55 raspberrypi dhcpcd[395]: wlan0: deleting address fe80::8d8f:2125:37e7:18b6
Feb 08 21:59:00 raspberrypi dhcpcd[395]: wlan0: carrier acquired
Feb 08 21:59:00 raspberrypi dhcpcd[395]: wlan0: connected to Access Point `MiFibra-56BA'
Feb 08 21:59:00 raspberrypi dhcpcd[395]: wlan0: IAID 32:22:b9:85
Feb 08 21:59:00 raspberrypi dhcpcd[395]: wlan0: adding address fe80::a091:e8d0:2ce:89e3
Feb 08 21:59:00 raspberrypi dhcpcd[395]: wlan0: soliciting an IPv6 router
Feb 08 21:59:01 raspberrypi dhcpcd[395]: wlan0: rebinding lease of 192.168.1.68
Feb 08 21:59:01 raspberrypi dhcpcd[395]: wlan0: probing address 192.168.1.68/24
Feb 08 21:59:06 raspberrypi dhcpcd[395]: wlan0: leased 192.168.1.68 for 86400 seconds
Feb 08 21:59:06 raspberrypi dhcpcd[395]: wlan0: adding route to 192.168.1.0/24
Feb 08 21:59:06 raspberrypi dhcpcd[395]: wlan0: adding default route via 192.168.1.1
Feb 08 21:59:14 raspberrypi dhcpcd[395]: wlan0: no IPv6 Routers available
Feb 09 18:59:47 raspberrypi dhcpcd[395]: wlan0: failed to renew DHCP, rebinding
Feb 09 18:59:48 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 18:59:51 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 18:59:59 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 19:00:14 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 19:00:46 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 19:01:50 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 19:02:53 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
.
.
.
.
.
Feb 09 21:54:52 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:55:56 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:57:00 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:58:04 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:59:09 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:59:47 raspberrypi dhcpcd[395]: wlan0: DHCP lease expired
Feb 09 21:59:50 raspberrypi dhcpcd[395]: wlan0: deleting route to 192.168.1.0/24
Feb 09 21:59:50 raspberrypi dhcpcd[395]: wlan0: deleting default route via 192.168.1.1
Feb 09 21:59:50 raspberrypi dhcpcd[395]: wlan0: soliciting a DHCP lease
Feb 09 21:59:50 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:59:54 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 21:59:55 raspberrypi dhcpcd[395]: wlan0: probing for an IPv4LL address
Feb 09 21:59:55 raspberrypi dhcpcd[395]: arp_probe1: No buffer space available
Feb 09 21:59:57 raspberrypi dhcpcd[395]: arp_probe1: No buffer space available
Feb 09 21:59:58 raspberrypi dhcpcd[395]: arp_probe1: No buffer space available
Feb 09 22:00:00 raspberrypi dhcpcd[395]: wlan0: using IPv4LL address 169.254.197.68
Feb 09 22:00:05 raspberrypi dhcpcd[395]: wlan0: adding route to 169.254.0.0/16
Feb 09 22:00:05 raspberrypi dhcpcd[395]: wlan0: adding default route
Feb 09 22:00:05 raspberrypi dhcpcd[395]: arp_announce1: No buffer space available
Feb 09 22:00:05 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:00:07 raspberrypi dhcpcd[395]: arp_announce1: No buffer space available
Feb 09 22:00:22 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:00:55 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:01:59 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:03:03 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:04:06 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:05:11 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
Feb 09 22:06:16 raspberrypi dhcpcd[395]: wlan0: bpf_send: No buffer space available
.
.
.
And goes on forever...

EDIT 2:

Trying to renew the lease produces this error:

pi@raspberrypi:~ $ sudo dhclient -v wlan0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/dc:a6:32:22:b9:85
Sending on   LPF/wlan0/dc:a6:32:22:b9:85
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
send_packet: No buffer space available
dhclient.c:2445: Failed to send 300 byte long packet over wlan0 interface.
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
send_packet: No buffer space available
dhclient.c:2445: Failed to send 300 byte long packet over wlan0 interface.
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
send_packet: No buffer space available
dhclient.c:2445: Failed to send 300 byte long packet over wlan0 interface.
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
send_packet: No buffer space available
dhclient.c:2445: Failed to send 300 byte long packet over wlan0 interface.
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
send_packet: No buffer space available
dhclient.c:2445: Failed to send 300 byte long packet over wlan0 interface.
^C
pi@raspberrypi:~ $  
6
  • 1
    Not only have you lost gateway you have lost IP address. This normally shouldn't happen and is probably external to the Pi (unless you have a non-standard networking configuration). You can try renewing the lease with sudo dhclient -v wlan0
    – Milliways
    Feb 10, 2020 at 0:55
  • 2
    When you have connectivity it would be interesting to see what the dhcp-lease-time is in cat /var/lib/dhcp/dhclient.leases
    – Milliways
    Feb 10, 2020 at 1:08
  • You may be losing connectivity to your router ... I would check the router logs and the syslog on the Pi to see if it gives you a clue on what's happening
    – rr0ss0rr
    Feb 10, 2020 at 1:45
  • No, I can't renew the lease. I've got a 'No buffer space available' error. dhcp lease time is 86400 seconds (24h) @Milliways
    – mareram
    Feb 15, 2020 at 19:16
  • Sadly my router doesn't keep logs @rr0ss0rr
    – mareram
    Feb 15, 2020 at 19:17

2 Answers 2

3

One possible problem may be the DHCP client. It will always get an ip address and network configuration (DNS server, gateway, default route etc.) on boot up. When the lease has expired the DHCP client may have a problem to renew it. If it cannot renew its ip addres then it will configure a link-local ip address 169.254.197.68/16 which does not fit to you local network 192.168.1.0/24. I assume you are using default dhcpcd on your RasPi. Look at the journal if you can find some error messages with:

rpi ~$ systemctl status dhcpcd.service
rpi ~$ journalctl --boot --unit=dhcpcd.service

When the connectivity is lost then try to renew it manual:

rpi ~$ sudo dhcpcd --renew wlan0
# if it doesn't work then try:
rpi ~$ sudo dhcpcd --reconfigure

If this helps then you have to look at your network configuration and the DHCP server (on your router?) why renewing of a lease does not work.

2
  • No luck with both last commands, but systemclt and journalctl has provided some weird information. I add it to the body of the question under EDIT 1.
    – mareram
    Feb 10, 2020 at 21:48
  • It seems that the problem is related to a buffer being exhausted. A fast search in Google suggests to turn off any firewall in Raspbian or the router that may be on or turning off / uninstalling programs that may be hogging network buffers, but nothing is very clear. I have just rebooted the Pi, so connectivity works now. I'll wait for it to fail again and will try those things.
    – mareram
    Feb 10, 2020 at 22:09
2

I found out that my wlan0 was disconnecting due to country mismatch on a router and board itself.

Once I set them both to matching, disconnects vanished.

Router setup: OpenWRT configuration supplementary image

And wpa supplicant config:

country=NL
ap_scan=1
passive_scan=1

network={
      ...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.