I am running Ubuntu 18.04 on Windows 10 WSL2. The command
sudo apt update
could not resolve all the DNS names (for example archive.ubuntu.com
):
np@DESKTOP-LF80KK2:/mnt/c/Users/niko$ sudo apt update
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
...
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
One of the addresses giving the error was http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease
, but still curl
for it did work:
np@DESKTOP-LF80KK2:/mnt/c/Users/niko$ curl http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease | head -n 20
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Origin: Ubuntu
Label: Ubuntu
Suite: bionic
Version: 18.04
Codename: bionic
Date: Thu, 26 Apr 2018 23:37:48 UTC
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Components: main restricted universe multiverse
Description: Ubuntu Bionic 18.04
MD5Sum:
32a92a5c20f378d42dd2d2f4f28f6637 628836439 Contents-amd64
53c6a594819b51a5755f88b45d1eff7f 37766986 Contents-arm64.gz
cd7bf6d50403da4348ee48138eace986 585939706 Contents-ppc64el
af42d07307c5d1398c75e28986b36509 616261664 Contents-i386
98f43960ac7029b4948a13614038593c 584794633 Contents-armhf
31848d4faedf11946ff1af9c281f4e6b 39528051 Contents-amd64.gz
14acbaf3166ff5b151cbac659bf6a491 36634480 Contents-s390x.gz
5 236k 5 13787 0 0 35260 0 0:00:06 --:--:-- 0:00:06 35260
curl: (23) Failed writing body (37 != 5632)
Also pinging or curling archive.ubuntu.com
did work. This would mean that the domain name archive.ubuntu.com
is resolved into an IP address correctly.
The etc/resolv.conf
was:
np@DESKTOP-LF80KK2:/mnt/c/Users/niko$ sudo cat /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.26.96.1
The problem for apt update
is solved for updating the nameserver
in the etc/resolv.conf
to for example 8.8.8.8
.
Question
How can curl
and ping
work for archive.ubuntu.com
while apt update
does not? Do they use different source for DNS nameservers?