Problems with multiple kernels and virtualbox kernel modules

Hi, Virtualbox is complaining that it cannot compile kernel modules. As a result I removed the Opensuse packages and installed the Oracle version - following some instructions on this site. But things did not improve. I seem to be using an older kernel despite having newer kernels installed - see below. So my system is not conducive to a good Virtualbox install. Can anyone shed some light on this? This box has been updated over a long time and appears to have accumulated older kernels and possibly some bad configurations.

The following NEW package is going to be installed:
VirtualBox-6.1

1 new package to install.
Overall download size: 0 B. Already cached: 88.4 MiB. After the operation, additional 197.4 MiB will be used.
Continue? [y/n/v/…? shows all options] (y):
In cache VirtualBox-6.1-6.1.4_136177_openSUSE150-1.x86_64.rpm (1/1), 88.4 MiB (197.4 MiB unpacked)

Checking for file conflicts: …[done]
(1/1) Installing: VirtualBox-6.1-6.1.4_136177_openSUSE150-1.x86_64 …[done]
Additional rpm output:
Unknown media type in type ‘all/all’
Unknown media type in type ‘all/allfiles’

Creating group ‘vboxusers’. VM users must be member of that group!

Created symlink /etc/systemd/system/multi-user.target.wants/vboxdrv.service -> /usr/lib/systemd/system/vboxdrv.service.
Created symlink /etc/systemd/system/multi-user.target.wants/vboxballoonctrl-service.service -> /usr/lib/systemd/system/vboxballoonctrl-service.service.
Created symlink /etc/systemd/system/multi-user.target.wants/vboxautostart-service.service -> /usr/lib/systemd/system/vboxautostart-service.service.
Created symlink /etc/systemd/system/multi-user.target.wants/vboxweb-service.service -> /usr/lib/systemd/system/vboxweb-service.service.
This system is currently not set up to build kernel modules.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-default-devel kernel-default-devel-4.12.14-lp150.12.25
This system is currently not set up to build kernel modules.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-default-devel kernel-default-devel-4.12.14-lp150.12.25

================================================

zypper se -si virtualbox kernel-default
Loading repository data…
Reading installed packages…

S | Name | Type | Version | Arch | Repository
—±---------------------±--------±---------------------------±-------±-------------------------
i+ | VirtualBox-6.1 | package | 6.1.4_136177_openSUSE150-1 | x86_64 | (System Packages)
i+ | kernel-default | package | 4.12.14-lp150.12.25.1 | x86_64 | (System Packages)
i+ | kernel-default | package | 4.12.14-lp151.28.44.1 | x86_64 | openSUSE:Leap:15.1:Update
i+ | kernel-default | package | 4.12.14-lp151.28.44.1 | x86_64 | Main Update Repository
i+ | kernel-default | package | 4.12.14-lp151.28.40.1 | x86_64 | openSUSE:Leap:15.1:Update
i+ | kernel-default | package | 4.12.14-lp151.28.40.1 | x86_64 | Main Update Repository
i+ | kernel-default-devel | package | 4.12.14-lp151.28.44.1 | x86_64 | openSUSE:Leap:15.1:Update
i+ | kernel-default-devel | package | 4.12.14-lp151.28.44.1 | x86_64 | Main Update Repository
i+ | kernel-default-devel | package | 4.12.14-lp151.28.40.1 | x86_64 | openSUSE:Leap:15.1:Update
i+ | kernel-default-devel | package | 4.12.14-lp151.28.40.1 | x86_64 | Main Update Repository

Hi
Have you booted the system with the latest kernel (4.12.14-lp151.28.44-default)?

You’re missing dependencies to build kernel modules.
First, make you’re booted using the kernel you wish to use regularly.
The following is a common recipe to build kernel modules for anything and is somewhat common (but depends of course what you do)

zypper in kernel-devel kernel-default-devel gcc make

After the above,
Re-run your Oracle Virtualbox installation.

TSU

My kernel…

uname -r
4.12.14-lp150.12.25-default

This seems to be at odds with my earlier posts showing kernel lp151.x.x as being installed.

Your recommended dependencies are installed.

