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、または好みのフロントエンドを使用してパッケージを再インストールして適切に削除すると、すべてがうまくいくでしょう。

最悪のシナリオは、システム全体を再インストールすることです。はい、再インストール時にユーザーデータを保持できます。

依存関係のために削除できないアイテムがある場合は、そのアイテムが必要になる可能性が高く、削除しないでください。今後は手動で削除しないでください。最後にやるべきことは、欠落しているリンクを追加するか、いくつかの設定ファイルを編集することです。

おすすめ記事