Octopus deploy to EC2: "mkdir : Cannot find drive. A drive with the name 'D' does not exist."

I’m trying to get octopus to deploy windows service to EC2 instance.

I’ve added a new “Deploy windows service” step, filled the required info and when running the deploy looks like octopus automatically creates some custom script named “Bootstrap.Octopus.Features.WindowsService_AfterPreDeploy.ps1” which fails with the following error:
“mkdir : Cannot find drive. A drive with the name ‘D’ does not exist.
C:\Octopus\Applications\MyApp\Bootstrap.Octopus.Action.CustomScripts.PreDeploy.ps1:1366 char:5
Error mkdir -Force $logDirectory | out-null”

And it makes sense because EC2 instance indeed doesn’t have D drive.

The problem is that I can’t figure out where that D drive param comes from.

  • I’ve set all the octopus parameters for this deploy step to point to D drive instead of C.
  • I’ve tried to login to EC2 instance hoping to find that script and see what’s inside but seems like it gets created during this deploy step and immediately deleted after the step fails.
  • I’ve changed deploy step to “Run a Script” where I added a script required to start the service but deployment still fails before getting to my script. Right now it looks like octopus automatically creates a differently named file: “Bootstrap.Octopus.Action.CustomScripts.Deploy.ps1” but it still fails with the same error when trying to execute ‘mkdir’ on D drive and my custom script definitely doesn’t have this command! It comes from octopus internally somehow.
  • I’ve mapped D: drive to C: using net use and I’m able execute mkdir D:\test from EC2 instance but octopus build still fails with the same error.

Could you please tell me what parameter to set to C drive? And why octopus tries to execute mkdir before executing my custom script? That’s really weird because all other octopus files and configs are in C:\Octopus

Hi Andrew,

Thanks for getting in touch! I’m sorry to hear you’re hitting this unexpected and weird issue. It looks like it’s failing at a custom script, so perhaps something simple like an old release is being deployed (which doesn’t include changes made to the project since the release was created). Could you confirm if this is the cause or not by creating and deploying a new release?

I look forward to hearing back and getting to the bottom of this one!

Best regards,

Kenny

Hi Kenny,

Yes, I can confirm that it’s not the case. I’ve tried creating new releases and deploying them and I still keep getting this error.

@Kenneth_Bates So does octopus automatically prepend some commands to custom user’s scripts? I still can’t figure out where that mkdir comes from.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.