Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions cmd/minikube/cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ var mountCmd = &cobra.Command{
cfg.Options[parts[0]] = parts[1]
}

if runtime.GOOS == "linux" && !detect.IsNinePSupported() {
exit.Message(reason.HostUnsupported, "The host does not support filesystem 9p.")

}

// An escape valve to allow future hackers to try NFS, VirtFS, or other FS types.
if !supportedFilesystems[cfg.Type] {
out.WarningT("{{.type}} is not yet a supported filesystem. We will try anyways!", out.V{"type": cfg.Type})
Expand Down
29 changes: 29 additions & 0 deletions pkg/minikube/detect/detect_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ limitations under the License.
package detect

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

"golang.org/x/sys/unix"
Expand Down Expand Up @@ -54,3 +56,30 @@ func cgroupVersion() string {
return ""
}
}

func IsNinePSupported() bool {
// assume true from non-linux
if runtime.GOOS != "linux" {
return true
}
_, err := os.Stat(getModuleRoot() + "/kernel/fs/9p")
return err == nil
}

func getModuleRoot() string {
// assume true from non-linux
if runtime.GOOS != "linux" {
return ""
}
uname := unix.Utsname{}
if err := unix.Uname(&uname); err != nil {
return ""
}

i := 0
for ; uname.Release[i] != 0; i++ {
continue
}
return filepath.Join("/lib/modules", string(uname.Release[:i]))

}
5 changes: 5 additions & 0 deletions pkg/minikube/detect/detect_nonlinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ package detect
func cgroupVersion() string {
return "v1"
}

// Assume 9p is supported by non linux apps
func IsNinePSupported() bool {
return true
}
2 changes: 2 additions & 0 deletions pkg/minikube/reason/reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ var (
HostPurge = Kind{ID: "HOST_PURGE", ExitCode: ExHostError}
// minikube failed to persist profile config
HostSaveProfile = Kind{ID: "HOST_SAVE_PROFILE", ExitCode: ExHostConfig}
// Host doesn't support 9p
HostUnsupported = Kind{ID: "HOST_UNSUPPORTED", ExitCode: ExHostUnsupported}

// minikube could not find a provider for the selected driver
ProviderNotFound = Kind{ID: "PROVIDER_NOT_FOUND", ExitCode: ExProviderNotFound}
Expand Down