zypper in kernel-devel kernel-default-devel gcc make
Loading repository data…
Reading installed packages…
‘make’ is already installed.
No update candidate for ‘make-4.2.1-lp151.7.39.x86_64’. The highest available version is already installed.
‘gcc’ is already installed.
No update candidate for ‘gcc-7-lp151.3.5.x86_64’. The highest available version is already installed.
‘kernel-devel’ is already installed.
No update candidate for ‘kernel-devel-4.12.14-lp151.28.44.1.noarch’. The highest available version is already installed.
‘kernel-default-devel’ is already installed.
No update candidate for ‘kernel-default-devel-4.12.14-lp151.28.44.1.x86_64’. The highest available version is already installed.
Resolving package dependencies…

Does this mean I am somehow booting into the wrong kernel?

Yes, you are booting an old kernel, likely from a previous LEAP 15.0 install that you upgraded to 15.1.
Either your GRUB configuration was not updated or something else went wrong during the upgrade.
Check if you are able to boot a lp151 kernel from your GRUB menu, otherwise there is no way to find or build matching VBox modules.

If your kernel and kernel development header package names are not the same (It rarely happens)
Then you simply need to update your system to bring both into sync with each other

When running LEAP

zypper up

When runnibg TW

zypper dup

Then, you <may> need to reboot.
And then try to run your install that requires building the new kernel modules

TSU

Tried this without any result

zypper up
Loading repository data…
Reading installed packages…

The following 11 package updates will NOT be installed:
libatomic1 libgcc_s1 libgomp1 libitm1 liblsan0 libmpx2 libmpxwrappers2 libquadmath0 libstdc++6 libtsan0 libzen0

Nothing to do.

Kernels Lp151.x.x are not available on the Grub Menu. They do not show at all.

The Kernel 4.12.14-lp150.12.25-default and one older kernel are showing in the Grub Menu.

Either the newer kernels are not installed or GRUB was not upgraded: is this a multi-boot system (as in “grub is not controlled by the OS you are trying to fix”)?
Please show (the few first lines of):

zypper se -us kernel-default

and, from the problematic system, the result of:

sudo cat /boot/grub2/grub.cfg |grep vmlinuz

Yes it is a multiboot system. Sorry about this long paste - its not a good look.

zypper se -us kernel-default
Retrieving repository ‘openSUSE:Leap:15.1:Update’ metadata …[done]
Building repository ‘openSUSE:Leap:15.1:Update’ cache …[done]
Retrieving repository ‘Main Update Repository’ metadata …[done]
Building repository ‘Main Update Repository’ cache …[done]
Loading repository data…
Reading installed packages…

S | Name | Type | Version | Arch | Repository
–±---------------------±-----------±----------------------±-------±-------------------------
v | kernel-default | package | 4.12.14-lp151.28.36.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.36.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.32.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.32.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.25.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.25.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.20.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.20.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.16.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.16.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.13.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.13.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.10.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.10.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.7.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.7.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.28.4.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default | package | 4.12.14-lp151.28.4.1 | x86_64 | Main Update Repository
v | kernel-default | package | 4.12.14-lp151.27.3 | x86_64 | Main Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.44.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.44.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.40.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.40.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.36.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.36.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.32.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.32.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.25.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.25.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.20.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.20.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.16.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.16.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.13.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.13.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.10.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.10.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.7.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.7.1 | noarch | Main Update Repository
| kernel-default | srcpackage | 4.12.14-lp151.28.4.1 | noarch | openSUSE:Leap:15.1:Update
| kernel-default | srcpackage | 4.12.14-lp151.28.4.1 | noarch | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.44.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.44.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.40.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.40.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.36.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.36.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.32.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.32.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.25.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.25.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.20.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.20.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.16.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.16.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.13.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.13.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.10.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.10.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.7.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.7.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.28.4.1 | x86_64 | openSUSE:Leap:15.1:Update
| kernel-default-base | package | 4.12.14-lp151.28.4.1 | x86_64 | Main Update Repository
| kernel-default-base | package | 4.12.14-lp151.27.3 | x86_64 | Main Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.36.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.36.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.32.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.32.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.25.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.25.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.20.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.20.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.16.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.16.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.13.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.13.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.10.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.10.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.7.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.7.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.28.4.1 | x86_64 | openSUSE:Leap:15.1:Update
v | kernel-default-devel | package | 4.12.14-lp151.28.4.1 | x86_64 | Main Update Repository
v | kernel-default-devel | package | 4.12.14-lp151.27.3 | x86_64 | Main Repository

