Python-related errors when running apt update after adding and removing Bodhi repository












0















Error when running update:





thufir@bot:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease [83.2 kB]
Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 166 kB in 1s (138 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

Original exception was:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Reading package lists... Done
W: Problem unlinking the file auxfiles - Clean (21: Is a directory)
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
thufir@bot:~$


There's a possibility this error was introduced by attempting to add repos for bodhi. The sources.list file:



thufir@bot:~$ cat /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

#deb [trusted=yes] http://packages.bodhilinux.com/bodhi xenial b4main
thufir@bot:~$


Note that bodhi, the last line, is commented out. The OS:



thufir@bot:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


The apt version:



thufir@bot:~$ apt-cache policy apt
apt:
Installed: 2.2.12~bodhi2
Candidate: 2.2.12~bodhi2
Version table:
*** 2.2.12~bodhi2 100
100 /var/lib/dpkg/status
1.6.1 500
500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages


Perhaps the problem is a failed update?










share|improve this question




















  • 1





    A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

    – Videonauth
    May 28 '18 at 10:05






  • 1





    The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

    – Videonauth
    May 28 '18 at 10:09








  • 2





    I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

    – Videonauth
    May 28 '18 at 10:14








  • 1





    You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

    – Videonauth
    May 28 '18 at 10:45






  • 1





    Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

    – Videonauth
    May 30 '18 at 10:38
















0















Error when running update:





thufir@bot:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease [83.2 kB]
Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 166 kB in 1s (138 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

Original exception was:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Reading package lists... Done
W: Problem unlinking the file auxfiles - Clean (21: Is a directory)
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
thufir@bot:~$


There's a possibility this error was introduced by attempting to add repos for bodhi. The sources.list file:



thufir@bot:~$ cat /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

#deb [trusted=yes] http://packages.bodhilinux.com/bodhi xenial b4main
thufir@bot:~$


Note that bodhi, the last line, is commented out. The OS:



thufir@bot:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


The apt version:



thufir@bot:~$ apt-cache policy apt
apt:
Installed: 2.2.12~bodhi2
Candidate: 2.2.12~bodhi2
Version table:
*** 2.2.12~bodhi2 100
100 /var/lib/dpkg/status
1.6.1 500
500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages


Perhaps the problem is a failed update?










share|improve this question




















  • 1





    A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

    – Videonauth
    May 28 '18 at 10:05






  • 1





    The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

    – Videonauth
    May 28 '18 at 10:09








  • 2





    I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

    – Videonauth
    May 28 '18 at 10:14








  • 1





    You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

    – Videonauth
    May 28 '18 at 10:45






  • 1





    Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

    – Videonauth
    May 30 '18 at 10:38














0












0








0








Error when running update:





thufir@bot:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease [83.2 kB]
Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 166 kB in 1s (138 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

Original exception was:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Reading package lists... Done
W: Problem unlinking the file auxfiles - Clean (21: Is a directory)
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
thufir@bot:~$


There's a possibility this error was introduced by attempting to add repos for bodhi. The sources.list file:



thufir@bot:~$ cat /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

#deb [trusted=yes] http://packages.bodhilinux.com/bodhi xenial b4main
thufir@bot:~$


Note that bodhi, the last line, is commented out. The OS:



thufir@bot:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


The apt version:



thufir@bot:~$ apt-cache policy apt
apt:
Installed: 2.2.12~bodhi2
Candidate: 2.2.12~bodhi2
Version table:
*** 2.2.12~bodhi2 100
100 /var/lib/dpkg/status
1.6.1 500
500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages


Perhaps the problem is a failed update?










share|improve this question
















Error when running update:





thufir@bot:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease [83.2 kB]
Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 166 kB in 1s (138 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference

Original exception was:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: symbol _ZN13debListParser12ParseDependsEPKcS1_RNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_RjRKbSB_SB_RKS7_ version APTPKG_5.0 not defined in file libapt-pkg.so.5.0 with link time reference
Reading package lists... Done
W: Problem unlinking the file auxfiles - Clean (21: Is a directory)
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
thufir@bot:~$


There's a possibility this error was introduced by attempting to add repos for bodhi. The sources.list file:



thufir@bot:~$ cat /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

#deb [trusted=yes] http://packages.bodhilinux.com/bodhi xenial b4main
thufir@bot:~$


Note that bodhi, the last line, is commented out. The OS:



thufir@bot:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


The apt version:



thufir@bot:~$ apt-cache policy apt
apt:
Installed: 2.2.12~bodhi2
Candidate: 2.2.12~bodhi2
Version table:
*** 2.2.12~bodhi2 100
100 /var/lib/dpkg/status
1.6.1 500
500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages


Perhaps the problem is a failed update?







apt package-management python ppa system






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 28 '18 at 12:41









Zanna

51.1k13138242




51.1k13138242










asked May 28 '18 at 9:59









ThufirThufir

1,6151044102




1,6151044102








  • 1





    A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

    – Videonauth
    May 28 '18 at 10:05






  • 1





    The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

    – Videonauth
    May 28 '18 at 10:09








  • 2





    I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

    – Videonauth
    May 28 '18 at 10:14








  • 1





    You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

    – Videonauth
    May 28 '18 at 10:45






  • 1





    Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

    – Videonauth
    May 30 '18 at 10:38














  • 1





    A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

    – Videonauth
    May 28 '18 at 10:05






  • 1





    The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

    – Videonauth
    May 28 '18 at 10:09








  • 2





    I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

    – Videonauth
    May 28 '18 at 10:14








  • 1





    You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

    – Videonauth
    May 28 '18 at 10:45






  • 1





    Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

    – Videonauth
    May 30 '18 at 10:38








1




1





A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

– Videonauth
May 28 '18 at 10:05





A commented out line in source.list file is for sure not the reason this happens. Can you please check the version of apt you have installed with apt-cache policy apt.

– Videonauth
May 28 '18 at 10:05




1




1





The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

– Videonauth
May 28 '18 at 10:09







The problem is you bhodi tries have replaced the systems apt package which seems not compatible. Actual version of apt is from bionic-main with version number 1.6.1.

– Videonauth
May 28 '18 at 10:09






2




2





I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

– Videonauth
May 28 '18 at 10:14







I would try to download the package manually from packages.ubuntu.com/bionic/apt and then using dpkg to install it, if needed with force. You need to get this back working before attempting a fix on the rest. You might want to check if the aptitude package got overwritten/replaced too.

– Videonauth
May 28 '18 at 10:14






1




1





You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

– Videonauth
May 28 '18 at 10:45





You can as well check /var/log/apt/history.log which other packages got replaced by your attempt, but for fixing those a working apt package would be good to have.

– Videonauth
May 28 '18 at 10:45




1




1





Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

– Videonauth
May 30 '18 at 10:38





Another option to find the packages which have changed is if the bodhi team sticks to the naming using dpkg -l | grep bodhi

– Videonauth
May 30 '18 at 10:38










1 Answer
1






active

oldest

votes


















1














It looks like you installed some third-party version of the apt package but kept the accompanying and apparently incompatible libapt-pkg5.0 package as it was from Canonical's repositories.



Normally you can force packages to their most recent version available for the current Ubuntu release with:





sudo apt install {PACKAGE_NAME,...}/$(lsb_release -sc)


However in this case Apt itself is affected and broken so you need to:





  1. Download the packages manually from the package repository (apt, libapt-pkg5.0).




    1. Make sure that the package's page is for your Ubuntu release (look near the top),

    2. Scroll to the download section at the bottom of each package's page,

    3. click the link for your architecture,

    4. select a suitable download mirror and

    5. store the package files in a location that you can remember for the next step, e. g. /tmp.




  2. Install the downloaded Deb packages with dpkg:



    cd /tmp
    sudo dpkg -i {apt,libapt-pkg5.0}_*.deb



  3. Update your packages to verify that Apt works and make sure that you have the most recent version:



    sudo apt update
    sudo apt upgrade







share|improve this answer


























  • how or why did apt itself break?

    – Thufir
    May 31 '18 at 16:23











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1041151%2fpython-related-errors-when-running-apt-update-after-adding-and-removing-bodhi-re%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














It looks like you installed some third-party version of the apt package but kept the accompanying and apparently incompatible libapt-pkg5.0 package as it was from Canonical's repositories.



Normally you can force packages to their most recent version available for the current Ubuntu release with:





sudo apt install {PACKAGE_NAME,...}/$(lsb_release -sc)


However in this case Apt itself is affected and broken so you need to:





  1. Download the packages manually from the package repository (apt, libapt-pkg5.0).




    1. Make sure that the package's page is for your Ubuntu release (look near the top),

    2. Scroll to the download section at the bottom of each package's page,

    3. click the link for your architecture,

    4. select a suitable download mirror and

    5. store the package files in a location that you can remember for the next step, e. g. /tmp.




  2. Install the downloaded Deb packages with dpkg:



    cd /tmp
    sudo dpkg -i {apt,libapt-pkg5.0}_*.deb



  3. Update your packages to verify that Apt works and make sure that you have the most recent version:



    sudo apt update
    sudo apt upgrade







share|improve this answer


























  • how or why did apt itself break?

    – Thufir
    May 31 '18 at 16:23
















1














It looks like you installed some third-party version of the apt package but kept the accompanying and apparently incompatible libapt-pkg5.0 package as it was from Canonical's repositories.



Normally you can force packages to their most recent version available for the current Ubuntu release with:





sudo apt install {PACKAGE_NAME,...}/$(lsb_release -sc)


However in this case Apt itself is affected and broken so you need to:





  1. Download the packages manually from the package repository (apt, libapt-pkg5.0).




    1. Make sure that the package's page is for your Ubuntu release (look near the top),

    2. Scroll to the download section at the bottom of each package's page,

    3. click the link for your architecture,

    4. select a suitable download mirror and

    5. store the package files in a location that you can remember for the next step, e. g. /tmp.




  2. Install the downloaded Deb packages with dpkg:



    cd /tmp
    sudo dpkg -i {apt,libapt-pkg5.0}_*.deb



  3. Update your packages to verify that Apt works and make sure that you have the most recent version:



    sudo apt update
    sudo apt upgrade







share|improve this answer


























  • how or why did apt itself break?

    – Thufir
    May 31 '18 at 16:23














1












1








1







It looks like you installed some third-party version of the apt package but kept the accompanying and apparently incompatible libapt-pkg5.0 package as it was from Canonical's repositories.



Normally you can force packages to their most recent version available for the current Ubuntu release with:





sudo apt install {PACKAGE_NAME,...}/$(lsb_release -sc)


However in this case Apt itself is affected and broken so you need to:





  1. Download the packages manually from the package repository (apt, libapt-pkg5.0).




    1. Make sure that the package's page is for your Ubuntu release (look near the top),

    2. Scroll to the download section at the bottom of each package's page,

    3. click the link for your architecture,

    4. select a suitable download mirror and

    5. store the package files in a location that you can remember for the next step, e. g. /tmp.




  2. Install the downloaded Deb packages with dpkg:



    cd /tmp
    sudo dpkg -i {apt,libapt-pkg5.0}_*.deb



  3. Update your packages to verify that Apt works and make sure that you have the most recent version:



    sudo apt update
    sudo apt upgrade







share|improve this answer















It looks like you installed some third-party version of the apt package but kept the accompanying and apparently incompatible libapt-pkg5.0 package as it was from Canonical's repositories.



Normally you can force packages to their most recent version available for the current Ubuntu release with:





sudo apt install {PACKAGE_NAME,...}/$(lsb_release -sc)


However in this case Apt itself is affected and broken so you need to:





  1. Download the packages manually from the package repository (apt, libapt-pkg5.0).




    1. Make sure that the package's page is for your Ubuntu release (look near the top),

    2. Scroll to the download section at the bottom of each package's page,

    3. click the link for your architecture,

    4. select a suitable download mirror and

    5. store the package files in a location that you can remember for the next step, e. g. /tmp.




  2. Install the downloaded Deb packages with dpkg:



    cd /tmp
    sudo dpkg -i {apt,libapt-pkg5.0}_*.deb



  3. Update your packages to verify that Apt works and make sure that you have the most recent version:



    sudo apt update
    sudo apt upgrade








share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 2 '18 at 19:51

























answered May 31 '18 at 10:11









David FoersterDavid Foerster

28.5k1367113




28.5k1367113













  • how or why did apt itself break?

    – Thufir
    May 31 '18 at 16:23



















  • how or why did apt itself break?

    – Thufir
    May 31 '18 at 16:23

















how or why did apt itself break?

– Thufir
May 31 '18 at 16:23





how or why did apt itself break?

– Thufir
May 31 '18 at 16:23


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1041151%2fpython-related-errors-when-running-apt-update-after-adding-and-removing-bodhi-re%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