Unable to execute C:\Windows\system32\bash.exe AWS Kubernetes

I found a bug, i think:
When executing an aws cli script in a step if you select bash with inline source code it will not work properly. I get the error below. I can give you my entire logs if you want.

Task ID:        ServerTasks-63312
Related IDs:    Deployments-14246, Channels-316, Releases-10766, Projects-293, Spaces-1, Environments-147
Task status:    Failed
Task queued:    Monday, 25 January 2021 1:32:56 PM -07:00
Task started:   Monday, 25 January 2021 1:32:56 PM -07:00
Task completed: Monday, 25 January 2021 1:33:00 PM -07:00
Task duration:  4 seconds
Server version: 2020.4.0+Branch.tags-2020.4.0.Sha.6fcc5868ffcdca3e5d2bb1a2071964dfa43d218a
Server node:    WBLUPRDOCT01V

                    | == Failed: Deploy Interviewer S3 release 3.1.8.3 to Amazon-QA ==
13:32:56   Info     |   Step 1: Backup and delete current object is disabled, and will not be executed
13:32:56   Verbose  |   Step 4: Coreapps Send Email does not apply to the current environment, and will not be executed
13:32:56   Info     |   Step 5: Run a Script is disabled, and will not be executed
13:32:56   Info     |   Step 7: Microsoft Teams - Post a message is disabled, and will not be executed
13:32:56   Verbose  |   Guided failure is not enabled for this task
13:33:00   Fatal    |   The deployment failed because one or more steps failed. Please see the deployment log for details.
                    | 
                    |   == Failed: Step 2: expire old stuff ==
13:33:00   Fatal    |     The step failed: Activity expire old stuff on the Octopus Server failed with error 'The remote script failed with exit code -1'.
13:33:00   Verbose  |     expire old stuff completed
                    |   
                    |     == Failed: Octopus Server ==
13:32:56   Verbose  |       Octopus Server version: 2020.4.0+Branch.tags-2020.4.0.Sha.6fcc5868ffcdca3e5d2bb1a2071964dfa43d218a
13:32:56   Verbose  |       Environment Information:
                    |       IsRunningInContainer: False
                    |       OperatingSystem: Microsoft Windows 10.0.14393
                    |       OsBitVersion: x64
                    |       Is64BitProcess: True
                    |       CurrentUser: NT AUTHORITY\SYSTEM
                    |       MachineName: WBLUPRDOCT01V
                    |       ProcessorCount: 4
                    |       CurrentDirectory: C:\Windows\system32
                    |       TempDirectory: C:\Windows\TEMP\
                    |       HostProcessName: Octopus.Server
                    |       PID: 2396
13:32:56   Verbose  |       Executing expire old stuff (type Run an AWS CLI Script) on Octopus Server
13:32:56   Verbose  |       Using Calamari.Cloud.netfx 14.11.0
13:32:56   Verbose  |       Using Calamari.linux-x64 14.11.0
13:32:56   Verbose  |       Running this script in the Octopus Server security context (NT AUTHORITY\SYSTEM)
13:32:56   Verbose  |       Starting C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in working directory 'C:\Octopus\Work\20210125203256-63312-23409' using 'OEM United States' encoding running as 'NT AUTHORITY\SYSTEM' with the same environment variables as the launching process
13:32:57   Verbose  |       Calamari Version: 14.11.0
13:32:57   Verbose  |       Environment Information:
13:32:57   Verbose  |       OperatingSystem: Microsoft Windows NT 10.0.14393.0
13:32:57   Verbose  |       OsBitVersion: x64
13:32:57   Verbose  |       Is64BitProcess: True
13:32:57   Verbose  |       CurrentUser: NT AUTHORITY\SYSTEM
13:32:57   Verbose  |       MachineName: WBLUPRDOCT01V
13:32:57   Verbose  |       ProcessorCount: 4
13:32:57   Verbose  |       CurrentDirectory: C:\Octopus\Work\20210125203256-63312-23409
13:32:57   Verbose  |       TempDirectory: C:\Windows\TEMP\
13:32:57   Verbose  |       HostProcess: Calamari (472)
13:32:58   Warning  |       OctopusPrintVariables is enabled. This should only be used for debugging problems with variables, and then disabled again for normal deployments.
13:32:59   Verbose  |       Performing variable substitution on 'C:\Octopus\Work\20210125203256-63312-23409\Script.sh'
13:32:59   Verbose  |       Executing 'C:\Octopus\Work\20210125203256-63312-23409\Script.sh'
13:33:00   Verbose  |       Setting Proxy Environment Variables
13:33:00   Error    |       Unable to execute C:\Windows\system32\bash.exe, please ensure that C:\Windows\system32\bash.exe is installed and is in the PATH.
13:33:00   Error    |       System.Exception: Error when attempting to execute C:\Windows\system32\bash.exe: The system cannot find the file specified ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
13:33:00   Error    |       at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
13:33:00   Error    |       at Calamari.Common.Features.Processes.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Dictionary`2 environmentVars, String userName, SecureString password, Action`1 output, Action`1 error)
13:33:00   Error    |       --- End of inner exception stack trace ---
13:33:00   Error    |       at Calamari.Common.Features.Processes.SilentProcessRunner.ExecuteCommand(String executable, String arguments, String workingDirectory, Dictionary`2 environmentVars, String userName, SecureString password, Action`1 output, Action`1 error)
13:33:00   Error    |       at Calamari.Common.Features.Processes.CommandLineRunner.Execute(CommandLineInvocation invocation)
13:33:00   Error    |       The command that caused the exception was: "C:\Windows\system32\bash.exe" "Bootstrap.64c-4239-a265-45f8fbca048a.Script.sh" "31F01698D8C7734A1BA4806E7BB8BCB1"

It is very similar to this other ticket that was made, but it was fixed:
Installed Octopus 2020.1 - #4 by raf1.
I think this is happening because i am not running it on windows, but I am running this on AWS which is not running on a tentacle.

Hi @samuelt12,

Thanks for getting in touch!

Unless I’m missing something, this looks to be working as intended.

The step is configured to run on your Octopus Server which is running Windows OS, correct?
So, when the script runs, if you have designated it as Bash it will fail because this can’t be run on a Windows OS.

Please let me know if I’ve misunderstood the scenario.

Regards,
Paul

so we cant run bash commands on windows? Ahh, i thought it would run a windows version of bash. Thanks.

1 Like

Hi @samuelt12!
Just quickly jumping in for Paul here, since he’s finished for the day, but it is only possible if you have WSL installed on the machine, which will give you C:\Windows\System32\bash.exe

I hope this helps!

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