From d7652481971abcd3c33605d9c96435e1940779bc Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Sun, 16 Nov 2025 15:43:19 -0800 Subject: [PATCH 1/2] Prefer non-efi variant The EFI variant in 1.16.0 throws an error. Prefer the 1.15.1 non-EFI variant. Signed-off-by: Derek McGowan --- internal/vm/libkrun/instance.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/vm/libkrun/instance.go b/internal/vm/libkrun/instance.go index a9f6809..a19f4a3 100644 --- a/internal/vm/libkrun/instance.go +++ b/internal/vm/libkrun/instance.go @@ -26,6 +26,7 @@ import ( "os" "path/filepath" "runtime" + "strings" "sync" "sync/atomic" "syscall" @@ -62,9 +63,9 @@ func (*vmManager) NewInstance(ctx context.Context, state string) (vm.Instance, e if len(p2) == 0 { p2 = []string{"/usr/local/lib", "/usr/lib", "/lib"} } - sharedName := "libkrun.so" + sharedNames := []string{"libkrun.so"} if runtime.GOOS == "darwin" { - sharedName = "libkrun-efi.dylib" + sharedNames = []string{"libkrun.dylib", "libkrun-efi.dylib"} p2 = append(p2, "/opt/homebrew/lib") } @@ -75,9 +76,12 @@ func (*vmManager) NewInstance(ctx context.Context, state string) (vm.Instance, e } var path string if krunPath == "" { - path = filepath.Join(dir, sharedName) - if _, err := os.Stat(path); err == nil { - krunPath = path + for _, sharedName := range sharedNames { + path = filepath.Join(dir, sharedName) + if _, err := os.Stat(path); err == nil { + krunPath = path + break + } } } if kernelPath == "" { @@ -94,7 +98,7 @@ func (*vmManager) NewInstance(ctx context.Context, state string) (vm.Instance, e } } if krunPath == "" { - return nil, fmt.Errorf("%s not found in PATH or LIBKRUN_PATH", sharedName) + return nil, fmt.Errorf("%s not found in PATH or LIBKRUN_PATH", strings.Join(sharedNames, " or ")) } if kernelPath == "" { return nil, fmt.Errorf("nerdbox-kernel not found in PATH or LIBKRUN_PATH") From 3a38972775b958f0bc3fb1ab0b067df50781d68f Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Sun, 16 Nov 2025 15:47:48 -0800 Subject: [PATCH 2/2] Update README for libkrun installation Signed-off-by: Derek McGowan --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8431710..b936a84 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,12 @@ Install libkrun, erofs-utils, e2fsprogs on your host > Use brew to install libkrun, erofs-utils, and e2fsprogs > > ``` -> brew tap slp/krunkit -> brew install libkrun-efi erofs-utils e2fsprogs +> brew tap slp/krun +> brew install libkrun erofs-utils e2fsprogs > ``` +> +> `libkrun-efi` fails to load with the 1.16.0 release. Both `libkrun` and `libkrun-efi` +> may be installed at the same time, but you may need to run `brew link libkrun`. Run containerd with the shim and nerdbox components in the PATH: