본문 바로가기
학부연구생/오류 모음집

Could not get lock /var/lib/dpkg/lock-frontend. unattended-upgr

by ㅇㅏ도 2024. 2. 20.

E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 118702 (unattended-upgr)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

이런 에러가 발생했다.

lock 되어 있는 에러들이 다양해서 본질적인 문제가 중요한 것 같다.

각 상황마다 해결 방식이 다르기 때문이다!

 

이번 에러에선 "unattended-upgr"가 주요 키워드였고 해결 방법은 아래와 같다.

 

sudo killall apt apt-get

우선 실행되고 있는 프로세스를 중지 시켜야 한다.

나의 경우에선 입력하니 프로세스가 없다고 떴다. 

sudo rm /var/lib/apt/lists/lock 
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

다른 세션에서 apt를 점유하고 있어서 생기는 문제이기 때문에 lock 파일을 제거해준다. 

 

sudo dpkg --configure -a
sudo apt update
sudo apt upgrade

위의 명령들을 쳐서 패키지 업데이트를 실행해 준다.

해결 완료!!