pf9-hostagent Failing With Error "No module named 'apt_pkg'"
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'
customlogger.py INFO - from pf9app.pf9_app_db import Pf9AppDb as AppDb, Pf9AgentDb
customlogger.py INFO - File "/opt/pf9/hostagent/lib/python3.9/site-packages/pf9app/pf9_app_db.py", line 21, in <module>
customlogger.py INFO - import apt
customlogger.py INFO - File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
customlogger.py INFO - import apt_pkg
customlogger.py INFO - ModuleNotFoundError
customlogger.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:
Restart
pf9-hostagentservice:
PreviousHow To Identify If Underlying Disk is HDD or SSD?
NextPlatform9 Services In Failed State Due To "Too many open files" Error
Last updated
