darwin-containers / rund

OCI Container Runtime for Darwin
Apache License 2.0
432 stars 13 forks source link

No output from running container & exit date at unix epoch #21

Closed ArthurPKFX closed 8 months ago

ArthurPKFX commented 8 months ago

Hi! Thanks for all the work, excited to see where this goes Sadly, I'm unable to get the base image working. I followed the readme to install and run everything that's needed. SIP is disabled Here's the output of the docker run:

popcornfx@BuildServerM1s-Mac-mini ~ % docker run -it ghcr.io/macoscontainers/macos-jail/ventura:latest echo "Hello from macOS container ^_^"
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
popcornfx@BuildServerM1s-Mac-mini ~ %

From macOScontainers/rund#27 it seems the warning is normal I am using an M1 Mac mini on macOS Monterey 12.4, running everything natively on arm64. Running from rosetta doesn't change anything After running the docker run command above, the output of docker ps -l is:

popcornfx@BuildServerM1s-Mac-mini ~ % sudo docker ps -l
CONTAINER ID   IMAGE                                               COMMAND                  CREATED         STATUS                             PORTS     NAMES
d46918fd0d61   ghcr.io/macoscontainers/macos-jail/ventura:latest   "echo 'Hello from ma…"   5 seconds ago   Exited (4294967295) 53 years ago             nervous_nobel
popcornfx@BuildServerM1s-Mac-mini ~ %

Notably, the status has the max value of a u32 and the exit time seems to be the unix epoch Happy to provide any logs necessary for debugging

slonopotamus commented 8 months ago

WRT exit time - it is a missing feature that needs to be implemented.

WTR the issue that nothing works: you're on Monterey. I have absolutely zero idea about cross-version compatibility of macOS and there could be issues since you're trying to run Ventura image on Monterey host.

slonopotamus commented 8 months ago

There is untested Intel-only image for Monterey. It was supposed to be multi-arch, but issues.

ArthurPKFX commented 8 months ago

Well that's embarassing, I should've noticed the image was a different version

I'm now getting an error about missing libraries, below is the output with DYLD_PRINT_SEARCHING set

popcornfx@BuildServerM1s-Mac-mini ~ % docker run -e DYLD_PRINT_SEARCHING=1 -it ghcr.io/macoscontainers/macos-jail/monter
ey:latest echo "Hello from macOS container ^_^"
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
dyld[79677]: find path "/usr/lib/libSystem.B.dylib"
dyld[79677]:   possible path(original path): "/usr/lib/libSystem.B.dylib"
dyld[79677]:   possible path(default fallback): "/usr/local/lib/libSystem.B.dylib"
dyld[79677]:   not found: "/usr/lib/libSystem.B.dylib"
dyld[79677]: Library not loaded: '/usr/lib/libSystem.B.dylib'
  Referenced from: '/bin/echo'
  Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file), '/usr/local/lib/libSystem.B.dylib' (no such file)

Seems like there's no shared cache dyld looks into so it doesn't find the libraries. After looking at the files of the image I noticed the only files in /System/Library/dyld/ were about x86_64 and I tried running docker run from a x86_64 shell but it didn't change anything I also tried mounting my whole /System/Library/dyld/ folder inside the container, the docker run command hangs seemingly indefinitely. After that I tried mounting only the relevant files from that folder (dyld_shared_cache_arm64e, dyld_shared_cache_arm64e.1, dyld_shared_cache_arm64e.map) as well as directly mounting the extracted library file /usr/lib/libSystem.B.dylib (extracted using https://github.com/keith/dyld-shared-cache-extractor), but neither worked and gave the original error

Please tell me if it would be preferable to make this into a separate issue 🙂

slonopotamus commented 8 months ago

We just need a proper image with arm support. I suggest subscribing to https://github.com/macOScontainers/macos-jail/issues/12

The reason why Ventura image has arm support is because I built it on my macbook)