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'

hostagent-daemon.log
Copy

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-apt is installed on the host.
  • Fix the python symblink:
command
Copy
  • Restart pf9-hostagent service:
command
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard