A backup could not be created. Reason: Some files and/or directories could not be read in Stash home.

Song Wang July 6, 2015

2015-06-25 22:01:20,941 INFO [main] c.a.s.i.b.client.spring.SpringMain Initializing
2015-06-25 22:01:26,112 INFO [main] c.a.s.i.b.client.RestStashService Using Stash 3.2.2
2015-06-25 22:01:27,190 INFO [main] c.a.s.i.b.client.DefaultBackupClient Contacting Stash
2015-06-25 22:01:27,472 INFO [main] c.a.s.i.b.client.RestStashService Stash has been locked for maintenance. It may be unlocked with token: bbeccf3a5af35676a28e27d3e49ebafa961a8c6d
2015-06-25 22:01:27,831 INFO [main] c.a.s.i.b.client.RestStashService Starting database backup on Stash. It may be cancelled with token: deca4d06762157978991dbe7c74ea56ea54cfa51
2015-06-25 22:01:30,300 INFO [main] c.a.s.i.b.c.layout.DefaultStashHome Verifying Stash home
2015-06-25 22:01:34,550 INFO [main] c.a.s.i.b.c.layout.DefaultStashHome Verifying Stash home
2015-06-25 22:01:37,503 INFO [main] c.a.s.i.b.client.RestStashService Cancelling database backup with code: deca4d06762157978991dbe7c74ea56ea54cfa51
2015-06-25 22:01:37,549 INFO [main] c.a.s.i.b.client.RestStashService Unlocking Stash using token: bbeccf3a5af35676a28e27d3e49ebafa961a8c6d
2015-06-25 22:01:37,581 ERROR [main] c.a.s.i.backup.client.BackupMain A backup could not be created. Reason: Some files and/or directories could not be read in Stash home. Please change their permissions to make them readable by the user running the backup client or exclude them from the backup using the stash.home.excludes property and retry. The following files and/or directories could not be read:
d:\stashdata\analytics-logs\cc8e090c15d2af87baa246d3718a6e16.atlassian-analytics.log.2015-06-20.1.gz
com.atlassian.stash.internal.backup.client.BackupException: Some files and/or directories could not be read in Stash home. Please change their permissions to make them readable by the user running the backup client or exclude them from the backup using the stash.home.excludes property and retry. The following files and/or directories could not be read:
d:\stashdata\analytics-logs\cc8e090c15d2af87baa246d3718a6e16.atlassian-analytics.log.2015-06-20.1.gz
at com.atlassian.stash.internal.backup.client.layout.DefaultStashHome.verifyCanRead(DefaultStashHome.groovy:143) ~[stash-backup-core-1.4.0.jar:na]
at com.atlassian.stash.internal.backup.client.layout.DefaultStashHome.archive(DefaultStashHome.groovy:66) ~[stash-backup-core-1.4.0.jar:na]
at com.atlassian.stash.internal.backup.client.DefaultBackupClient.archiveHome(DefaultBackupClient.groovy:67) ~[stash-backup-client.jar:1.4.0]
at com.atlassian.stash.internal.backup.client.FixedRateProgressPublisher.publishWhileExecuting(FixedRateProgressPublisher.groovy:34) ~[stash-backup-client.jar:1.4.0]
at com.atlassian.stash.internal.backup.client.RestStashService.backup(RestStashService.groovy:66) ~[stash-backup-client.jar:1.4.0]
at com.atlassian.stash.internal.backup.client.RestStashService.lock(RestStashService.groovy:174) ~[stash-backup-client.jar:1.4.0]
at com.atlassian.stash.internal.backup.client.DefaultBackupClient.backup(DefaultBackupClient.groovy:46) ~[stash-backup-client.jar:1.4.0]
at com.atlassian.stash.internal.backup.client.spring.SpringMain.run(SpringMain.groovy:28) [stash-backup-core-1.4.0.jar:na]
at com.atlassian.stash.internal.backup.client.spring.SpringMain.run(SpringMain.groovy) [stash-backup-core-1.4.0.jar:na]
at com.atlassian.stash.internal.backup.client.BackupMain.main(BackupMain.groovy:38) [stash-backup-client.jar:1.4.0]
... 114 frames suppressed

2 answers

1 accepted

3 votes
Answer accepted
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 25, 2018

For newer versions of Bitbucket Server (4.+), the correct way to exclude these files is to add one of the following option to the backup-config.properties file:

 

(Recommended) To ignore only the compressed log files in the analytics-logs folder:

bitbucket.home.excludes=analytics-logs/*.atlassian-analytics.log.*.gz

 

To ignore all files in the analytics-logs folder:

bitbucket.home.excludes=analytics-logs/**

 

Notes:

- stash has been replaced by bitbucket

- the most recent versions of the Backup Client exclude these files by default without the need of any additional exclusion rule

0 votes
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2015

The error mentioned that the user running the backup client could not read d:\stashdata\analytics-logs\cc8e090c15d2af87baa246d3718a6e16.atlassian-analytics.log.2015-06-20.1.gz. Could you verify the permissions on that file and make sure that it's readable?

Alternatively, we can tell the backup client to ignore this type of a file by adding the following parameter to backup-config.properties:

stash.home.excludes=analytics-logs/**

This will ignore all files in the d:\stashdata\analytics-logs directory or you can use the following to ignore only the compressed log files:

stash.home.excludes=analytics-logs/*.atlassian-analytics.log.*.gz
Song Wang July 6, 2015

When we check the permissions, the gz file is already gone. We don't know whether it has been there.

Got questions:

  1. Does Stash have any clean-up process on schedule that cleans the \analytics-logs\ folder?
  2. What are the gz files used for? Is it ok the backup ignore those files?

 

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2015

Yes, Stash will clean up the contents of analytics-logs on a periodic basis. These gz files are the compressed analytics logs that are sent to Atlassian based on the agreement and details at https://confluence.atlassian.com/display/STASH/Collecting+analytics+for+Stash Since these are just analytics logs, there is not harm in excluding them from the backup process. To help prevent this error in the future, you can also look into running the backup client as the same user that runs Stash. The analytics files should be owned by that user.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events