Backup plugin: unable to delete files in a Local Storage

Issue

  • My backup job is failing with a similar traces like the following in the Console Build logs:
....
Caused: java.io.IOException: Unable to delete /var/lock - files in dir: [/var/lock/subsys] 
at hudson.Util.tryOnceDeleteFile(Util.java:324) 
at hudson.Util.deleteFile(Util.java:274) 
Caused: java.io.IOException: Unable to delete '/var/lock'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts. 
at hudson.Util.deleteFile(Util.java:279) 
at com.infradna.hudson.plugins.backup.store.LocalFileStore$2.delete(LocalFileStore.java:145) 
at com.infradna.hudson.plugins.backup.retention.UpToNRetentionPolicy.scrub(UpToNRetentionPolicy.java:30) 
at com.infradna.hudson.plugins.backup.BackupBuilder.scrub(BackupBuilder.java:268) 
at com.infradna.hudson.plugins.backup.BackupBuilder.doPerform(BackupBuilder.java:251) 
at com.infradna.hudson.plugins.backup.BackupBuilder.perform(BackupBuilder.java:172) 
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) 
at hudson.model.Build$BuildExecution.build(Build.java:206) 
at hudson.model.Build$BuildExecution.doRun(Build.java:163) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) 
at hudson.model.Run.execute(Run.java:1810) 
at hudson.model.Build.run(Build.java:114) 
at hudson.model.ResourceController.execute(ResourceController.java:97) 
at hudson.model.Executor.run(Executor.java:429)
An attempt to send an e-mail to empty list of recipients, ignored. 
Finished: FAILURE

Environment

Resolution

This happens when backup target folder is a LocalFileStore type and the target folder contains a subfolder.

For example, having this folder structure

.
└── folder.example
    └── subfolder.example

If folder.example is configured as backup target folder from a local file system, it will fail. The solution is using folder.example/subfolder.example instead.

Notes:
1. CloudBees Backup plugin >= 3.38.12 solves the issue, meaning that a Backup Target folder can contain subfolders.
2. For disaster recovery, it is highly recommended that you send the backup to a network drive, NFS-mounted directory, etc. see Backup Plugin - Local directory

Have more questions?

0 Comments

Please sign in to leave a comment.