Bug 1216104

Summary: Podman does not respect annotations
Product: [openSUSE] openSUSE Tumbleweed Reporter: Alexandre Vicenzi <alexandre.vicenzi>
Component: ContainersAssignee: Containers Team <containers-bugowner>
Status: CONFIRMED --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Alexandre Vicenzi 2023-10-10 17:28:33 UTC
Executing an image that has the annotation "module.wasm.image/variant=compat" seems to have no effect on Podman.

The following command fails:

> podman run hello-wasm
> {"msg":"exec container process `/hello.wasm`: Exec format error","level":"error","time":"2023-10-10T17:19:12.215791Z"}

While the following command works:

> podman run --annotation module.wasm.image/variant=compat  hello-wasm
> Hello WebAssembly!

The image has the correct annotation, but Podman does not respect it. In my assumption, Podman should respect the annotation in the image.

The image was built with Buildah:

> buildah build --annotation "module.wasm.image/variant=compat" -t hello-wasm

Here is a snipped of the image object:

> podman image inspect hello-wasm
> [
>      {
>           // omitted data
>           "Annotations": {
>                "module.wasm.image/variant": "compact",
>                "org.opencontainers.image.base.digest": "",
>                "org.opencontainers.image.base.name": ""
>           },
>           // omitted data
>      }
> ]

This command seems to work on other distributions as it is documented in many places around the internet, for example: https://opensource.com/article/22/10/wasm-containers
Comment 1 Dan Čermák 2023-10-11 17:10:13 UTC
Try installing crun. The default runtime on opensuse Tumbleweed is runc, where running wasm binaries doesn't appear to work.
Comment 2 Alexandre Vicenzi 2023-10-12 07:23:49 UTC
(In reply to Dan Čermák from comment #1)
> Try installing crun. The default runtime on opensuse Tumbleweed is runc,
> where running wasm binaries doesn't appear to work.

I do have crun installed and Podman picks the correct runtime based on annotations.
Comment 3 Alexandre Vicenzi 2023-10-12 07:26:12 UTC
It fails even if I force to use crun.

> podman run hello-wasm
> {"msg":"exec container process `/hello.wasm`: Exec format error","level":"error","time":"2023-10-12T07:24:48.688437Z"}

> podman --runtime=/usr/bin/crun run hello-wasm
> {"msg":"exec container process `/hello.wasm`: Exec format error","level":"error","time":"2023-10-12T07:24:58.163032Z"}
Comment 4 Alexandre Vicenzi 2023-10-12 07:28:23 UTC
To my surprise, it works if I do:

> podman --runtime=/usr/bin/crun-wasm run hello-wasm
> Hello WebAssembly!

/usr/bin/crun-wasm is link to /usr/bin/crun, it is the same binary.

alexandre@localhost:~/workspace/hello> /usr/bin/crun -v
crun version 1.9
commit: a538ac4ea1ff319bcfe2bf81cb5c6f687e2dc9d3
rundir: /run/user/1000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL

alexandre@localhost:~/workspace/hello> /usr/bin/crun-wasm -v
crun version 1.9
commit: a538ac4ea1ff319bcfe2bf81cb5c6f687e2dc9d3
rundir: /run/user/1000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL