{"record":{"id":"6b0c6bd641a012db","repo":"apache/hadoop","slug":"history-server-failed-to-login","errorCode":null,"errorMessage":"History Server Failed to login","messagePattern":"History Server Failed to login","errorType":"exception","errorClass":"YarnRuntimeException","httpStatus":null,"severity":"critical","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java","lineNumber":127,"sourceCode":"      }\n      super.serviceStop();\n    }\n  }\n\n  public JobHistoryServer() {\n    super(JobHistoryServer.class.getName());\n  }\n\n  @Override\n  protected void serviceInit(Configuration conf) throws Exception {\n    Configuration config = new YarnConfiguration(conf);\n\n    // This is required for WebApps to use https if enabled.\n    MRWebAppUtil.initialize(getConfig());\n    try {\n      doSecureLogin(conf);\n    } catch(IOException ie) {\n      throw new YarnRuntimeException(\"History Server Failed to login\", ie);\n    }\n    jobHistoryService = new JobHistory();\n    stateStore = createStateStore(conf);\n    this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore);\n    clientService = createHistoryClientService();\n    aggLogDelService = new AggregatedLogDeletionService();\n    hsAdminServer = new HSAdminServer(aggLogDelService, jobHistoryService);\n    addService(stateStore);\n    addService(new HistoryServerSecretManagerService());\n    addService(jobHistoryService);\n    addService(clientService);\n    addService(aggLogDelService);\n    addService(hsAdminServer);\n\n    DefaultMetricsSystem.initialize(\"JobHistoryServer\");\n    JvmMetrics jm = JvmMetrics.initSingleton(\"JobHistoryServer\", null);\n    pauseMonitor = new JvmPauseMonitor();\n    addService(pauseMonitor);","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java#L109-L145","documentation":"JobHistoryServer.serviceInit performs the security login (doSecureLogin) based on hadoop.security.authentication and the JHS principal/keytab properties. Any IOException from the login is wrapped in YarnRuntimeException 'History Server Failed to login' and aborts startup with the cause preserved. Typical roots are Kerberos misconfiguration, a missing or unreadable keytab, a mismatched principal, or KDC/clock problems.","triggerScenarios":"hadoop.security.authentication=kerberos with mapreduce.jobhistory.keytab missing or unreadable; mapreduce.jobhistory.principal not matching the keytab principal; KDC unreachable; clock skew beyond Kerberos tolerance.","commonSituations":"Keytab not deployed or rotated without updating the path; principal format wrong or _HOST resolving incorrectly; hostname/DNS mismatch; KDC outage at restart time.","solutions":["Verify the keytab exists and is readable by the JHS user; validate manually with kinit -kt <keytab> <principal>.","Check mapreduce.jobhistory.principal uses the correct primary and that _HOST resolves to the actual host.","Confirm the KDC is reachable and system clocks are synchronized.","Fix the configuration, redeploy the keytab, and restart JHS."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# validate the login before starting JHS\nkinit -kt /etc/security/keytab/jhs.service.keytab jhs/_HOST@EXAMPLE.COM \\\n  || echo 'keytab/principal invalid — fix before start'\nklist -k /etc/security/keytab/jhs.service.keytab | head","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify keytab presence, ownership, and readability in deployment checks.","Keep principal format and _HOST resolution consistent with the keytab.","Synchronize clocks and confirm KDC reachability before JHS restarts."],"tags":["mapreduce","job-history-server","kerberos","security","startup"],"backgroundTag":"kerberos-login-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}