=================================================================================

cat /boot/grub2/grub.cfg |grep vmlinuz |grep -v -e root=* … note the shortened search. The original search was too long.

    menuentry 'openSUSE Leap 42.3 (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.162-78-default--e9e3883b-e0e0-4b10-9a4f-199cc564c82a' {
    menuentry 'openSUSE Leap 42.3, with Linux 4.4.162-78-default (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.162-78-default--e9e3883b-e0e0-4b10-9a4f-199cc564c82a' {
    menuentry 'openSUSE Leap 42.3, with Linux 4.4.162-78-default (recovery mode) (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.162-78-default--e9e3883b-e0e0-4b10-9a4f-199cc564c82a' {
    menuentry 'openSUSE Leap 42.3, with Linux 4.4.159-73-default (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.159-73-default--e9e3883b-e0e0-4b10-9a4f-199cc564c82a' {
    menuentry 'openSUSE Leap 42.3, with Linux 4.4.159-73-default (recovery mode) (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.159-73-default--e9e3883b-e0e0-4b10-9a4f-199cc564c82a' {
    menuentry 'openSUSE (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.16.7-29-desktop--ecdd2bf1-9b09-467d-9594-45789eb6cfd7' {
    menuentry 'openSUSE, with Linux 3.16.7-29-desktop (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.16.7-29-desktop--ecdd2bf1-9b09-467d-9594-45789eb6cfd7' {
    menuentry 'openSUSE, with Linux 3.16.7-29-desktop (recovery mode) (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.16.7-29-desktop--ecdd2bf1-9b09-467d-9594-45789eb6cfd7' {
    menuentry 'openSUSE, with Linux 3.16.7-24-desktop (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.16.7-24-desktop--ecdd2bf1-9b09-467d-9594-45789eb6cfd7' {
    menuentry 'openSUSE, with Linux 3.16.7-24-desktop (recovery mode) (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.16.7-24-desktop--ecdd2bf1-9b09-467d-9594-45789eb6cfd7' {

The system works ok and just recently booted into the openSUSE 42.3 system. But legacy hard drives and Operating Systems have clogged this linux box.

Apparently everything is OK with the Leap 15.1 system you are trying to fix, but you need to boot the system that controls the GRUB bootloader and update the GRUB configuration.
If it is an openSUSE system issuing:

sudo grub-mkconfig -o /boot/grub2/grub.cfg

should do the trick, otherwise follow directions from the distro that controls your bootloader.

For a temporary check you can also:
reboot
select the Leap 15.1 menu entry, press “E” to edit the boot command line
look for the line beginning with “linux” (or “linuxefi”)
replace “vmlinuz-4.12.14-lp150.12.25-default” with just “vmlinuz”
replace “initrd-4.12.14-lp150.12.25-default” with “initrd” in the following line
press F10 to boot

after boot, check that you are indeed running kernel 4.12.14-lp151.28.44-default, try and rebuild VBox modules,everything should play as expected.

On the following Oracle Virtualbox Download page,

https://www.virtualbox.org/wiki/Linux_Downloads

Do <not> click on the openSUSE 15 link,
Continue down the list to the “All distributions…” link, and do a “save as…” to your machine.
Then execute that “.run” binary in a console to install Virtualbox.

TSU

Thanks Tsu2, thanks OrsoBruno. This issue is resolved after running

grub2-mkconfig -o /boot/grub2/grub.cfg

The command had to be run on the hard disk that housed the boot partition. In my case this was my old OpenSuse 42.3 system, running on a separate hard drive.

After running this command I was able to boot into the latest Leap 15.1 kernel. It followed that Virtualbox started immediately and ran as per normal.

Nice to read that you are up and running again.
That is a common pitfall on multi-booting systems: after any kernel update GRUB must be updated on the system controlling the boot process, or a custom configuration using generic symlinks like “vmlinuz” and “initrd” may be used instead to boot the last kernel installed.