Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Ambari Agent Start Failed

avatar
New Member

Environmennt: CentOS7

I manually installed the ambari-agent older version (2.2.2.0) and found out it's the wrong version I needed. Then I ran yum to remove it. I updated the repo so I now downloaded and installed the correct version 2.4.0.1.

However, when I ran "ambari-agent start", it showed the following error:

Verifying Python version compatibility...
Using python  /usr/bin/pythonChecking for previously running Ambari Agent...
Starting ambari-agentVerifying ambari-agent process status...
ERROR: ambari-agent start failed. For more details, see /var/log/ambari-agent/ambari-agent.out:
====================
Traceback (most recent call last):  
   File "/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent.py", line 24, in <module>  from Controller import AGENT_AUTO_RESTART_EXIT_CODE  
   File "/usr/lib/python2.6/site-packages/ambari_agent/Controller.py", line 41, in <module>  from ambari_agent.ActionQueue import ActionQueue  
   File "/usr/lib/python2.6/site-packages/ambari_agent/ActionQueue.py", line 37, in <module>  from ambari_commons.str_utils import split_on_chunks
ImportError: cannot import name split_on_chunks
====================

The /var/log/ambari-agent/ambari-agent.out shows the same error above.

Seems that I can't cleanly remove the dependencies that installed with the previous version. Even when I tried ambari-agent reset, the same error happened and said "ImportError: cannot import name split on chunks".

How to resolve this problem?

Many thanks!

1 ACCEPTED SOLUTION

avatar
New Member

I did one more thing to

rm -rf /usr/lib/python2.6/site-packages

yum remove ambari-agent
yum install ambari-agent -y 

It worked. The ambari-agent start completed successfully.

View solution in original post

7 REPLIES 7

avatar
Master Mentor

@William Li do the following, review the errors in /var/log/ambari-agent then if nothing is obvious go with next steps below

yum erase ambari-agent

rm -rf /var/lib/ambari-agent
rm -rf /var/log/ambari-agent
rm -rf /usr/lib/python2.6/site-packages/ambari_agent
yum install -y ambari-agent

there may be other residual directories to remove but once you clean all, reinstall and try again.

avatar
New Member

Thanks a lot Artem for the quick response. Tried your steps and still has the exact error above. However, this time it has one extract line of error message:

  File "/usr/lib/python2.6/site-packages/ambari_agent/HeartbeatHandlers.py", line 21, in <module>
    from ambari_commons.exceptions import FatalException 

ImportError: No module named ambari_commons.exceptions

Checked the logs and there are nothing else other than this above error.

avatar
New Member

Please see my comment below to remove the entire site-packages. After that, it worked!

avatar
New Member

I did one more thing to

rm -rf /usr/lib/python2.6/site-packages

yum remove ambari-agent
yum install ambari-agent -y 

It worked. The ambari-agent start completed successfully.

avatar
Master Mentor

Great job!

avatar

You should not do "rm -rf /usr/lib/python2.6/site-packages" as this affects to other python scripts, such as "yum"

This issue would be caused if you install ambari-server or /usr/lib/python2.6/site-packages/ambari_commons/str_utils.py is not a right one.

Please make sure "/usr/lib/python2.6/site-packages/ambari_commons" is a symlink to /usr/lib/ambari-agent/lib/ambari_commons

avatar
New Member

I had same problem on other than master nodes, you have to update ambari-server on each node even if you are not running server on each one.