編集1

編集1

権限の低いユーザーがDNSにアクセスできるにもかかわらず、私のルート設定にはDNSへのアクセス権がないようです。

$ ping google.com
PING google.com (142.251.32.110) 56(84) bytes of data.
64 bytes from 142.251.32.110 (142.251.32.110): icmp_seq=1 ttl=64 time=1.35 ms
64 bytes from 142.251.32.110 (142.251.32.110): icmp_seq=2 ttl=64 time=2.71 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.350/2.029/2.708/0.679 ms

$ sudo -E ping google.com
ping: google.com: Name or service not known

これはペアに混乱を招きますapt-get。この問題をどのように解決できますか?

WSL Ubuntuを実行しています。

編集1

rootDNS用に試しているようですlocalhost

socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 5
setsockopt(5, SOL_IP, IP_RECVERR, [1], 4) = 0
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0

特権がない私自身の場合、これに対応する行は次のとおりです。この172.*アドレスはWSLに関するものだと思います。

socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 5
setsockopt(5, SOL_IP, IP_RECVERR, [1], 4) = 0
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("172.21.160.1")}, 16) = 0

これが/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.21.160.1

編集2

ルートは読めません/etc/resolv.conf

newfstatat(AT_FDCWD, "/etc/resolv.conf", 0x7ffc8a2d25f0, 0) = -1 EACCES (Permission denied)

ベストアンサー1

問題はautomount私がwsl.conf

[automount]
root=/home/myuser

この変更を元に戻した後、rootインターネットに再びアクセスできました。私はこれが/homeネットワークを十分に速く設定できないため、起動順序の問題が原因だと思いますroot

おすすめ記事