본문 바로가기

리눅스

apt(dpkg) error

728x90

apt(dpkg) error

 - 패키지들간의 의존성 문제

테스트 환경

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

apt(dpkg) error

$ 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)

apt(dpkg) error 해결 방법

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) ...
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.

dpkg: warning: files list file for package 에러

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

 

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

 

 

복구 실패

 

참고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