AccessDeniedException for ElasticSearch when search folder is on a separate partition

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Low
    • None
    • Affects Version/s: 5.1.0
    • Component/s: None
    • None
    • Severity 3 - Minor

      Summary

      Having the $BITBUCKET_HOME/shared/search folder as a mount point for a LV on Linux causes ElasticSearch to fail when started.

      Steps to Reproduce

      1. Install Bitbucket Server
      2. Stop Bitbucket Server
        /etc/init.d/atlbitbucket stop
        
      3. Mount a LV on $BITBUCKET_HOME/shared/search
      4. Start Bitbucket Server
        /etc/init.d/atlbitbucket start
        

      Expected Results

      Bitbucket is able to start properly.

      Actual Results

      Elastic search fails to start and the below exception is thrown in the service start output.

      root@jessie:/var/atlassian/application-data/bitbucket/shared# /etc/init.d/atlbitbucket start
      Starting Atlassian Bitbucket as dedicated user atlbitbucket
      
      Starting bundled Elasticsearch
      	Hint: Run start-bitbucket.sh --no-search to skip starting Elasticsearch
      Bundled Elasticsearch started successfully
      
      Bitbucket is being run with a umask that contains potentially unsafe settings.
      The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
       - Access is allowed to 'others'. It is recommended that 'others' be denied
         all access for security reasons.
      The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
      configured in _start-webapp.sh
      
      Starting Bitbucket webapp at http://localhost:7990
      The Bitbucket webapp has been started.
      
      If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
      https://confluence.atlassian.com/display/BitbucketServerKB/Troubleshooting+Installation
      root@jessie:/var/atlassian/application-data/bitbucket/shared# Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: AccessDeniedException[/var/atlassian/application-data/bitbucket/shared/search/lost+found];
      Likely root cause: java.nio.file.AccessDeniedException: /var/atlassian/application-data/bitbucket/shared/search/lost+found
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      	at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:427)
      	at java.nio.file.Files.newDirectoryStream(Files.java:457)
      	at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:300)
      	at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
      	at java.nio.file.Files.walkFileTree(Files.java:2706)
      	at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
      	at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
      	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:243)
      	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
      Refer to the log for complete error details.
      

      Workaround1

      Give read permissions to the lost+found folder to everyone by using the following command:

      chmod +x 744 $BITBUCKET_HOME/shared/search/lost+found/
      

      Workaround2

      Give read permissions to the lost+found folder only to the atlbitbucket user by using the following command:

      setfacl -m u:atlbitbucket:r $BITBUCKET_HOME/shared/search/lost+found/
      

            Assignee:
            Unassigned
            Reporter:
            Daniele Carcasole (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: