Dotnet-sonarscanner 5.2.1 /usr/bin/env: ‘sh’: No such file or directory

I don’t know if this is related to the same issue but dotnet-sonarscanner version 5.2.1 fails the command “dotnet-sonarscanner end” when run in docker and fails to send the report to SonarCube.
Error is : “Calling the SonarScanner CLI…
/usr/bin/env: ‘sh’: No such file or directory
The SonarScanner did not complete successfully”
Version 5.2.0 works fine.

ok, in that case there is some other problem in version 5.2.1 maybe @Andrei_Epure you can investigate. Workaround at the moment is install version 5.2.0

Hi @MPujol

What is your docker base image ?
How are you downloading the scanner ?


Hi @mickaelcaro
base image is
sonarscanner is installed with command “dotnet tool install --global dotnet-sonarscanner”


Thanks @MPujol

Did a quick test on my side, i didn’t reproduced that issue.

Can you issue the following command inside your docker context and tell me the output please :

cd ~/.dotnet/tools/.store/dotnet-sonarscanner/5.2.1/dotnet-sonarscanner/5.2.1/tools/netcoreapp3.0/any/sonar-scanner-
file sonar-scanner

hi @mickaelcaro the output is “file: not found”

Have you reverted to version 5.2.0 already ? This file exists somewhere otherwise you wouldn’t have this error message (maybe not at this exact place).

Yes, at the moment we have to explicitly install 5.2.0. (dotnet tool install --global dotnet-sonarscanner --version 5.2.0)
No changes in the project(s) was done. with version 5.2.1 (latest) sonarscanner fails.

Hi @MPujol

How does look your dockerfile ? How are you installing the dotnet command ?

We defitenly changed the header of the shell executable from 5.2.0 to 5.2.1, but as i said, did a small test with the same image as your, and didn’t reproduce that. So it’s more likely some change in the Line endings of the file, or any other extra setup made.