Cleanup Alternatives
Luke Hebert
- 2 minutes read - 291 wordsCloudera Manager’s agent relies on the Linux alternatives framework to register service binaries and configuration paths. When that framework gets into a bad state, the agent can fail to update or start services, and the usual fix is to purge the stale alternatives entries and let the agent rebuild them from scratch.
Symptoms
You may notice the agent stuck in a restart loop, services failing to start after a Cloudera Manager action, or log entries referencing missing or conflicting alternative links under /etc/alternatives/.
Procedure
Identify the affected alternatives. List the entries that point into the Cloudera install tree:
ls -l /etc/alternatives | grep "/opt/cloudera"Stop the agent so it does not fight the cleanup:
service cloudera-scm-agent stopRemove the stale alternatives. This loop checks for a matching record in
/var/lib/alternatives/, removes it if present, and then deletes the symlink in/etc/alternatives/:ls -l /etc/alternatives/ | grep "/opt/cloudera" | awk '{print $9}' | while read m; do if [[ -e /var/lib/alternatives/${m} ]]; then echo "Removing ${m}" rm -fv /var/lib/alternatives/${m} fi rm -fv /etc/alternatives/${m} doneRestart the agent. On the next cycle the agent will re-register all of its service alternatives cleanly:
service cloudera-scm-agent start
Verifying the Fix
After the agent restarts, confirm the alternatives are back in place:
ls -l /etc/alternatives | grep "/opt/cloudera"You should see the expected symlinks (for example cloudera-scm-agent, cloudera-scm-agent.service, and any service-specific entries) pointing into /opt/cloudera/. If the list looks correct and the agent reports a healthy status in the Cloudera Manager UI, the issue is resolved.
This procedure is safe to run on a single node. If you manage a cluster, repeat it on each host where the agent is misbehaving. There is no need to restart Cloudera Manager itself.