nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

[macOS + nerdbox] `nerdctl run` fails with `not implemented`

Open AkihiroSuda opened this issue 4 months ago • 8 comments

On macOS with nerdbox, nerdctl run fails with not implemented

$ nerdctl --debug  run --rm --snapshotter erofs --runtime io.containerd.nerdbox.v1 --platform=linux alpine
DEBU[0000] verifying process skipped                    
FATA[0000] not implemented 

The image is pulled with ctr, as nerdctl pull still does not work on macOS either:

  • https://github.com/containerd/nerdctl/issues/4570

Version:

  • containerd v2.2.0-rc.0
  • nerdctl 2ba655af
  • nerdbox containerd/nerdbox@5f30298b164bc203b2bb05d6deac340be906fd60
    • Will be public soon https://github.com/containerd/project/issues/154
  • macOS 26.0.1

Call stack: https://github.com/containerd/nerdctl/blob/804a8cd0c38bf11188d35265f09c7e5a4e00a8ef/pkg/cmd/container/create.go#L253-L256 https://github.com/containerd/nerdctl/blob/804a8cd0c38bf11188d35265f09c7e5a4e00a8ef/pkg/cmd/container/run_mount.go#L218 https://github.com/containerd/containerd/blob/a6fa1d7fe569cbd08a1effbe15c8a97205360f6a/core/mount/mount.go#L50 https://github.com/containerd/containerd/blob/a6fa1d7fe569cbd08a1effbe15c8a97205360f6a/core/mount/mount_darwin.go#L22-L24

AkihiroSuda avatar Oct 31 '25 16:10 AkihiroSuda

Some progress with this, still not working

diff --git a/pkg/cmd/container/run_mount.go b/pkg/cmd/container/run_mount.go
index bd0c4a08..07f3871a 100644
--- a/pkg/cmd/container/run_mount.go
+++ b/pkg/cmd/container/run_mount.go
@@ -194,7 +194,8 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
                        }
                }
 
