카테고리 없음

wsl2에서 네트워크가 안될 때 temporary failure resolving 'archive.ubuntu.com' wsl 2

개발자_이훈규 2021. 9. 23. 13:32

temporary failure resolving 'archive.ubuntu.com' wsl 2

 

시작은

wsl2 terminal에서 code를 했는데 update를 하려고 하다가 에러가 나오면서 동작하지 않았다.

그리고 sudo apt-get update를 해도 동작하지 않는 것을 보고 문제를 해결하기 시작함

 

그리고 vi /etc/resolv.conf 을 수정해봐도 다시 재생산된다.

 

결국 해결방법은 servername이다.

 

1) 아래처럼 먼저 wsl2에서 자동생성되는 것을 막는다

https://stackoverflow.com/a/63617843

 

1 Prevent /etc/resolfv.conf to become "corrupted"

  1. Create a file: /etc/wsl.conf.
  2. Put the following lines in the file

[network] generateResolvConf = false

  1. In a cmd window, run wsl --shutdown
  2. Restart WSL2
  3. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file.
  4. Put the following lines in the file

nameserver 8.8.8.8

  1. Repeat step 3 and 4. You will see git working fine now.

Credits to NonStatic who shared it on github

 

(/etc/resolv.conf의 soft link를 제거하고 새 파일을 만듭니다)

 

그렇게 했더니 다 해결되었습니다