Restore fails with FileNotFoundException - Permission denied
Problem
Restore can't be executed after running the following command:
$ java -Dbitbucket.home="<path/to/new_bitbucket_home>" -Djdbc.override="false" -jar <path/to/backup/client>/bitbucket-restore-client.jar <path/to/backup/file>/bitbucket-20140107-024714-807.tar
The following appears in the <path/to/backup/client>/log/atlassian-sbc-YYYY-MM-DD-HHMM.log:
18:14:27,759 |-ERROR in ch.qos.logback.core.FileAppender[log] - openFile(/home/bitbucket_admin/log/atlassian-sbc-2014-01-08-1814.log,true) call failed. java.io.FileNotFoundException: /home/bitbucket_admin/log/atlassian-sbc-2014-01-08-1814.log (Permission denied)
at java.io.FileNotFoundException: /home/bitbucket_admin/log/atlassian-sbc-2014-01-08-1814.log (Permission denied)
at at java.io.FileOutputStream.openAppend(Native Method)
at at java.io.FileOutputStream.<init>(FileOutputStream.java:210)
at at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:28)
at at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:149)
at at ch.qos.logback.core.FileAppender.start(FileAppender.java:108)
at at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at at org.slf4j.LoggerFactory$getLogger.call(Unknown Source)
at at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at at com.atlassian.bitbucket.internal.backup.client.RestoreMain.<clinit>(RestoreMain.groovy:23)
Cause
Please review the permissions of the directory indicated in the exception thrown. In that case, the user executing the restore didn't have write permission to the <path/to/backup/client>/log
directory.
Resolution
Fix the permission of the referred directory and re-run the restore.
For more details on the restore procedure, please refer to the 2023-10-24_01-30-41_Bitbucket Server Backup Client document.