-               if runtime.GOOS == "linux" {
+               switch runtime.GOOS {
+               case "linux":
                        defer unmounter(tempDir)
                        for _, m := range mounts {
                                m := m
@@ -213,7 +214,9 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
                                        return nil, nil, nil, fmt.Errorf("failed to mount %+v on %q: %w", m, tempDir, err)
                                }
                        }
-               } else {
+               case "darwin":
+                       // NOP
+               default:
                        defer unmounter(tempDir)
                        if err := mount.All(mounts, tempDir); err != nil {
                                if err := s.Remove(ctx, tempDir); err != nil && !errdefs.IsNotFound(err) {
$ nerdctl run --rm --snapshotter erofs --runtime io.containerd.nerdbox.v1 --platform=linux/arm64 --net=host alpine
FATA[0000] spec does not contain Linux or Windows section

AkihiroSuda avatar Oct 31 '25 18:10 AkihiroSuda

FATA[0000] spec does not contain Linux or Windows section

I had to make a similar change to get ctr working since by default it was generating an invalid configuration on Darwin. (https://github.com/containerd/containerd/pull/12371)

dmcgowan avatar Oct 31 '25 18:10 dmcgowan

FATA[0000] spec does not contain Linux or Windows section

I had to make a similar change to get ctr working since by default it was generating an invalid configuration on Darwin. (containerd/containerd#12371)

Thanks, seems to need this

diff --git a/pkg/cmd/container/create.go b/pkg/cmd/container/create.go
index 69e6919c..0720f8fd 100644
--- a/pkg/cmd/container/create.go
+++ b/pkg/cmd/container/create.go
@@ -119,7 +119,7 @@ func Create(ctx context.Context, client *containerd.Client, args []string, netMa
        }
 
        opts = append(opts,
-               oci.WithDefaultSpec(),
+               oci.WithDefaultSpecForPlatform(options.Platform),
        )
 
        platformOpts, err := setPlatformOptions(ctx, client, id, netManager.NetworkOptions().UTSNamespace, &internalLabels, options)

Seems getting closer to work, but still failing with failed to create shim task: VM did not start within 5s

AkihiroSuda avatar Oct 31 '25 18:10 AkihiroSuda

I'm seeing the VM boot up, I've never tested the binary log drivers though so that is likely buggy

dmcgowan avatar Oct 31 '25 18:10 dmcgowan

--log-driver=none does not work either. Noob question: is there anyway to obtain the failure logs? krun_start_enter() failed silently?

AkihiroSuda avatar Oct 31 '25 19:10 AkihiroSuda

It timed about apparently because "run_vminitd.sock" didn't appear: https://github.com/containerd/nerdbox/blob/f8c2ce3c6e2045c5584d0fb5f67b6675cea7dd55/internal/vm/libkrun/instance.go#L301

Daemon logs:

DEBU[2025-11-02T18:50:21.162563000+09:00] stat snapshot                                 key="sha256:50163a6b11927e67829dd6ba5d5ba2b52fae0a17adb18c1967e24c13a62bfffa" snapshotter=erofs
DEBU[2025-11-02T18:50:21.172780000+09:00] stat snapshot                                 key="sha256:50163a6b11927e67829dd6ba5d5ba2b52fae0a17adb18c1967e24c13a62bfffa" snapshotter=erofs
DEBU[2025-11-02T18:50:21.203387000+09:00] prepare view snapshot                         key=/var/folders/8s/9m9m_j810kb2ystr5bxv21gc0000gn/T/initialC2225856919 parent="sha256:50163a6b11927e67829dd6ba5d5ba2b52fae0a17adb18c1967e24c13a62bfffa" snapshotter=erofs
DEBU[2025-11-02T18:50:21.232708000+09:00] activate mounts                               mounts=1 name=/var/folders/8s/9m9m_j810kb2ystr5bxv21gc0000gn/T/initialC2225856919 temp=false
DEBU[2025-11-02T18:50:21.232721000+09:00] activating mount                              mounts="[{erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs  [ro loop]}]" name=/var/folders/8s/9m9m_j810kb2ystr5bxv21gc0000gn/T/initialC2225856919
DEBU[2025-11-02T18:50:21.287801000+09:00] prepare snapshot                              key=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 parent="sha256:50163a6b11927e67829dd6ba5d5ba2b52fae0a17adb18c1967e24c13a62bfffa" snapshotter=erofs
DEBU[2025-11-02T18:50:21.408021000+09:00] get snapshot mounts                           key=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 snapshotter=erofs
DEBU[2025-11-02T18:50:21.410729000+09:00] creating task                                 id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 runtime=io.containerd.nerdbox.v1
DEBU[2025-11-02T18:50:21.553818000+09:00] remove snapshot                               key=/var/folders/8s/9m9m_j810kb2ystr5bxv21gc0000gn/T/initialC2225856919 snapshotter=erofs
DEBU[2025-11-02T18:50:21.566437000+09:00] schedule snapshotter cleanup                  snapshotter=erofs
DEBU[2025-11-02T18:50:21.589374000+09:00] removed snapshot                              key=default/9//var/folders/8s/9m9m_j810kb2ystr5bxv21gc0000gn/T/initialC2225856919 snapshotter=erofs
DEBU[2025-11-02T18:50:21.712505000+09:00] loaded shim info                              containerd.io/runtime-allow-mounts="mkdir/*,format/*,erofs" shim=io.containerd.nerdbox.v1
DEBU[2025-11-02T18:50:21.712549000+09:00] activating mount                              mounts="[{mkfs/ext4 /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/9/rwlayer.img  [X-containerd.mkfs.fs=ext4 X-containerd.mkfs.size=67108864 rw loop]} {erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs  [ro loop]} {format/mkdir/overlay overlay  [X-containerd.mkdir.path={{ mount 0 }}/upper:0755 X-containerd.mkdir.path={{ mount 0 }}/work:0755 workdir={{ mount 0 }}/work upperdir={{ mount 0 }}/upper lowerdir={{ mount 1 }}]}]" name=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66
DEBU[2025-11-02T18:50:21.722443000+09:00] transforming mkfs mount: {Type:ext4 Source:/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/9/rwlayer.img Target: Options:[X-containerd.mkfs.fs=ext4 X-containerd.mkfs.size=67108864 rw loop]} 
time="2025-11-02T18:50:21.766810000+09:00" level=debug msg="loading plugin" id=nerdbox.vm-manager.v1.libkrun runtime=io.containerd.nerdbox.v1 type=nerdbox.vm-manager.v1
time="2025-11-02T18:50:21.767020000+09:00" level=debug msg="loading plugin" id=io.containerd.event.v1.publisher runtime=io.containerd.nerdbox.v1 type=io.containerd.event.v1
time="2025-11-02T18:50:21.767036000+09:00" level=debug msg="loading plugin" id=io.containerd.internal.v1.shutdown runtime=io.containerd.nerdbox.v1 type=io.containerd.internal.v1
time="2025-11-02T18:50:21.767043000+09:00" level=debug msg="loading plugin" id=io.containerd.ttrpc.v1.task runtime=io.containerd.nerdbox.v1 type=io.containerd.ttrpc.v1
time="2025-11-02T18:50:21.767108000+09:00" level=debug msg="registering ttrpc service" id=io.containerd.ttrpc.v1.task runtime=io.containerd.nerdbox.v1
time="2025-11-02T18:50:21.767177000+09:00" level=debug msg="serving api on socket" socket="[inherited from parent]"
time="2025-11-02T18:50:21.767193000+09:00" level=debug msg="starting signal loop" namespace=default path=/private/var/run/containerd/io.containerd.runtime.v2.task/default/301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 pid=28212 runtime=io.containerd.nerdbox.v1
INFO[2025-11-02T18:50:21.768480000+09:00] connecting to shim 301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66  address="unix:///var/run/containerd/s/cb863f63dd75b9587e3eeac903f094a0f9a2ff1b6170e89933c86f1ec1be579f" namespace=default protocol=ttrpc version=3
time="2025-11-02T18:50:21.773839000+09:00" level=info msg="creating container task" bundle=/var/run/containerd/io.containerd.runtime.v2.task/default/301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 rootfs="[type:\"ext4\"  source:\"/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/9/rwlayer.img\"  options:\"rw\"  options:\"loop\" type:\"erofs\"  source:\"/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs\"  options:\"ro\"  options:\"loop\" type:\"format/mkdir/overlay\"  source:\"overlay\"  options:\"X-containerd.mkdir.path={{ mount 0 }}/upper:0755\"  options:\"X-containerd.mkdir.path={{ mount 0 }}/work:0755\"  options:\"workdir={{ mount 0 }}/work\"  options:\"upperdir={{ mount 0 }}/upper\"  options:\"lowerdir={{ mount 1 }}\"]" runtime=io.containerd.nerdbox.v1 stderr=/var/run/containerd/fifo/653384417/301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66-stderr stdin= stdout=/var/run/containerd/fifo/653384417/301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66-stdout
time="2025-11-02T18:50:21.777805000+09:00" level=warning msg="overlayfs missing workdir or upperdir" options="[X-containerd.mkdir.path={{ mount 0 }}/upper:0755 X-containerd.mkdir.path={{ mount 0 }}/work:0755 workdir={{ mount 0 }}/work upperdir={{ mount 0 }}/upper lowerdir={{ mount 1 }}]" runtime=io.containerd.nerdbox.v1
[2025-11-02T09:50:21Z ERROR devices::virtio::console::device] Couldn't get terminal dimensions: ENODEV: No such device
[2025-11-02T09:50:21Z ERROR devices::virtio::console::device] Couldn't get terminal dimensions: ENODEV: No such device
[    0.026627] brd: module loaded
[    0.028191] loop: module loaded
[    0.028259] virtio_blk virtio3: 1/0/0 default/read/poll queues
[    0.028399] virtio_blk virtio3: [vda] 131072 512-byte logical blocks (67.1 MB/64.0 MiB)
[    0.028666] virtio_blk virtio4: 1/0/0 default/read/poll queues
[    0.028799] virtio_blk virtio4: [vdb] 24 512-byte logical blocks (12.3 kB/12.0 KiB)
[    0.028967] tun: Universal TUN/TAP device driver, 1.6
[    0.029104] VFIO - User Level meta-driver version: 0.3
[    0.029194] rtc-pl031 a002000.rtc: registered as rtc0
[    0.029259] rtc-pl031 a002000.rtc: setting system clock to 2025-11-02T09:50:21 UTC (1762077021)
[    0.029632] xt_time: kernel timezone is -0000
[    0.029685] IPVS: Registered protocols (TCP, UDP, SCTP, AH, ESP)
[    0.029732] IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
[    0.029811] IPVS: ipvs loaded.
[    0.029905] IPVS: [rr] scheduler registered.
[    0.029968] IPVS: [wrr] scheduler registered.
[    0.030019] IPVS: [lc] scheduler registered.
[    0.030080] IPVS: [wlc] scheduler registered.
[    0.030130] IPVS: [fo] scheduler registered.
[    0.030193] IPVS: [ovf] scheduler registered.
[    0.030264] IPVS: [lblc] scheduler registered.
[    0.030314] IPVS: [lblcr] scheduler registered.
[    0.030358] IPVS: [dh] scheduler registered.
[    0.030410] IPVS: [sh] scheduler registered.
[    0.030462] IPVS: [sed] scheduler registered.
[    0.030512] IPVS: [nq] scheduler registered.
[    0.030567] IPVS: [sip] pe registered.
[    0.030623] Initializing XFRM netlink socket
[    0.030686] NET: Registered PF_INET6 protocol family
[    0.030973] Segment Routing with IPv6
[    0.031010] In-situ OAM (IOAM) with IPv6
[    0.031058] NET: Registered PF_PACKET protocol family
[    0.031109] 9pnet: Installing 9P2000 support
[    0.031170] NET: Registered PF_VSOCK protocol family
[    0.031426] NET: Registered PF_TSI protocol family
[    0.031794] registered taskstats version 1
[    0.033432] alg: No test for fips(ansi_cprng) (fips_ansi_cprng)
[    0.034335] clk: Disabling unused clocks
[    0.059048] Freeing initrd memory: 5100K
[    0.059212] Freeing unused kernel memory: 1856K
[    0.059311] Run /init as init process
DEBU[0000] starting vminitd                              args="[-debug -vsock-rpc-port=1025 -vsock-stream-port=1026 -vsock-cid=3]" env="[HOME=/ TERM=xterm KRUN_INIT=/sbin/vminitd PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8]"
DEBU[0000] setting up networking                         networks="[]" virtio_ifaces="map[]"
DEBU[0000] brought up lo interface                      
DEBU[0000] /                                             mode=drwxr-xr-x size=220
DEBU[0000] /dev                                          mode=drwxr-xr-x size=2600
DEBU[0000] /dev/autofs                                   mode=Dcrw-r--r-- size=0
DEBU[0000] /dev/console                                  mode=Dcrw------- size=0
DEBU[0000] /dev/cpu_dma_latency                          mode=Dcrw------- size=0
DEBU[0000] /dev/full                                     mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/fuse                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc0                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc1                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc2                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc3                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc4                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc5                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc6                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hvc7                                     mode=Dcrw------- size=0
DEBU[0000] /dev/hwrng                                    mode=Dcrw------- size=0
DEBU[0000] /dev/kmsg                                     mode=Dcrw-r--r-- size=0
DEBU[0000] /dev/loop-control                             mode=Dcrw------- size=0
DEBU[0000] /dev/loop0                                    mode=Drw------- size=0
DEBU[0000] /dev/loop1                                    mode=Drw------- size=0
DEBU[0000] /dev/loop2                                    mode=Drw------- size=0
DEBU[0000] /dev/loop3                                    mode=Drw------- size=0
DEBU[0000] /dev/loop4                                    mode=Drw------- size=0
DEBU[0000] /dev/loop5                                    mode=Drw------- size=0
DEBU[0000] /dev/loop6                                    mode=Drw------- size=0
DEBU[0000] /dev/loop7                                    mode=Drw------- size=0
DEBU[0000] /dev/net                                      mode=drwxr-xr-x size=60
DEBU[0000] /dev/net/tun                                  mode=Dcrw------- size=0
DEBU[0000] /dev/null                                     mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/ptmx                                     mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/ram0                                     mode=Drw------- size=0
DEBU[0000] /dev/ram1                                     mode=Drw------- size=0
DEBU[0000] /dev/ram10                                    mode=Drw------- size=0
DEBU[0000] /dev/ram11                                    mode=Drw------- size=0
DEBU[0000] /dev/ram12                                    mode=Drw------- size=0
DEBU[0000] /dev/ram13                                    mode=Drw------- size=0
DEBU[0000] /dev/ram14                                    mode=Drw------- size=0
DEBU[0000] /dev/ram15                                    mode=Drw------- size=0
DEBU[0000] /dev/ram2                                     mode=Drw------- size=0
DEBU[0000] /dev/ram3                                     mode=Drw------- size=0
DEBU[0000] /dev/ram4                                     mode=Drw------- size=0
DEBU[0000] /dev/ram5                                     mode=Drw------- size=0
DEBU[0000] /dev/ram6                                     mode=Drw------- size=0
DEBU[0000] /dev/ram7                                     mode=Drw------- size=0
DEBU[0000] /dev/ram8                                     mode=Drw------- size=0
DEBU[0000] /dev/ram9                                     mode=Drw------- size=0
DEBU[0000] /dev/random                                   mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/rtc0                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty                                      mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/tty0                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty1                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty10                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty11                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty12                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty13                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty14                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty15                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty16                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty17                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty18                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty19                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty2                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty20                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty21                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty22                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty23                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty24                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty25                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty26                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty27                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty28                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty29                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty3                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty30                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty31                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty32                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty33                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty34                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty35                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty36                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty37                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty38                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty39                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty4                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty40                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty41                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty42                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty43                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty44                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty45                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty46                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty47                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty48                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty49                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty5                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty50                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty51                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty52                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty53                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty54                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty55                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty56                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty57                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty58                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty59                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty6                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty60                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty61                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty62                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty63                                    mode=Dcrw------- size=0
DEBU[0000] /dev/tty7                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty8                                     mode=Dcrw------- size=0
DEBU[0000] /dev/tty9                                     mode=Dcrw------- size=0
DEBU[0000] /dev/ttyS0                                    mode=Dcrw------- size=0
DEBU[0000] /dev/ttyS1                                    mode=Dcrw------- size=0
DEBU[0000] /dev/ttyS2                                    mode=Dcrw------- size=0
DEBU[0000] /dev/ttyS3                                    mode=Dcrw------- size=0
DEBU[0000] /dev/urandom                                  mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/vcs                                      mode=Dcrw------- size=0
DEBU[0000] /dev/vcs1                                     mode=Dcrw------- size=0
DEBU[0000] /dev/vcsa                                     mode=Dcrw------- size=0
DEBU[0000] /dev/vcsa1                                    mode=Dcrw------- size=0
DEBU[0000] /dev/vcsu                                     mode=Dcrw------- size=0
DEBU[0000] /dev/vcsu1                                    mode=Dcrw------- size=0
DEBU[0000] /dev/vda                                      mode=Drw------- size=0
DEBU[0000] /dev/vdb                                      mode=Drw------- size=0
DEBU[0000] /dev/vfio                                     mode=drwxr-xr-x size=60
DEBU[0000] /dev/vfio/vfio                                mode=Dcrw-rw-rw- size=0
DEBU[0000] /dev/vga_arbiter                              mode=Dcrw------- size=0
DEBU[0000] /dev/vport2p0                                 mode=Dcrw------- size=0
DEBU[0000] /dev/vsock                                    mode=Dcrw------- size=0
DEBU[0000] /dev/zero                                     mode=Dcrw-rw-rw- size=0
DEBU[0000] /etc                                          mode=drwxr-xr-x size=80
DEBU[0000] /etc/hosts                                    mode=-rw-r--r-- size=20
DEBU[0000] /etc/resolv.conf                              mode=-rw-r--r-- size=0
DEBU[0000] /init                                         mode=-rwxr-xr-x size=12452024
DEBU[0000] /proc (skipping)                              mode=dr-xr-xr-x size=0
DEBU[0000] /root                                         mode=drwx------ size=40
DEBU[0000] /run                                          mode=dtrwxrwxrwx size=40
DEBU[0000] /sbin                                         mode=drwxr-xr-x size=60
DEBU[0000] /sbin/crun                                    mode=-rwxr-xr-x size=1853208
DEBU[0000] /sys (skipping)                               mode=dr-xr-xr-x size=0
DEBU[0000] /tmp                                          mode=dtrwxrwxrwx size=40
DEBU[0000] kernel command line                           cmdline="console=hvc0  KRUN_INIT=/sbin/vminitd    \"TERM=xterm\" \"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" \"LANG=C.UTF-8\" earlycon=pl011,mmio32,0x0a001000 tsi_hijack  -- \"-debug\" \"-vsock-rpc-port=1025\" \"-vsock-stream-port=1026\" \"-vsock-cid=3\"\n"
DEBU[0000] Runtime info                                  ncpu=2
DEBU[0000] crun version 1.24, commit: 54693209039e5e04cbe3c8b1cd5fe2301219f0a1, rundir: /run/crun, spec: 1.0.0, +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL,   command="crun --version"
DEBU[0000] Dumping /proc/pid info                       
DEBU[0000] init                                          cmdline="/init -debug -vsock-rpc-port=1025 -vsock-stream-port=1026 -vsock-cid=3 " pid=1 ppid=0 vmrss="10604 kB"
DEBU[0000] kworker/0:0H-events_highpri                   pid=10 ppid=2
DEBU[0000] kworker/0:1-rcu_gp                            pid=11 ppid=2
DEBU[0000] kworker/u8:0-async                            pid=12 ppid=2
DEBU[0000] kworker/R-mm_percpu_wq                        pid=13 ppid=2
DEBU[0000] rcu_tasks_trace_kthread                       pid=14 ppid=2
DEBU[0000] ksoftirqd/0                                   pid=15 ppid=2
DEBU[0000] rcu_sched                                     pid=16 ppid=2
DEBU[0000] rcu_exp_par_gp_kthread_worker/0               pid=17 ppid=2
DEBU[0000] rcu_exp_gp_kthread_worker                     pid=18 ppid=2
DEBU[0000] migration/0                                   pid=19 ppid=2
DEBU[0000] kthreadd                                      pid=2 ppid=0
DEBU[0000] cpuhp/0                                       pid=20 ppid=2
DEBU[0000] cpuhp/1                                       pid=21 ppid=2
DEBU[0000] migration/1                                   pid=22 ppid=2
DEBU[0000] ksoftirqd/1                                   pid=23 ppid=2
DEBU[0000] kworker/1:0-events                            pid=24 ppid=2
DEBU[0000] kworker/1:0H-events_highpri                   pid=25 ppid=2
DEBU[0000] kdevtmpfs                                     pid=26 ppid=2
DEBU[0000] kworker/R-inet_frag_wq                        pid=27 ppid=2
DEBU[0000] kauditd                                       pid=28 ppid=2
DEBU[0000] oom_reaper                                    pid=29 ppid=2
DEBU[0000] pool_workqueue_release                        pid=3 ppid=2
DEBU[0000] kworker/R-writeback                           pid=30 ppid=2
DEBU[0000] kcompactd0                                    pid=31 ppid=2
DEBU[0000] kworker/R-kblockd                             pid=32 ppid=2
DEBU[0000] kworker/1:1-events                            pid=33 ppid=2
DEBU[0000] kworker/0:1H                                  pid=34 ppid=2
DEBU[0000] kworker/u8:1-events_unbound                   pid=35 ppid=2
DEBU[0000] kswapd0                                       pid=36 ppid=2
DEBU[0000] kworker/R-xfsalloc                            pid=37 ppid=2
DEBU[0000] kworker/R-xfs_mru_cache                       pid=38 ppid=2
DEBU[0000] kworker/u9:0                                  pid=39 ppid=2
DEBU[0000] kworker/R-kvfree_rcu_reclaim                  pid=4 ppid=2
DEBU[0000] kworker/R-kthrotld                            pid=40 ppid=2
DEBU[0000] hwrng                                         pid=43 ppid=2
DEBU[0000] kworker/u8:2                                  pid=44 ppid=2
DEBU[0000] khvcd                                         pid=45 ppid=2
DEBU[0000] kworker/0:2                                   pid=46 ppid=2
DEBU[0000] kworker/R-vfio-irqfd-cleanup                  pid=47 ppid=2
DEBU[0000] kworker/R-mld                                 pid=48 ppid=2
DEBU[0000] kworker/1:1H                                  pid=49 ppid=2
DEBU[0000] kworker/R-rcu_gp                              pid=5 ppid=2
DEBU[0000] kworker/R-ipv6_addrconf                       pid=50 ppid=2
DEBU[0000] kworker/R-sync_wq                             pid=6 ppid=2
DEBU[0000] kworker/R-slub_flushwq                        pid=7 ppid=2
DEBU[0000] kworker/R-netns                               pid=8 ppid=2
DEBU[0000] kworker/0:0-events                            pid=9 ppid=2
INFO[0000] loading plugin                                plugin_id=io.containerd.internal.v1.shutdown
INFO[0000] loading plugin                                plugin_id=nerdbox.streaming.v1.vsock
INFO[0000] loading plugin                                plugin_id=io.containerd.event.v1.exchange
INFO[0000] loading plugin                                plugin_id=io.containerd.ttrpc.v1.bundle
INFO[0000] loading plugin                                plugin_id=io.containerd.ttrpc.v1.system
INFO[0000] loading plugin                                plugin_id=io.containerd.ttrpc.v1.events
INFO[0000] loading plugin                                plugin_id=io.containerd.ttrpc.v1.task
DEBU[0000] initialized vminitd                           t=8.332125ms
time="2025-11-02T18:50:26.778516000+09:00" level=warning msg="Timeout while waiting for VM to start" runtime=io.containerd.nerdbox.v1 timeout=5s
time="2025-11-02T18:50:26.779899000+09:00" level=info msg="deleting task" exec= id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 runtime=io.containerd.nerdbox.v1
ERRO[2025-11-02T18:50:26.780240000+09:00] failed to delete task                         error="rpc error: code = FailedPrecondition desc = vm not running: failed precondition" id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66
time="2025-11-02T18:50:26.780674000+09:00" level=info msg=shutdown id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 runtime=io.containerd.nerdbox.v1
INFO[2025-11-02T18:50:26.781028000+09:00] shim disconnected                             id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 namespace=default
INFO[2025-11-02T18:50:26.781120000+09:00] cleaning up after shim disconnected           id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 namespace=default
INFO[2025-11-02T18:50:26.781143000+09:00] cleaning up dead shim                         id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 namespace=default
ERRO[2025-11-02T18:50:26.796846000+09:00] failed to delete dead shim                    cmd="/Users/suda/.local/bin/containerd-shim-nerdbox-v1 -namespace default -address /var/run/containerd/containerd.sock -publish-binary /Users/suda/.local/bin/containerd -id 301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 -bundle /var/run/containerd/io.containerd.runtime.v2.task/default/301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 -debug delete" error="exit status 1" id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 namespace=default
WARN[2025-11-02T18:50:26.796931000+09:00] failed to clean up after shim disconnected    error="io.containerd.nerdbox.v1: open shim.pid: no such file or directory: exit status 1" id=301244933cdd01e26d052b7dbdb918ca4ced6f096b443680e597a8fe7d8d1b66 namespace=default

AkihiroSuda avatar Nov 02 '25 09:11 AkihiroSuda

Seems to be some path issue.

This workaround worked for running hello-world

diff --git a/internal/vm/libkrun/instance.go b/internal/vm/libkrun/instance.go
index a9f6809..cd341ae 100644
--- a/internal/vm/libkrun/instance.go
+++ b/internal/vm/libkrun/instance.go
@@ -126,7 +126,7 @@ func (*vmManager) NewInstance(ctx context.Context, state string) (vm.Instance, e
                state:      state,
                kernelPath: kernelPath,
                initrdPath: initrdPath,
-               streamPath: filepath.Join(state, "streaming.sock"),
+               streamPath: "/tmp/streaming.sock",
                lib:        lib,
                handler:    handler,
        }, nil
@@ -246,6 +246,7 @@ func (v *vmInstance) Start(ctx context.Context, opts ...vm.StartOpt) (err error)
        if err != nil {
                return fmt.Errorf("failed to get relative socket path: %w", err)
        }
+       socketPath = "/tmp/run_vminitd.sock"
        if err := v.vmc.AddVSockPort(1025, socketPath); err != nil {
                return fmt.Errorf("failed to add vsock port: %w", err)
        }

AkihiroSuda avatar Nov 02 '25 10:11 AkihiroSuda

related: https://github.com/containerd/nerdbox/pull/56

When you set libkrun's log level to warn, you can see issues with the length of the socket paths:

[2025-11-17T23:27:50Z WARN  devices::virtio::vsock::muxer_thread] Failed to create listening proxy at "../../../../../../../var/run/containerd/io.containerd.runtime.v2.task/default/ad8b7eb45b55b08b8732715f51a440aa0505f371033c778c99bcd98984599107/vm/run_vminitd.sock": CreatingSocket(ENAMETOOLONG)
[2025-11-17T23:27:50Z WARN  devices::virtio::vsock::muxer_thread] Failed to create listening proxy at "../../../../../../../var/run/containerd/io.containerd.runtime.v2.task/default/ad8b7eb45b55b08b8732715f51a440aa0505f371033c778c99bcd98984599107/vm/streaming.sock": CreatingSocket(ENAMETOOLONG)

Kern-- avatar Nov 17 '25 23:11 Kern--