728x90
우분투 22.04 LTS 환경에서 apt(dpkg) 오류와 패키지 의존성 문제를 해결하는 방법
테스트 환경
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
문제 발생
$ apt install nodejs
...
Errors were encountered while processing:
mysql-server-8.0
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
시도 1: dpkg 상태 복구
cd /var/lib/dpkg/info
rm -rf *
dpkg --configure -a
$ dpkg --configure -a
Setting up libpaper1:amd64 (1.1.28build2) ...
Setting up libgs9:amd64 (9.55.0~dfsg1-0ubuntu5.1) ...
Setting up libpaper-utils (1.1.28build2) ...
Setting up ghostscript (9.55.0~dfsg1-0ubuntu5.1) ...
Setting up cups-filters (1.28.15-0ubuntu1) ...
Setting up lsb-printing (11.1.0ubuntu4) ...
Setting up lsb (11.1.0ubuntu4) ...
시도 2: APT 업데이트 및 업그레이드 확인
apt update
$ apt update
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://kr.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
82 packages can be upgraded. Run 'apt list --upgradable' to see them.
728x90
추가 오류: dpkg 파일 목록 손상 경고
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 82 not upgraded.
Need to get 0 B/192 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: warning: files list file for package 'libctf0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'cups-ipp-utils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libnet-ssleay-perl:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pkg-resources' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libjpeg8:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'fonts-ubuntu-console' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'cryptsetup-bin' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'automake' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libip4tc2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libksba8:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'pinentry-curses' missing; assuming package has no files currently installed
시도 3: 파일 목록 손상된 패키지 재설치
for package in $(apt-get upgrade 2>&1 |\
grep "warning: files list file for package '" |\
grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do
apt-get install --reinstall "$package";
done
(또는) 한 줄 명령어
for package in $(apt-get upgrade 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package"; done
결과: 복구 실패
dpkg 파일 정보가 삭제된 상태에서 패키지 재설치가 정상 동작하지 않음
의존성 충돌 및 내부 상태 오류로 복구 중단됨
일부 패키지는 여전히 손상된 상태로 유지됨
권장 해결 방안
정상적인 복구 절차 (권장)
sudo dpkg --configure -a
sudo apt-get install -f
손상된 패키지 목록 확인 및 개별 재설치
sudo apt-get install --reinstall <패키지명>
참고URL
- dpkg: warning: files list file for package 'x' missing : https://wiki.butou.ma/linux/dpkg-warning-files-list-file-for-package-x-missing
- dpkg: warning: files list file for package 'xxxx' missing; assuming package has no files currently installed : https://hefengbao.github.io/helloworld/dpkg-warning-files-list-file-for-package-xxxx-missing-assuming-package-has-no-files-currently-installed.html
728x90
'리눅스' 카테고리의 다른 글
[draft] 우분투에 redis를 설치하는 방법 (0) | 2023.01.10 |
---|---|
[draft] 우분투에 node와 npm을 설치하는 방법 (1) | 2023.01.10 |
[draft] 우분투에서 MySQL 8을 바이너리 파일로 설치하는 방법 (0) | 2023.01.09 |
GNU C 라이브러리(glibc)의 버전을 확인하는 방법 (0) | 2023.01.09 |
CentOS 7에서 MySQL 8을 바이너리 파일로 설치하는 방법 (0) | 2023.01.09 |