[우분투] WSL 첫 기동후 apt-get update error

OWLS·2024년 5월 2일

우분투

목록 보기
1/3

서론

개인용 노트북을 서버 컴으로 활용하려고 wsl 설치하고 sudo apt-get update 하는데 에러가 자꾸 난다. 이에 대한 해결책을 찾아보았다. gdp? 같은

문제

케이스 1

$ sudo apt-get update -y
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
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.

케이스 2

$sudo apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 https://apt.kubernetes.io kubernetes-xenial InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 https://apt.kubernetes.io kubernetes-xenial InRelease
Ign:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:3 https://apt.kubernetes.io kubernetes-xenial InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 https://apt.kubernetes.io kubernetes-xenial InRelease
Temporary failure resolving 'apt.kubernetes.io'
Ign:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
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: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease Temporary failure resolving 'apt.kubernetes.io'
W: Some index files failed to download. They have been ignored, or old ones used instead.

본론

https://hs5555.tistory.com/44

여기서 해결했다.


해결방법
$ vi /etc/network/interfaces 를 열고
dns-nameservers 8.8.8.8 8.8.4.4 를 추가.
esc + :wq!로 저장 후 닫기
$ vi /etc/resolv.conf 를 열고
nameserver 8.8.8.8
nameserver 8.8.4.4
를 추가

여기서 작성후 can't open file for writing 에러를 만나는 경우가 있는데 그러면 다음과 같이 입력하면 된다.


해결방법
$ sudo vi /etc/network/interfaces 를 열고
dns-nameservers 8.8.8.8 8.8.4.4 를 추가.
esc + :wq!로 저장 후 닫기
$ sudo vi /etc/resolv.conf 를 열고
nameserver 8.8.8.8
nameserver 8.8.4.4
를 추가

vi 앞에 sudo 붙이면 된다.

저거 하고 나니 스턱 걸린 것처럼 기다렸다가 안되던 기존 상황에서 뭔가 다운로드가 확실히 된다는걸 느낀다.

결론

해당 방법 올려주신 분 감사합니다.

profile
코딩에 관심 많은 사람

0개의 댓글