WSL throws (6) Could not resolve host: raw.githubusercontent.com when trying to install NVM and cant ping google.com
Asked Answered
C

1

4

When trying to install nvm with wsl 2 on windows 11, it throws:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0curl: (6) Could not resolve host: raw.githubusercontent.com

when I try to ping google.com it errors, while ping 8.8.8.8 works!?!

Culmiferous answered 1/12, 2022 at 1:26 Comment(0)
C
12

you can try running this

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

it deletes your resolve.config file thats automatically generated when u run WSL then creates a new file and puts "nameserver 8.8.8.8", then creates a wsl.conf file and adds [network] and generateResolveConf = false to prevent auto generation of that file

you can also run

cat /etc/resolv.conf

to check the contents of the file

than

ping google.com
Culmiferous answered 1/12, 2022 at 1:26 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.