본문 바로가기
리눅스

[vm] ubuntu 클라우드 이미지에서 apt 사용시 E: Could not get lock /var/lib/dpkg/lock-frontend 오류 발생시 처리 방법

by hs_seo 2021. 12. 29.

ubuntu의 클라우드 이미지를 사용할 때 환경에 따라서 apt 사용시 락(lock)이 걸려서 사용을 하지 못하는 경우가 있습니다.

 

이 경우 원인은 다른 프로세스에서 apt를 사용하고 있을 때 발생합니다. 여러 가지 원인이 있을 수 있는데 저 같은 경우에는 사용하는 네트워크 환경에서 apt의 기본 리파지토리에 접근할 수 없어서 발생하였습니다. 기본 리파지토리에 접근이 안되는데 apt-daily.service 가 실행되어 다른 패키지를 설치 할 수 없는 문제가 발생하였습니다.

 

해결 방법 - apt-daily.service 종료

이 문제를 해결하는 방법은 apt-daily.service를 종료하고, /etc/apt/sources.list 파일을 교체 후 다시 실행하는 것입니다.

 

https://unix.stackexchange.com/questions/315502/how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image

 

How to disable `apt-daily.service` on Ubuntu cloud VM image?

The Ubuntu 16.04 server VM image apparently starts the "apt-daily.service" every 12 hours or so; this service performs various APT-related tasks like refreshing the list of available packages, perf...

unix.stackexchange.com

https://saveriomiroddi.github.io/Handling-the-apt-lock-on-ubuntu-server-installations/

 

Handling the apt lock on Ubuntu Server installations (the infamous "Could not get lock /var/lib/apt/lists/lock")

When managing Ubuntu Server installations, for example image templates in the cloud, one of the main issues one comes across is apt locking, which causes the the annoying error Could not get lock /var/lib/apt/lists/lock, typically “at the worst times”.

saveriomiroddi.github.io

 

반응형