To check for kernel headers and install them if necessary on SUSE and OpenSUSE systems, perform the following steps.
Prerequisites
Procedure
- To determine whether kernel headers are installed, run the following command:
$ sudo zypper search -si kernel-default-devel | grep $(uname -r | sed "s/-default//")
If the package is installed, the output will be similar to the following. An
i
ori+
in the left column signifies that the package is installed.i+ kernel-default-devel | package | <version> | <arch> | <repository>
- To determine whether the kernel headers are available to install, run the following command:
$ sudo zypper search -s kernel-default-devel | grep $(uname -r | sed "s/-default//")
If the package is available, the output will be similar to the following. A
v
in the left column signifies that the package is available.v kernel-default-devel | package | 4.12.14-lp150.12.25.1 | x86_64 | openSUSE-Leap-15.0-Update
- To install any necessary available kernel headers, run the following command:
$ sudo zypper install --oldpackage kernel-default-devel=$(uname -r | sed "s/-default//")
- If the kernel headers packages are not installed and are not available, update the kernel to a supported version and install the matching kernel headers.
Note: This action requires a reboot.
- To list the available kernel and kernel header packages and find matching versions, run the following command:
$ sudo zypper search -s kernel-default kernel-default-devel | egrep "(^v|^S)"
If newer packages are available, the output will be similar to the following:
S Name Type Version Arch Repository v kernel-default package <newer-version> <arch> <repo> ... v kernel-default-devel package <newer-version> <arch> <repo> - To install a newer supported kernel and kernel header packages with matching versions, run the following command:
% sudo zypper install kernel-default=<newer-version> kernel-default-devel=<newer-version>
- Reboot into the new kernel.
Note: If you cannot find a newer kernel to upgrade to by following this method, you might need to upgrade to a newer service pack or migrate to a newer release. - To list the available kernel and kernel header packages and find matching versions, run the following command: