[Ubuntu, Linux] apt update, apt upgrade 에러 해결방법

문제의 시작

오라클 프리티어 인스턴스들을 너무 잘 쓰고 있는데, 오늘 갑자기 업데이트 중 에러가 나옵니다. 게다가 엄청 느려진 속도는 덤..

Hit:1 https://download.docker.com/linux/ubuntu focal InRelease Hit:2 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy InRelease Hit:3 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy-updates InRelease Get:4 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB] Ign:5 http://security.ubuntu.com/ubuntu jammy-security InRelease Ign:5 http://security.ubuntu.com/ubuntu jammy-security InRelease Ign:5 http://security.ubuntu.com/ubuntu jammy-security InRelease Err:5 http://security.ubuntu.com/ubuntu jammy-security InRelease Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out [IP: 185.125.190.36 80] Fetched 99.8 kB in 1min 10s (1424 B/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 2 packages can be upgraded. Run 'apt list --upgradable' to see them. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out [IP: 185.125.190.36 80] W: Some index files failed to download. They have been ignored, or old ones used instead. siane@oce1:~$ sudo apt update Hit:1 https://download.docker.com/linux/ubuntu focal InRelease Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Hit:3 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy InRelease Hit:4 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy-updates InRelease Get:5 http://ap-chuncheon-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB] Fetched 210 kB in 7s (29.8 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 2 packages can be upgraded. Run 'apt list --upgradable' to see them.

Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19)라는 에러가 뜨는데..

아 왜…

어.. 찾아보니 우분투 서버 죽어서 그렇다고 합니다.

구글링을 해보니 아래 내용이 나오는데.. 저는 적용해도 오류가 나더라구요.
https://wavescats.github.io/error/2022/05/18/ubun7.html

해결

위 블로그의 팁대로 초기화를 해봤으나, 문제가 해결되진 않았고, 제 경우 그냥 저장소 주소를 카카오로 변경했습니다.

오라클 프리티어의 경우 /etc/apt/sources.list 파일이 아래와 같이 되어있습니다.

## Note, this file is written by cloud-init on first boot of an instance ## modifications made here will not survive a re-bundle. ## if you wish to make changes you can: ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg ##     or do the same in user-data ## b.) add sources in /etc/apt/sources.list.d ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy main restricted # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates main restricted # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy universe # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy universe deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates universe # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy multiverse # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy multiverse deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates multiverse # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse # deb-src http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu jammy-security main restricted # deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted deb http://security.ubuntu.com/ubuntu jammy-security universe # deb-src http://security.ubuntu.com/ubuntu jammy-security universe deb http://security.ubuntu.com/ubuntu jammy-security multiverse # deb-src http://security.ubuntu.com/ubuntu jammy-security multiverse

첫번째 문구를 보면 뭐 유지가 안된다는거같은데, 일단 씌워봅니다(…?)

내용 다 지우고 아래 내용을 넣습니다.

deb http://mirror.kakao.com/ubuntu jammy main restricted universe multiverse deb http://mirror.kakao.com/ubuntu jammy-updates main restricted universe multiverse deb http://mirror.kakao.com/ubuntu jammy-security main restricted universe multiverse

재시도시 빠르게 받아옵니다. 업그레이드 되지 않은 패키지가 3개가 있다고 나오는데, 이건

apt install -y --only-upgrade [패키지명]으로 입력하면 됩니다.

{{#is "post"}} {{/is}}