diff --git a/pkg/util/kernel/find_headers.go b/pkg/util/kernel/find_headers.go index 245e582bad16b..e505ef432d6e8 100644 --- a/pkg/util/kernel/find_headers.go +++ b/pkg/util/kernel/find_headers.go @@ -36,6 +36,8 @@ const kernelModulesPath = "/lib/modules/%s/build" const debKernelModulesPath = "/lib/modules/%s/source" const cosKernelModulesPath = "/usr/src/linux-headers-%s" const centosKernelModulesPath = "/usr/src/kernels/%s" +const opensuseKernelDevelPath = "/usr/src/linux-%s" +const opensuseKernelFlavorDevelPath = "/usr/src/linux-%s-obj" var versionCodeRegexp = regexp.MustCompile(`^#define[\t ]+LINUX_VERSION_CODE[\t ]+(\d+)$`) @@ -366,12 +368,25 @@ func getDefaultHeaderDirs() []string { return []string{} } - return []string{ + paths := []string{ fmt.Sprintf(kernelModulesPath, hi), fmt.Sprintf(debKernelModulesPath, hi), fmt.Sprintf(cosKernelModulesPath, hi), fmt.Sprintf(centosKernelModulesPath, hi), } + + // opensuse special case + flavourIndex := strings.LastIndex(hi, "-") + if flavourIndex != -1 { + opensuseKernelRelease := hi[:flavourIndex] + paths = append( + paths, + fmt.Sprintf(opensuseKernelDevelPath, opensuseKernelRelease), + fmt.Sprintf(opensuseKernelFlavorDevelPath, opensuseKernelRelease), + ) + } + + return paths } func getDownloadedHeaderDirs(headerDownloadDir string) []string {