Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional checks for 9p support #20288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions pkg/minikube/detect/detect_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ package detect

import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"

"golang.org/x/sys/unix"
)
Expand Down Expand Up @@ -62,8 +64,29 @@ func IsNinePSupported() bool {
if runtime.GOOS != "linux" {
return true
}
_, err := os.Stat(getModuleRoot() + "/kernel/fs/9p")
return err == nil

if _, err := os.Stat(getModuleRoot() + "/kernel/fs/9p"); err == nil {
return true
}
// Try modprobe check (silent)
cmd := exec.Command("modprobe", "-q", "9p")
if err := cmd.Run(); err == nil {
return true
}
// Check if module is already loaded
loaded, err := is9PModuleLoaded()
if err == nil && loaded {
return true
}
return false
}
func is9PModuleLoaded() (bool, error) {
cmd := exec.Command("lsmod")
out, err := cmd.Output()
if err != nil {
return false, err
}
return strings.Contains(string(out), "9p"), nil
}

func getModuleRoot() string {
Expand Down
Loading