Wednesday, June 26, 2013

Hadoop - Error: /usr/bin/hadoop exec: /usr/lib/hadoop/bin/hadoop: not found

If you see this error while try to run a hadoop example jar file from command line:

$ hadoop jar /opt/cloudera/parcels/CDH-4.3.0-1.cdh4.3.0.p0.22/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar

/usr/bin/hadoop: line 39: /usr/lib/hadoop/bin/hadoop: No such file or directory

Double check the Hadoop environment variable "LIB_DIR" in /usr/bin/hadoop script.

I am using CM to manage my Hadoop cluster, so the way I fix it is by defining "LIB_DIR=/opt/cloudera/parcels/CDH-4.3.0-1.cdh4.3.0.p0.22/lib" in /usr/bin/hadoop. This is where Hadoop keeps libraries for all packages.

Another way of fixing is more elegant, you can link /usr/bin/hadoop to /etc/alternatives/hadoop,
$ rm -rf /usr/bin/hadoop
$ ln -s /etc/alternatives/hadoop /usr/bin/hadoop

This should fix the issue as well, and you don't have the LIB_DIR hardcoded, so next time when you update your CDH package, you don't need to come back and edit it again.



No comments: