Skip to content
Open
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: 4 additions & 1 deletion pkg/cluster/manager/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,10 @@ func fixFailedChecks(host string, res *operator.CheckResult, t *task.Builder, sy
case operator.CheckNameTHP:
t.Shell(host,
fmt.Sprintf(
`if [ -d %[1]s ]; then echo never > %[1]s/enabled; fi && %s`,
// grubby only exists on RHEL-family distros; skip the persistent
// kernel argument when it's not available (e.g. Debian/Ubuntu)
// instead of failing the whole apply.
`if [ -d %[1]s ]; then echo never > %[1]s/enabled; fi && if command -v grubby >/dev/null 2>&1; then %s; fi`,
"/sys/kernel/mm/transparent_hugepage",
`grubby --update-kernel=ALL --args="transparent_hugepage=never"`,
),
Expand Down
10 changes: 8 additions & 2 deletions pkg/cluster/operation/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,15 @@ func CheckSELinuxStatus(ctx context.Context, e ctxt.Executor, sudo bool) *CheckR
Command: "getenforce",
Sudo: sudo,
})
stdout, stderr, err := m.Execute(ctx, e)
stdout, _, err := m.Execute(ctx, e)
if err != nil {
result.Err = fmt.Errorf("%w %s", err, stderr)
// getenforce is unavailable (e.g. SELinux userspace tools are not
// installed, as on most Debian/Ubuntu hosts), which means SELinux is
// not enforcing on this host. Treat it as disabled rather than a
// failure, so we don't trigger a fix that edits a non-existent
// /etc/selinux/config. The configuration is still checked separately
// by CheckSELinuxConf.
result.Msg = "getenforce not available, assuming SELinux is disabled"
return result
}
out := strings.Trim(string(stdout), "\n")
Expand Down
Loading