package 'python3-apt' in incoherent state on Ubuntu 18.04

一世执手 提交于 2020-04-18 05:38:36

问题


Few days ago, I got a no-entry sign on my Ubuntu desktop related to updates.

I checked there is probably something to be done about my Java8 ppa though that is not what is preventing gnome-console to start. Also I recently installed some packages that seemed unrelated to the issue.

So I started an Ubuntu-forum thread

Apparently python3-apt is at the art of the problem but I didn't manage a reinstall. I'm considering getting it using wget and do a manual install if allowed (mentionned in my latest answers).

Les paquets suivants sont dans un état incohérent à cause de sérieux problèmes survenus lors de l'installation. Ils doivent être réinstallés (ainsi que tous les paquets qui en dépendent) pour pouvoir fonctionner correctement : python3-apt Python 3 interface to libapt-pkg

The above error asked me to reinstall the following (as well as all depending packages) :

python3-apt Python 3 interface to libapt-pkg

Problem was with update cmd:

sudo apt update

outputs:

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

And now, trying reinstalling python3-apt via sudo apt install --reinstall -y python3-apt returns :

dpkg : error while cleaning up: installed python3-apt package post-installation script subprocess returned error exit status 127 Des erreurs ont été rencontrées pendant l'exécution : /var/cache/apt/archives/python3-apt_1.6.5ubuntu0.2_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

Excuse me for the French explanations but the end is written in English.

I'm looking for how to reinstall properly, maybe I pointed the solution but have yet to figure out proper commands and maybe exploring libapt-pkg state as well. Also as above mentionned, it was a problem at update time before terminal crashed not to restart anymore.

Thanks for your contributions.


回答1:


I'm posting general solution as available in details within the ubuntu-forum post mentioned.

Fix to python3-apt was possible once I reinstalled python3-minimal downloading in a temp folder so I got a fresh install from ubuntu repositories:

Make sure you get the desired package according to your system requirements with YOUR_ACTUAL_PACKAGE_VERSION looking for your own necessary deb:

sudo apt clean && wget -c http://security.ubuntu.com/ubuntu/pool/main/p/python-apt/python3-apt_YOUR_ACTUAL_PACKAGE_VERSION.deb

sudo dpkg -i --force-all python3-apt_apt_YOUR_ACTUAL_PACKAGE_VERSION.deb

sudo apt install -fy
sudo apt update && sudo apt full-upgrade

(these steps can be found from page 3) sudo apt install -fy

sudo apt update && sudo apt full-upgrade



来源:https://stackoverflow.com/questions/60994905/package-python3-apt-in-incoherent-state-on-ubuntu-18-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!