Platform9 Generic
Latest
Frequently Asked Questions
How To
Solution
Internal Only
Templates
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
pf9-hostagent Failing With Error "No module named 'apt_pkg'"
Copy Markdown
Open in ChatGPT
Open in Claude
Problem
The host is disconnected from Management Plane and pf9-hostagent service is failing and hostagent-daemon.log shows error No module named 'apt_pkg'
hostagent-daemon.log
x
customlogger.py INFO - from pf9app.pf9_app_db import Pf9AppDb as AppDb, Pf9AgentDbcustomlogger.py INFO - File "/opt/pf9/hostagent/lib/python3.9/site-packages/pf9app/pf9_app_db.py", line 21, in <module> customlogger.py INFO - import aptcustomlogger.py INFO - File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> customlogger.py INFO - import apt_pkgcustomlogger.py INFO - ModuleNotFoundErrorcustomlogger.py INFO - :customlogger.py INFO - No module named 'apt_pkg'Environment
- pf9-hostagent
- Python3
Cause
When a newer python version is installed the link will update to point to
the newest python version, which leads to the error of apt_pkg module
not being found.
Resolution
- Make sure package
python3-aptis installed on the host. - Fix the python symblink:
command
xxxxxxxxxx# cd /usr/lib/python3/dist-packages# ln -s apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.so# ln -s apt_inst.cpython-35m-x86_64-linux-gnu.so apt_inst.so- Restart
pf9-hostagentservice:
command
xxxxxxxxxx# systemctl restart pf9-hostagentVariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
Last updated on
Was this page helpful?
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message