How to fix error "errno=2" encountered while deploying a zip file to target server via XLD?

Follow

Shashank Srivastava -

Issue

You are deploying a zip file to your target Linux server using a file.Folder deployable via XLD. When deployment starts, you receive an error that XLD couldn't copy the zip file to the TargetPath you defined for your package. TargetPath is where the zip file will be copied to & exploded upon deployment. It throws error errno=2 which means there is no such file or directory found in TargetPath. But when you check that directory, you see that the zip file has been exploded & the resultant files are there. Error occurs even if TargetPath has 777 permissions.

Environment

XL Deploy, Unix

Resolution

Check the ownership of your TargetPath. If you are using a SUDO connection type for the host(in Infrastructure), make sure the ownership of  TargetPath is with the user you define under SUDO username

If you are using an SU connection type, make sure the TargetPath is owned by the same user you specify iSU username.

Cause

When the TargetPath is not owned by the same user, files do get created there upon deployment, depending upon permissions. But utime & chmod commands (these are invoked by XLD by executing tar command) will not be executed. This makes XLD believe there is something wrong since the exit code returned by tar command is not 0.

Additional Information

Close inspection of XLD logs reveals that below command is executed by XLD to deploy file.Folder deployable in TargetPath.

su - shashank -c cd\ /staging_dir/scripts\ \;\ tar\ -cf\ -\ -C\ /staging_dir/source/c968d882-a3f1-47d3-a853-a7b9f05063a5/zipFolder/test.zip\ .\ \|\ tar\ xpf\ -

You can also see that tar exited with a non zero return code.

2017-06-11 09:01:20.004 [stdout reader] {} INFO c.x.overthere.spi.BaseOverthereFile - tar: .: Cannot utime: Operation not permitted
2017-06-11 09:01:20.004 [stdout reader] {} INFO c.x.overthere.spi.BaseOverthereFile - tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted
2017-06-11 09:01:20.004 [stdout reader] {} INFO c.x.overthere.spi.BaseOverthereFile - tar: Exiting with failure status due to previous errors
2017-06-11 09:01:20.007 [task-sys-task.step-dispatcher-824] {stepDescription=Copy zipFolder to Infrastructure/RemoteLocalHost, taskId=c968d882-a3f1-47d3-a853-a7b9f05063a5, username=admin} INFO c.xebialabs.overthere.ssh.SshProcess - Command [su - shashank -c cd\ /staging_dir/scripts\ \;\ tar\ -cf\ -\ -C\ /staging_dir/source/c968d882-a3f1-47d3-a853-a7b9f05063a5/zipFolder/test.zip\ .\ \|\ tar\ xpf\ -] on ssh:su://xldeploy:shashank@192.168.0.50:22 returned exit code 2

With correct ownership of TargetPath, tar executes successfully & no error is seen in deployment.

2017-06-11 09:02:12.779 [task-sys-task.step-dispatcher-841] {stepDescription=Copy zipFolder to Infrastructure/RemoteLocalHost, taskId=72b481eb-3045-4d75-817c-e1e8677c5cf0, username=admin} INFO  c.xebialabs.overthere.ssh.SshProcess - Command [su - shashank -c cd\ /staging_dir/scripts\ \;\ tar\ -cf\ -\ -C\ /staging_dir/source/72b481eb-3045-4d75-817c-e1e8677c5cf0/zipFolder/test.zip\ .\ \|\ tar\ xpf\ -] on ssh:su://xldeploy:shashank@192.168.0.50:22 returned exit code 0
Tags

xld, xl deploy, how to, exit code 2, errno=2, troubleshooting

Have more questions? Submit a request
Powered by Zendesk