ERROR (Errno::ENOENT): No such file or directory - /usr/bin/env
For some reason when releasing the deploy lock after deploy this error occurs. I guess it's somehow connected with line endings: I am working on Windows and several times I had the same error because of CRLF instead of LF in files like bin/rails, bin/bundle, etc.
The same error occurs when I run mrsk setup on my Windows pc. On linux it seems to work without errors.
Here are mrsk logs:
Releasing the deploy lock
INFO [37efe8e5] Running /usr/bin/env rm mrsk_lock/details && rm -r mrsk_lock on <my server ip>
INFO [37efe8e5] Finished in 0.256 seconds with exit status 0 (successful).
ERROR (Errno::ENOENT): No such file or directory - /usr/bin/env
It doesn't prevent me from deploying actually
These commands are all run on a remote host. Are you trying to deploy to a Windows host? If so, that's not a use case we're supporting. But you should be able to run mrsk from a Windows machine against a 'nix host.
These commands are all run on a remote host. Are you trying to deploy to a Windows host? If so, that's not a use case we're supporting. But you should be able to run mrsk from a Windows machine against a 'nix host.
I am running it on a Windows machine against a 'nix host (Ubuntu 22.04 LTS in particular). And it works fine, but this error occurs in logs for some reason
@caisilus do you still experience the issue?
Error
I got the same error where /usr/bin/env is added for the command executed and causes an ERROR (Errno::ENOENT): No such file or directory exception on Windows when deploying.
ERROR (Errno::ENOENT): No such file or directory - /usr/bin/env git -C C:/Users/ngera/AppData/Local/Temp/kamal-clones/postgres-859eb048d8b85 clone C:/code/infra
Context I have installed the last version via Ruby Gem
kamal version
1.6.0
First time, trying to deploy an app to a Linux box.
Command I run in the following command in the CMD terminal trying to deploy an app from Windows to Linux.
# from the root of the Git repo
kamal deploy -c apps/postgres/docker/config/deploy.yml
Log into image registry...
INFO [e9ee4ca1] Running docker login -u [REDACTED] -p [REDACTED] as ngera@localhost
INFO [e9ee4ca1] Finished in 1.539 seconds with exit status 0 (successful).
INFO [04b181d5] Running docker login -u [REDACTED] -p [REDACTED] on 128.140.102.116
INFO [04b181d5] Finished in 1.853 seconds with exit status 0 (successful).
Build and push app image...
INFO [f1b0da0d] Running docker --version && docker buildx version as ngera@localhost
INFO [f1b0da0d] Finished in 0.358 seconds with exit status 0 (successful).
Building from a local git clone, so ignoring these uncommitted changes:
M apps/postgres/docker/config/deploy.yml
INFO Cloning repo into build directory `C:/Users/ngera/AppData/Local/Temp/kamal-clones/postgres-859eb048d8b85/infra/`...
INFO [c93b29be] Running /usr/bin/env git -C C:/Users/ngera/AppData/Local/Temp/kamal-clones/postgres-859eb048d8b85 clone C:/code/infra as ngera@localhost
Finished all in 4.0 seconds
ERROR (Errno::ENOENT): No such file or directory - /usr/bin/env git -C C:/Users/ngera/AppData/Local/Temp/kamal-clones/postgres-859eb048d8b85 clone C:/code/infra
If I run the clone command without /usr/bin/env, it just works.
git -C C:/Users/ngera/AppData/Local/Temp/kamal-clones/postgres-859eb048d8b85 clone C:/code/infra
Cloning into 'infra'...
done.
Updating files: 100% (425/425), done.
Ps
I have no idea why it would add a Linux env command.
I have git bash installed. This is the only POSIX like environment but I don't execute the command from it (MinTTY)
I'm not a Ruby dev so doing a debug is out of my reach now. I have not really found anywhere where /usr/bin/env would be added by kamal.
Tried to skip the build and push with the --skip-push option without success because kamal adds an extra id to the image id.
Error:
INFO [7221f072] Running docker pull gerardnico/postgres:16.3.1:d2b370fb1a8cb71af1c04321fc815a0ffb843678 on 128.140.102.116
Finished all in 4.8 seconds
ERROR (SSHKit::Command::Failed): Exception while executing on host 128.140.102.116: docker exit status: 1
docker stdout: Nothing written
docker stderr: invalid reference format
Steps and command
# build and push with docker
# docker build apps/postgres/docker -t gerardnico/postgres:16.3.1
# docker push gerardnico/postgres:16.3.1
# then
kamal deploy -c apps/postgres/docker/config/deploy.yml --skip-push
Log into image registry...
INFO [91017e8c] Running docker login -u [REDACTED] -p [REDACTED] as ngera@localhost
INFO [91017e8c] Finished in 1.619 seconds with exit status 0 (successful).
INFO [52070981] Running docker login -u [REDACTED] -p [REDACTED] on 128.140.102.116
INFO [52070981] Finished in 2.407 seconds with exit status 0 (successful).
Pull app image...
INFO [50b9babe] Running docker image rm --force gerardnico/postgres:16.3.1:d2b370fb1a8cb71af1c04321fc815a0ffb843678 on
128.140.102.116
INFO [50b9babe] Finished in 0.188 seconds with exit status 1 (failed).
INFO [7221f072] Running docker pull gerardnico/postgres:16.3.1:d2b370fb1a8cb71af1c04321fc815a0ffb843678 on 128.140.102.116
Finished all in 4.8 seconds
ERROR (SSHKit::Command::Failed): Exception while executing on host 128.140.102.116: docker exit status: 1
docker stdout: Nothing written
docker stderr: invalid reference format
Got exactly same error when deploying from Windows machine
It seems like Kamal doesn't fully support many commands when you try to use it on a Windows machine. I see a lot of Unix-specific hardcode, like /dev/null or /usr/bin/env, which is definitely a breach in documentation that Windows is not supported for the current version of Kamal.
I switched to kubernetes (k3s with argocd) and I'm not going back. So good.
On Windows, installing wsl could be a solution.
I can highly recommend WSL. Makes life when working with Unix-based tools, like Kamal, much easier.
Somehow, non-wsl worked for me in the meantime, but this is back as of Kamal 2.
In kamal 2, this can be avoided by setting
builder:
context: .