본문 바로가기
인프라

Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend

by IT맥구리나스 2022. 4. 19.

문제점

apt update && apt upgrade -y 업그레이드 시도시  cache lock 이 걸린 에러가 발생하며 명령을 수행하지 않음

root@ubuntu:~# apt update && apt upgrade -y
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal InRelease                                                        
Hit:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease                                  
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease   
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
130 packages can be upgraded. Run 'apt list --upgradable' to see them.
^Citing for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 22186 (unattended-upgr)... 67s

 

해결방법

아래 명령으로 lock파일 삭제 후 다시 apt update && apt upgrade -y 수행

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

댓글