diff --git a/docs/raspberry-pi4.md b/docs/raspberry-pi4.md index f3962ad2bdbe..96a4a21def1e 100644 --- a/docs/raspberry-pi4.md +++ b/docs/raspberry-pi4.md @@ -158,7 +158,9 @@ Operating system: Linux (pass) Linux kernel release: 5.15.0-1013-raspi (pass) Max. file descriptors per process: current: 1024 / max: 1048576 (warning: < 65536) AppArmor: unavailable (pass) - Executable in path: modprobe: /usr/sbin/modprobe (pass) + Executable in PATH: modprobe: /usr/sbin/modprobe (pass) + Executable in PATH: mount: /usr/bin/mount (pass) + Executable in PATH: umount: /usr/bin/umount (pass) /proc file system: mounted (0x9fa0) (pass) Control Groups: version 2 (pass) cgroup controller "cpu": available (pass) diff --git a/internal/pkg/sysinfo/host_linux.go b/internal/pkg/sysinfo/host_linux.go index 5bb26b3358e3..563474844fa9 100644 --- a/internal/pkg/sysinfo/host_linux.go +++ b/internal/pkg/sysinfo/host_linux.go @@ -42,7 +42,9 @@ func (s *K0sSysinfoSpec) addHostSpecificProbes(p probes.Probes) { linux.AssertAppArmor() if s.WorkerRoleEnabled { - probes.AssertExecutablesInPath(linux, "modprobe", "mount", "umount") + probes.AssertExecutableInPath(linux, "modprobe") + probes.AssertExecutableInPath(linux, "mount") + probes.AssertExecutableInPath(linux, "umount") linux.RequireProcFS() addCgroups(linux) } diff --git a/internal/pkg/sysinfo/probes/executables.go b/internal/pkg/sysinfo/probes/executables.go index 2422e9e5609b..a3a72777cf0d 100644 --- a/internal/pkg/sysinfo/probes/executables.go +++ b/internal/pkg/sysinfo/probes/executables.go @@ -21,18 +21,16 @@ import ( "os/exec" ) -func AssertExecutablesInPath(p Probes, executables ...string) { - for _, executable := range executables { - p.Set(fmt.Sprintf("executableInPath:%s", executable), func(path ProbePath, _ Probe) Probe { - return ProbeFn(func(r Reporter) error { - desc := NewProbeDesc(fmt.Sprintf("Executable in path: %s", executable), path) - path, err := exec.LookPath(executable) - if err != nil { - return r.Warn(desc, ErrorProp(err), "") - } +func AssertExecutableInPath(p Probes, executable string) { + p.Set(fmt.Sprintf("executableInPath:%s", executable), func(path ProbePath, _ Probe) Probe { + return ProbeFn(func(r Reporter) error { + desc := NewProbeDesc(fmt.Sprintf("Executable in PATH: %s", executable), path) + path, err := exec.LookPath(executable) + if err != nil { + return r.Warn(desc, ErrorProp(err), "") + } - return r.Pass(desc, StringProp(path)) - }) + return r.Pass(desc, StringProp(path)) }) - } + }) }