Ubuntu dpkg: 패키지 처리 중 오류 발생(apt-get 업그레이드 후)

Ubuntu dpkg: 패키지 처리 중 오류 발생(apt-get 업그레이드 후)

최근에 이 문제를 해결하기 위해 dpkg 정보에서 모든 Python 파일을 제거했지만 작동하지 않고 심지어 손상되었습니다. 그런 다음 ubuntu-desktop을 설치한 후 다시 같은 문제에 직면했습니다.

[root@nar-ubuntu ~]$ apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  dmsetup libdevmapper1.02.1
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 202 kB/326 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://am.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdevmapper1.02.1 amd64 2:1.02.145-4.1ubuntu3.18.04.2 [127 kB]
75% [Working]                               
Get:2 http://am.archive.ubuntu.com/ubuntu bionic-updates/main amd64 dmsetup amd64 2:1.02.145-4.1ubuntu3.18.04.2 [74.5 kB]
Fetched 202 kB in 0s (903 kB/s)   
dpkg: warning: files list file for package 'python-apt-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cryptography' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python-pip-whl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-yaml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distro-info' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-rfc3339' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cffi-backend' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-olefile' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-keyring' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-crypto' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-requests-unixsocket' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-simplejson' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-idna' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-update-manager' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-keyrings.alt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-oauth' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pymacaroons' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-certifi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-wadllib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.gtk3widgets' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-zope.interface' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi-cairo' 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 'python3-gi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apport' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-markupsafe' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lazr.restfulclient' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-defer' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-problem-report' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-asn1crypto' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-macaroonbakery' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-protobuf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debconf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pexpect' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-chardet' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-systemd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-httplib2' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-requests' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-nacl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cupshelpers' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-urllib3' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab-accel:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cairo:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-launchpadlib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-secretstorage' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-tz' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-louis' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distupgrade' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python2.7-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dateutil' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python-talloc' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lazr.uri' missing; assuming package has no files currently installed
(Reading database ... 250868 files and directories currently installed.)
Preparing to unpack .../libdevmapper1.02.1_2%3a1.02.145-4.1ubuntu3.18.04.2_amd64.deb ...
Unpacking libdevmapper1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.2) over (2:1.02.145-4.1ubuntu3.18.04.1) ...
Preparing to unpack .../dmsetup_2%3a1.02.145-4.1ubuntu3.18.04.2_amd64.deb ...
Unpacking dmsetup (2:1.02.145-4.1ubuntu3.18.04.2) over (2:1.02.145-4.1ubuntu3.18.04.1) ...
Setting up python2.7 (2.7.15-4ubuntu4~18.04.2) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/usr/bin/python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7 (--configure):
 installed python2.7 package post-installation script subprocess returned error exit status 2
Setting up libdevmapper1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.2) ...
Setting up python-minimal (2.7.15~rc1-1) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 installed python-minimal package post-installation script subprocess returned error exit status 1
dpkg: error processing package apport (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Setting up dmsetup (2:1.02.145-4.1ubuntu3.18.04.2) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for initramfs-tools (0.130ubuntu3.9) ...
update-initramfs: Generating /boot/initrd.img-5.0.0-37-generic
Errors were encountered while processing:
 python2.7
 python-minimal
 apport
E: Sub-process /usr/bin/dpkg returned an error code (1)

답변1

간단히 말해서, dpkg가 처리해야 하는 파일을 삭제하면 불평이 발생합니다. 일반적으로 패키지 관리자가 처리해야 하는 파일은 삭제하면 안 됩니다.

apt, dpkg 또는 선호하는 프런트 엔드를 사용하여 패키지를 다시 설치하고 적절하게 제거하면 모든 것이 잘 될 것입니다.

최악의 시나리오는 전체 시스템을 재설치하는 것입니다. 예, 재설치 시 사용자 데이터를 유지할 수 있습니다.

종속성으로 인해 제거할 수 없는 항목이 있다면 해당 항목이 필요할 가능성이 높으며 제거해서는 안 된다는 의미입니다. 앞으로는 수동으로 제거하지 마세요. 마지막으로 해야 할 일은 누락된 링크를 추가하거나 일부 구성 파일을 편집하는 것입니다.

관련 정보