Ubuntu Mateのスクリプトフックにより適切な更新が失敗する

Ubuntu Mateのスクリプトフックにより適切な更新が失敗する

私はRaspberry Pi 3でUbuntu Mate()を実行していますaarch64。私はこの問題がRPi3に限定された問題ではなく、Debianにとってより特定的な問題だと思います。

pipを使用してpython3とpipをインストールし、apt install python3-pipスクリプトを正常に実行しました。

しかし、1日後、Pythonは次のような文句を言い、動作を停止しました。

No module named "threading"
...

apt update等をすると同じエラーが発生しました。apt install

現在、私のコンピュータでPythonの状態が破損しており、aptこの問題を解決する方法がわかりません。 aptの機能を損なうファイルを削除してみましたが、状況がさらに悪化しているようです。

それでは、簡単なapt updateデモを見てみましょう。

$ sudo apt -oDebug::RunScripts=true update
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
Hit:3 http://ppa.launchpad.net/ubuntu-pi-flavour-makers/ppa/ubuntu focal InRelease
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages [303 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 Packages [159 kB]
Fetched 680 kB in 5s (135 kB/s)                          
Running external script: '[ ! -f /var/run/dbus/system_bus_socket ] || /usr/bin/dbus-send --system --dest=org.debian.apt --type=signal /org/debian/apt org.debian.apt.CacheChanged || true'
Running external script: '/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null'
Running external script: 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x0000ffff9547b010 (most recent call first):
<no Python frame>
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

システム全体を再インストールせずにどのように問題を解決できますか?

ベストアンサー1

E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'

犯人を指摘しなさい: /usr/lib/cnf-update-db。無効にすると、apt updateより多くの情報を得ることができます。

sudo mv /etc/apt/apt.conf.d/50command-not-found{,.disabled}

すべての問題が解決した後に再度有効にすることを忘れないでください。

sudo mv /etc/apt/apt.conf.d/50command-not-found{.disabled,}

おすすめ記事