LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-27-2019, 10:35 AM   #1
24jedi
Member
 
Registered: Jul 2003
Location: Richmond, VA
Distribution: LinuxLite
Posts: 77

Rep: Reputation: 15
Errors trying to run apt-get update


Errors trying to run apt-get update

Description: Linux Lite 4.2
Release: 18.04
Codename: bionic
Kernel 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Hit:1 http://packages.microsoft.com/repos/vscode stable InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://archive.canonical.com/ubuntu bionic InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:7 http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/teejee2008/ppa/ubuntu bionic InRelease
Hit:9 http://repo.linuxliteos.com/linuxlite diamond InRelease
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
ModuleNotFoundError: No module named 'apt_pkg'
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
ModuleNotFoundError: No module named 'apt_pkg'

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
ModuleNotFoundError: No module named 'apt_pkg'
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
 
Old 11-27-2019, 11:51 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,902

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
that is quite interesting. The apt_pkg module can be found in the package python3-apt, so you need to [re]install it somehow.
If there was no other way you need to download the package and install it with dpkg.
probably from here: http://us.archive.ubuntu.com/ubuntu/.../p/python-apt/

Last edited by pan64; 11-27-2019 at 11:57 AM.
 
Old 11-29-2019, 03:26 PM   #3
24jedi
Member
 
Registered: Jul 2003
Location: Richmond, VA
Distribution: LinuxLite
Posts: 77

Original Poster
Rep: Reputation: 15
I believe you assessment about python3-apt being a little buggered.

Tried to update, install & reinstall python3-apt
Tried to update apt-get

sudo apt-get install python-apt
sudo apt-get update
sudo apt-get install python3-apt --reinstall
sudo apt-get update
sudo apt autoremove

Ultimately came across a similar thread, with similar issue
advice given:

cd /usr/lib/python3/dist-packages
ls -la /usr/lib/python3/dist-packages
sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so

These all work now.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install

Thanks for the assistance.
 
Old 11-30-2019, 03:10 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,902

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
glad to head that. If you think your problem is solved please mark the thread solved.
 
  


Reply

Tags
apt-get update



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sudo apt update and sudo apt-get update giving error cryptonic472 Linux - Software 7 08-24-2019 08:16 AM
Not able to run this command "sudo apt-get install libdevil-dev" even after trying "apt-get -f install" getting below error message srihariu1 Linux - Embedded & Single-board computer 2 04-26-2018 06:33 AM
When I run apt-update, I get a /var/lib/apt/partial error kb2tfa Debian 1 10-24-2017 02:43 PM
apt-get update errors since Debian released ( bad /etc/apt/sources.list ?) forgox Debian 10 06-13-2005 12:28 PM
Does 'apt-get update' update the database used by 'apt-cache'? davidas Debian 5 04-20-2004 01:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration