Offline Meta Sync Failed Command Not Found
Problem
You receive an error message "Update of Linux package meta files failed due to the 'apt_pkg' module not being found" while installing the patches or scanning the systems on your network computers using Patch Manager Plus.
Error Observed:
Command: sudo apt-get update
You may encounter an error similar to:
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 12, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
E: Problem executing scripts APT::Update::Post-Invoke-Success ...
E: Sub-process returned an error code
Cause
A mismatch between the Python version and APT's Python bindings, often caused by a corrupted or incomplete installation of APT Python package.
Resolution
- Check Installed Python Version
Run:python3 --version - Check if
apt_pkgis Present
Run:ls -la /usr/lib/python3/dist-packages/apt_pkg*
If no file is returned, or the file doesn’t match your Python version,apt_pkgis missing or incorrectly installed. - Try installing the python package properly.
- Then re-run the update command to see if the problem is fixed:
Run:sudo apt-get update
Further Assistance
If the issue still persists after performing the above steps, contact the respective Linux vendor (e.g., Ubuntu or Debian) for further assistance.