hadoop java.io.IOException: while running namenode -format

alex picture alex · Jul 3, 2012 · Viewed 23.5k times · Source

I ran namenode -format.This is my output. I tried changing the file permissions chmod 777 hadoop.

I believe this line is the error ERROR namenode.NameNode: java.io.IOException: Cannot create directory /your/path/to/hadoop/tmp/dir/hadoop-hadoop/dfs/name/current

adoop@alexander-desktop:/usr/local/hadoop/bin$ ./hadoop namenode -format
12/07/03 17:03:56 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = alexander-desktop/127.0.1.1
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 0.20.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010
************************************************************/
12/07/03 17:03:56 INFO namenode.FSNamesystem: fsOwner=hadoop,hadoop
12/07/03 17:03:56 INFO namenode.FSNamesystem: supergroup=supergroup
12/07/03 17:03:56 INFO namenode.FSNamesystem: isPermissionEnabled=true
12/07/03 17:03:56 ERROR namenode.NameNode: java.io.IOException: Cannot create directory /your/path/to/hadoop/tmp/dir/hadoop-hadoop/dfs/name/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:295)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1086)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1110)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:856)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:948)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:965)

12/07/03 17:03:56 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at alexander-desktop/127.0.1.1


hadoop@alexander-desktop:/usr/local$ sudo hadoop/bin/hadoop namenode -format
sudo: /etc/sudoers is mode 0777, should be 0440
sudo: no valid sudoers sources found, quitting

Answer

ali haider picture ali haider · Jul 3, 2012

try with sudo (I realize you changed permissions) but I would still try sudo and check if that resolves the problem.