I just installed Ubuntu 22.04 with Windows Subsystem for Linux following this instructions.
When I run sudo apt install update
, I get this errors:
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Long time ago (before formatting my PC), I didn't have any problem.
I was unable to find any working solution on Internet. I don't have any VPN (some people say that that is the problem).
Edit 1
I found this question and I followed the @fossfreedom♦ answer. If I try the temporary solution, all works until I reboot. I used:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
However, if I try the permanent solution, I get an error:
$ echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
tee: /etc/resolvconf/resolv.conf.d/base: No such file or directory
I still haven't tried the "package-management issues" in that answer, since I don't think that is the problem
Edit 2
All Ubuntu mirrors I checked (Spanish) are "Up to date", following @NotTheDr01ds comment. So that is not the problem.
Edit 3: Solution
Since the question was flagged as duplicated and closed, I can't answer my own question with the solution I figured out, so I add the solution here.
This is the original content of the file /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.176.1
Since this file is generated every time you start WSL, the changes from:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
are removed (command from this question). Therefore, you have to follow the instructions shown in the file, I used the command used on this other question:
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf
And now changes are permanent.
I don't know what I'm doing or why I had this problem (I'm a basic user), but if somebody wants to explain it for the future, he/she is welcomed.