Dev_R
[Linux] Ubuntu Error "E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3277 (unattended-upgr)" 해결 방법 본문
[Linux] Ubuntu Error "E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3277 (unattended-upgr)" 해결 방법
Dave(데이브) 2021. 5. 12. 09:01
[Ubuntu Error]
라즈베리파이에 설치한 Ubuntu에서 새로운 프로그램을 설치하려 했더니 아래와 같은 에러메시지를 확인 할 수 있었다.
일반 유저 권한으로 설치 시도 할때와 관리자 권한으로 설치 시도할 때의 에러메시지도 조금 차이가 있었다.
* 일반 유저 권한
E: 잠금 파일 /var/lib/dpkg/lock-frontend 파일을 열 수 없습니다 - open (13: 허가 거부)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
* 관리자 권한
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3277 (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?
[해결 방법]
이 에러는 다른 사용자 혹은 자신이 apt-get 을 사용중일 때 접근 시 발생합니다. 물론 사용중이 아닐 때도 발생한다고 합니다.
에러는 lock file 삭제로 해결 할 수 있습니다.
1. 터미널을 열어 apt, apt-get 의 프로세스를 모두 죽입니다.
sudo killall apt apt-get
2. lock 파일들을 삭제
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
3. 패키지 의존성 수정
sudo dpkg --configure -a
4. apt update
sudo apt update
위 단계를 차례차례 수행하면 아래와 같이 해당 에러를 성공적으로 해결 할 수 있다.