{"record":{"id":"7fe71827e1f0eebd","repo":"apache/hadoop","slug":"cannot-access-checkpoint-directory","errorCode":null,"errorMessage":"cannot access checkpoint directory.","messagePattern":"cannot access checkpoint directory\\.","errorType":"exception","errorClass":"InconsistentFSStateException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java","lineNumber":988,"sourceCode":"     * @throws IOException\n     */\n    void recoverCreate(boolean format) throws IOException {\n      storage.attemptRestoreRemovedStorage();\n      storage.unlockAll();\n\n      for (Iterator<StorageDirectory> it = \n                   storage.dirIterator(); it.hasNext();) {\n        StorageDirectory sd = it.next();\n        boolean isAccessible = true;\n        try { // create directories if don't exist yet\n          if(!sd.getRoot().mkdirs()) {\n            // do nothing, directory is already created\n          }\n        } catch(SecurityException se) {\n          isAccessible = false;\n        }\n        if(!isAccessible)\n          throw new InconsistentFSStateException(sd.getRoot(),\n              \"cannot access checkpoint directory.\");\n        \n        if (format) {\n          // Don't confirm, since this is just the secondary namenode.\n          LOG.info(\"Formatting storage directory \" + sd);\n          sd.clearDirectory();\n        }\n        \n        StorageState curState;\n        try {\n          curState = sd.analyzeStorage(HdfsServerConstants.StartupOption.REGULAR, storage);\n          // sd is locked but not opened\n          switch(curState) {\n          case NON_EXISTENT:\n            // fail if any of the configured checkpoint dirs are inaccessible \n            throw new InconsistentFSStateException(sd.getRoot(),\n                  \"checkpoint directory does not exist or is not accessible.\");\n          case NOT_FORMATTED:","sourceCodeStart":970,"sourceCodeEnd":1006,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java#L970-L1006","documentation":"SecondaryNameNode throws InconsistentFSStateException during checkpoint-storage setup when sd.getRoot().mkdirs() raises a SecurityException for a configured checkpoint directory. It means the 2NN process is not permitted to create or touch the directory configured under dfs.namenode.checkpoint.dir, so startup aborts before any checkpoint can run.","triggerScenarios":"Constructing/starting SecondaryNameNode: its storage loop calls sd.getRoot().mkdirs() on each checkpoint dir; if a SecurityManager policy (or sandboxed JVM) denies filesystem access to that path, isAccessible becomes false and this exception is thrown. Note that mkdirs() merely returning false is ignored here; only the throwing SecurityException path triggers it.","commonSituations":"Running the 2NN under a different user than the one owning the checkpoint directories while a Java security policy is in effect; a restrictive policy file granting no FilePermission write on the checkpoint path; checkpoint dir on a protected/ACL-restricted mount after a user or policy change.","solutions":["Grant the 2NN process write access to every dfs.namenode.checkpoint.dir path (chown/chmod the directories to the user running the SecondaryNameNode)","Verify the configured path is correct in hdfs-site.xml and points to a location the process may create","If a SecurityManager policy file is in use, add grant FilePermission \"<checkpoint.dir>/*\", \"write,delete\" (and read) for the 2NN principal","Restart the SecondaryNameNode and confirm it reaches the 'Secondary NameNode is up' log line"],"exampleFix":"# before: checkpoint dir owned by another user, policy denies write\nls -ld /data/2nn/checkpoint   # drwxr-x--- hdfs hdfs\n# after\nchown -R hdfs2nn:hadoop /data/2nn/checkpoint\nchmod 755 /data/2nn/checkpoint","handlingStrategy":"validation","validationCode":"// before starting the SecondaryNameNode\nString dir = conf.get(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_DIR_KEY,\n    DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_DIR_DEFAULT);\nFile f = new File(dir);\nif (!f.exists() && !f.mkdirs()) {\n  throw new IOException(\"Checkpoint dir not creatable: \" + dir\n      + \" — fix permissions/ownership first\");\n}\ntry (FileOutputStream probe = new FileOutputStream(new File(f, \".rw_probe\"), true)) {\n  // write access confirmed\n} catch (SecurityException | IOException e) {\n  throw new IOException(\"No write access to checkpoint dir \" + dir, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  secondary = new SecondaryNameNode(conf);\n} catch (InconsistentFSStateException e) {\n  // e.g. cannot access checkpoint directory — report sd root from the message\n  LOG.error(\"2NN storage inaccessible: {}\", e.getMessage());\n  // do not retry in a loop; fix filesystem permissions first\n}","preventionTips":["Provision checkpoint directories with the 2NN user as owner in your host bootstrap (Ansible/Puppet), not at runtime","Alert on 2NN startup failure so permission drift on checkpoint dirs is caught immediately","Keep Java security policies, when used, in the same config management as the checkpoint paths"],"tags":["hdfs","secondary-namenode","checkpoint","permissions","security-manager","startup"],"backgroundTag":"permission-denied","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}