From 357f76daae80a0c16ace9149bd67c30d73c6a4f2 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 28 Jan 2025 13:44:14 -0600 Subject: [PATCH] error with libkrun on intel-based machines libkrun is not supported on Intel. We should error. Signed-off-by: Brent Baude --- cmd/podman/machine/machine.go | 5 +++++ pkg/machine/provider/platform_darwin.go | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go index 1dd65c1ec8..d7db502418 100644 --- a/cmd/podman/machine/machine.go +++ b/cmd/podman/machine/machine.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" "regexp" + "runtime" "strings" "sync" "time" @@ -15,6 +16,7 @@ import ( "github.com/containers/podman/v5/cmd/podman/registry" "github.com/containers/podman/v5/cmd/podman/validate" "github.com/containers/podman/v5/libpod/events" + "github.com/containers/podman/v5/pkg/machine/define" "github.com/containers/podman/v5/pkg/machine/env" provider2 "github.com/containers/podman/v5/pkg/machine/provider" "github.com/containers/podman/v5/pkg/machine/vmconfigs" @@ -57,6 +59,9 @@ func machinePreRunE(c *cobra.Command, args []string) error { if err != nil { return err } + if provider.VMType() == define.LibKrun && runtime.GOARCH == "amd64" { + return errors.New("libkrun is not supported on Intel based machines. Please revert to the applehv provider") + } return rootlessOnly(c, args) } diff --git a/pkg/machine/provider/platform_darwin.go b/pkg/machine/provider/platform_darwin.go index f4241d5b62..d15a11bdb7 100644 --- a/pkg/machine/provider/platform_darwin.go +++ b/pkg/machine/provider/platform_darwin.go @@ -43,10 +43,11 @@ func Get() (vmconfigs.VMProvider, error) { } func GetAll() []vmconfigs.VMProvider { - return []vmconfigs.VMProvider{ - new(applehv.AppleHVStubber), - new(libkrun.LibKrunStubber), + configs := []vmconfigs.VMProvider{new(applehv.AppleHVStubber)} + if runtime.GOARCH == "arm64" { + configs = append(configs, new(libkrun.LibKrunStubber)) } + return configs } // SupportedProviders returns the providers that are supported on the host operating system