Davey_D
Posts: 11
Joined: Sun Mar 01, 2015 9:58 pm

[Solved]No access to internet and sudo apt update not working.

Sun May 28, 2023 7:18 pm

I cannot use sudo apt update and I cannot ping www.google.com the results are:

Code: Select all

ping www.google.com
ping: www.google.com: Temporary failure in name resolution
And

Code: Select all

sudo apt update
Err:1 http://deb.debian.org/debian bullseye InRelease
  Temporary failure resolving 'deb.debian.org'
Err:2 http://security.debian.org/debian-security bullseye-security InRelease
  Temporary failure resolving 'security.debian.org'
Err:3 http://archive.raspberrypi.org/debian bullseye InRelease
  Temporary failure resolving 'archive.raspberrypi.org'
Err:4 http://deb.debian.org/debian bullseye-updates InRelease
  Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease  Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://archive.raspberrypi.org/debian/dists/bullseye/InRelease  Temporary failure resolving 'archive.raspberrypi.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
I have searched the forum for answers and it sounds like I have a nameserver issue but it doesn't seem to be the case.

Here's the dhcpcd.conf :

Code: Select all


# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0
interface wlan0
static_routers=192.168.1.1
static domain_name_servers=62.2.24.158 62.2.17.61 8.8.8.8 8.8.4.4
static ip_address=192.168.1.121/24
Here's the resolv.conf :

Code: Select all

# Generated by resolvconf
nameserver 62.2.24.158
nameserver 62.2.17.61
nameserver 8.8.8.8
nameserver 8.8.4.4
Last edited by Davey_D on Mon May 29, 2023 10:33 am, edited 1 time in total.

terribleted
Posts: 1107
Joined: Tue Oct 06, 2020 8:07 pm

Re: No access to internet and sudo apt update not working.

Sun May 28, 2023 7:43 pm

i think you should remove the first 2 entries:

ping 62.2.24.158
PING 62.2.24.158 (62.2.24.158) 56(84) bytes of data.
^C
--- 62.2.24.158 ping statistics ---
23 packets transmitted, 0 received, 100% packet loss, time 22522ms

ping 62.2.17.61
PING 62.2.17.61 (62.2.17.61) 56(84) bytes of data.
^C
--- 62.2.17.61 ping statistics ---
11 packets transmitted, 0 received, 100% packet loss, time 10237ms

ping 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=116 time=82.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=86.4 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=86.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=116 time=80.9 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 80.903/83.980/86.438/2.466 ms

I"m not sure how many nameservers are actually tried. i normally see only 2 entries
i had a Trash-80 model 1 (circa 1980). upgrading from 4k to 16k of RAM, i thought "i'll never use this much RAM".
Now i have a computer with a million times that much memory. And i keep running out of it.
Not the computer....ME.

Davey_D
Posts: 11
Joined: Sun Mar 01, 2015 9:58 pm

Re: No access to internet and sudo apt update not working.

Sun May 28, 2023 8:52 pm

@terribleted, with or without those nameserver addresses the results are the same. What I have now done instead is commented with # the 4 lines that were added to the dhcpdf.conf

Code: Select all

#interface wlan0
#static_routers=192.168.1.1
#static domain_name_servers=8.8.8.8 8.8.4.4
#static ip_address=192.168.1.121/24
It now works fine but of course, the IP is no longer fixed.

Any idea what was wrong with those lines for setting the static IP?

terribleted
Posts: 1107
Joined: Tue Oct 06, 2020 8:07 pm

Re: No access to internet and sudo apt update not working.

Sun May 28, 2023 9:16 pm

hmmmm. well, all i can do is share the config i use to set a static IP on my wired connection.....below

5) optional: set static IP address
this is useful if you want a static IP to use VNC to remote manage and test your RPI
- open a terminal
- Edit The dhcpcd.conf:
- sudo nano /etc/dhcpcd.conf
- ADD the following lines: (below are example IP 0.90, GW=0.1, DNS servers)
# Example static IP configuration:
interface eth0
static ip_address=192.168.0.90/24
static routers=192.168.0.1
static domain_name_servers=24.116.0.53 24.116.2.50
- Save the file
- Edit interfaces file:
- sudo nano /etc/network/interfaces
- add this to the bottom of the file:
interface eth0 manual
- Save the file
(reboot)

maybe someone smarter than me will see this and chime in...

which version of the PI OS are you running?
i had a Trash-80 model 1 (circa 1980). upgrading from 4k to 16k of RAM, i thought "i'll never use this much RAM".
Now i have a computer with a million times that much memory. And i keep running out of it.
Not the computer....ME.

terribleted
Posts: 1107
Joined: Tue Oct 06, 2020 8:07 pm

Re: No access to internet and sudo apt update not working.

Sun May 28, 2023 10:53 pm

i just noticed in your commented lines:
static_routers=192.168.1.1
should be
static routers=
(not underscore)
i had a Trash-80 model 1 (circa 1980). upgrading from 4k to 16k of RAM, i thought "i'll never use this much RAM".
Now i have a computer with a million times that much memory. And i keep running out of it.
Not the computer....ME.

BigRedMailbox
Posts: 334
Joined: Sat Aug 20, 2022 10:37 pm

Re: No access to internet and sudo apt update not working.

Sun May 28, 2023 11:04 pm

If ping google.com (or any other known machine/site name) doesn't work, the next thing to try is: ping 8.8.8.8

This will tell you if your network stack is working - and if so, then the problem is DNS (aka, resolv.conf).

Also, if 8.8.8.8 doesn't work, then try: ping 192.168.x.1

(or whatever is the address of your router). If that works (but 8.8.8.8 doesn't work), then you know the networking stack is working, but either your router or your ISP is to blame.

Davey_D
Posts: 11
Joined: Sun Mar 01, 2015 9:58 pm

Re: No access to internet and sudo apt update not working.

Mon May 29, 2023 10:15 am

terribleted wrote:
Sun May 28, 2023 10:53 pm
i just noticed in your commented lines:
static_routers=192.168.1.1
should be
static routers=
(not underscore)
This is it, problem resolved. Thank you.

Return to “Troubleshooting”