slim icon indicating copy to clipboard operation
slim copied to clipboard

[M1 Macbook Pro] docker-slim build error - /opt/dockerslim/bin/docker-slim-sensor: no such file or directory

Open netrobert opened this issue 2 years ago • 10 comments

Expected Behavior

docker-slim build [image] executes normally.


Actual Behavior

docker-slim build [image] returns the following error:

time="2022-03-08T14:10:48+01:00" level=fatal msg="docker-slim: failure" error="API error (400): OCI runtime create failed: container_linux.go:380: starting container process caused: exec: \"/opt/dockerslim/bin/docker-slim-sensor\": stat /opt/dockerslim/bin/docker-slim-sensor: no such file or directory: unknown" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x88\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x100e2d240, 0x14000522198})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x30\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0x140001bc4e0, {0x100e2d240, 0x14000522198})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:49 +0x44\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(0x140001bc4e0, 0x14000116280, {0x16fa8ba0a, 0x5}, 0x0, {0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:1037 +0x585c\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0x14000494480)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:636 +0x4788\ngithub.com/urfave/cli/v2.(*Command).Run(0x101443fe0, 0x1400056e580)\n\tgithub.com/urfave/cli/[email protected]/command.go:163 +0x634\ngithub.com/urfave/cli/v2.(*App).RunContext(0x140001029c0, {0x100e41ad0, 0x14000196008}, {0x14000180050, 0x5, 0x5})\n\tgithub.com/urfave/cli/[email protected]/app.go:313 +0x760\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/[email protected]/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x64\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:15 +0x1e4\n" version="darwin|Transformer|1.37.4|latest|latest"

Steps to Reproduce the Problem

  1. Install docker-slim using homebrew; brew install docker-slim or by using the M1 Mac binaries
  2. Run docker-slim build on any image

Important to note that:

  1. Both the homebrew package and M1 Mac binaries produce the same error message.
  2. Both brew audit and test pass successfully.
  3. Using an older binary does not resolve the issue.
  4. Copying the docker-slim-sensor binary to /opt/dockerslim/bin does not alter the error message.

Specifications

  • Version: 1.37.4
  • Platform: darwin
  • Full: darwin|Transformer|1.37.4|latest|latest
  • Model: M1 Pro 14'

netrobert avatar Mar 08 '22 13:03 netrobert

Just noticed this looks to be the same issue as #275.

netrobert avatar Mar 08 '22 14:03 netrobert

@netrobert what's the location of the docker-slim binary on your system? and is there the docker-slim-sensor binary in the same directory?

kcq avatar Mar 09 '22 08:03 kcq

@kcq I tried version 1.36.4 today and it worked without a hitch

Regarding your question, homebrew installs in /opt/homebrew/bin which is in my path, I also tried running the docker-slim binary directly after extracting the zip and moving the M1 binaries to /usr/local/bin which is also in my path but it didn't seem to change anything (in all cases both binaries are in the same directory).

I assumed it could be an issue with permissions but the error was the same regardless of what permissions I set

netrobert avatar Mar 09 '22 09:03 netrobert

@netrobert what's the location of the docker-slim binary on your system? and is there the docker-slim-sensor binary in the same directory?

Hello, I have the same issue as @netrobert .

Location of the docker-slim -> /usr/local/bin Docker-Slim version -> 1.37.4

docker-slim version darwin|Transformer|1.37.4|2e1992528f556df7e5f91109aef813f0d4488404|2022-02-28_05:54:15AM

GabrielBlondeau-Kirby avatar Mar 17 '22 16:03 GabrielBlondeau-Kirby

I have the same issue when using the version installed using homebrew. However, building manually (using make build_m1) and then either running from dist_mac_m1 OR from /opt/homebrew/bin (replacing the homebrew provided binaries) works.

I hope this information helps.

$ docker-slim -v
docker-slim version darwin|Transformer|1.37.5|latest|latest

RobinThrift avatar Mar 28 '22 09:03 RobinThrift

That did it for me:

$ docker-slim update  

krema avatar Aug 31 '22 08:08 krema

Same problem here...

engin-can avatar Sep 27 '22 22:09 engin-can

Facing same issue time="2023-01-23T14:15:50+05:30" level=fatal msg="docker-slim: failure" error="API error (400): failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: \"/opt/dockerslim/bin/docker-slim-sensor\": stat /opt/dockerslim/bin/docker-slim-sensor: no such file or directory

netdip avatar Jan 23 '23 08:01 netdip

Similar issue in WSL2:

cmd=build state=image.inspection.start
time="2024-01-24T11:27:47-06:00" level=warning msg="CopyRegularFile(/usr/local/bin/slim-sensor,/tmp/slim-state/slim-sensor) - unable to set mode"
time="2024-01-24T11:27:47-06:00" level=warning msg="CopyRegularFile(/usr/local/bin/slim-sensor,/tmp/slim-state/slim-sensor) - UpdateFileTimes error"
cmd=build info=image id='sha256:03bf034caa7b33c2d1f6d4f946502d36e7673a48f8770c455231b4914acd8a5b' size.bytes='134276613' size.human='134 MB'
cmd=build info=image.users exe='nobody' all='nobody'
cmd=build info=image.stack index='0' name='harbor.infra.meshok.team/meshok/file-service:0.11.0' id='sha256:03bf034caa7b33c2d1f6d4f946502d36e7673a48f8770c455231b4914acd8a5b'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container name='slimk_25702_20240124172747' id='520ddf4ef2c4bbda40de28e0b6060b205747f8d1d78f0063039173f6bf6534cc' status='created'
cmd=build info=container status='crashed' id='520ddf4ef2c4bbda40de28e0b6060b205747f8d1d78f0063039173f6bf6534cc'
slim: container stdout:
slim: container stderr:
exec /opt/_slim/bin/slim-sensor: no such file or directory
slim: end of container logs =============
cmd=build state=exited code=-123 version=linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM
cmd=build info=report file='/tmp/slim.report.json'
cmd=build info=exit code='-123' version='linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM' location='/usr/local/bin'
> slim version

slim version
cmd=version info=app location='/usr/local/bin' outdated='false' current='1.40.10' verdict='you have the latest version' cmd='version' version='linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM' container='false' dsimage='false'
cmd=version info=host cmd='version' osname='Ubuntu 20.04.2 LTS' osbuild='' version='#1 SMP Thu Oct 5 21:02:42 UTC 2023' release='5.15.133.1-microsoft-standard-WSL2' sysname='Linux'
cmd=version info=docker server.version='20.10.17' architecture='x86_64' cmd='version' name='DESKTOP-062MG6U' kernel.version='5.15.133.1-microsoft-standard-WSL2' operating.system='Ubuntu 20.04.2 LTS' ostype='linux'
cmd=version info=dclient mini.api.version='1.12' build.time='2022-06-06T23:01:03.000000000+00:00' git.commit='a89b842' cmd='version' api.version='1.41'

Initially, I installed slim using brew install docker-slim, but then I removed it and manually unpacked the dist_linux archive and placed the binaries into /usr/local/bin.

mefcorvi avatar Jan 24 '24 17:01 mefcorvi

@mefcorvi the important part of the log is this:

time="2024-01-24T11:27:47-06:00" level=warning msg="CopyRegularFile(/usr/local/bin/slim-sensor,/tmp/slim-state/slim-sensor) - unable to set mode"
time="2024-01-24T11:27:47-06:00" level=warning msg="CopyRegularFile(/usr/local/bin/slim-sensor,/tmp/slim-state/slim-sensor) - UpdateFileTimes error"

It looks like a problem with copying the sensor file from /usr/local/bin/ to /tmp/slim-state/. Can you double check if the slim-sensor binary ends up in /tmp/slim-state/.

Either way, the build command execution shouldn't attempt to create the temporary container if it wasn't successful copying the sensor binary, which appears to be the case here.

kcq avatar Jan 25 '24 18:01 kcq