Why can't I never(TM) get Virtualbox to work on TW...

… even if I install from the official repos?

Once I run it and try to start a VM it gives me an error that /sbin/vboxconfig needs to be run.
This command however I cannot run because some packages are missing. But even after installing them /sbin/vboxconfig fails because:

=== Building 'vboxdrv' module ===
make[1]: Entering directory '/usr/src/kernel-modules/virtualbox/src/vboxdrv'
/usr/src/kernel-modules/virtualbox/src/vboxdrv/Makefile.include.header:141: *** Error: unable to find the headers of the Linux kernel to build against. Specify KERN_VER=<version> (currently 4.15.1-1-default) and run Make again.  Stop.
make[1]: Leaving directory '/usr/src/kernel-modules/virtualbox/src/vboxdrv'
make: *** [Makefile:49: all] Error 2


The error is probably due to a mismatch of Kernel versions:


S  | Name                        | Type    | Version             | Arch   | Repository             
---+-----------------------------+---------+---------------------+--------+------------------------
i+ | kernel-default              | package | 4.15.1-1.6          | x86_64 | (System Packages)      
i+ | kernel-default              | package | 4.15.2-1.4          | x86_64 | openSUSE-Tumbleweed-Oss
i  | kernel-default-devel        | package | 4.15.2-1.4          | x86_64 | openSUSE-Tumbleweed-Oss
i  | kernel-devel                | package | 4.15.2-1.4          | noarch | openSUSE-Tumbleweed-Oss
i+ | kernel-firmware             | package | 20180119-1.1        | noarch | openSUSE-Tumbleweed-Oss
i  | kernel-macros               | package | 4.15.2-1.4          | noarch | openSUSE-Tumbleweed-Oss
i+ | virtualbox                  | package | 5.2.6-2.4           | x86_64 | openSUSE-Tumbleweed-Oss
i  | virtualbox-host-kmp-default | package | 5.2.6_k4.15.2_1-2.4 | x86_64 | openSUSE-Tumbleweed-Oss
i+ | virtualbox-host-source      | package | 5.2.6-2.4           | noarch | openSUSE-Tumbleweed-Oss
i  | virtualbox-qt               | package | 5.2.6-2.4           | x86_64 | openSUSE-Tumbleweed-Oss


How can I fix this and why is this happening with the official TW repo? Is there a way to prevent this from happening in the future?
And on a technical side note, what does this have to do with the kernel? Why doesn’t this happen on Windows for instance?

Thanks.

To install the development headers of anything, you need to install the “devel” packages.

In your case, you should install the following packages for the default kernel which you are running (Exact versions will be matched automatically)

kernel-devel
kernel-default-devel

Then you should be able to build your kernel modules.

When you install VBox from teh OSS instead of the Oracle download, you shouldn’t need to build these modules, but you may want to add your User to the vboxuers group so you can run VBox as a normal user without elevated permissions.

If you aren’t able to install and run VBox from the OSS, perhaps you didn’t upgrade your TW just before installing VBox?

TSU

That shouldn’t be necessary if you install the openSUSE packages though.
These do contain a precompiled kernel module.

And that should be preferred especially on Tumbleweed anyway IMHO, because of the many kernel updates.

IOW, if you install the virtualbox packages from the standard repos, you don’t have to (and shouldn’t) run /sbin/vboxconfig…
If VirtualBox asks you to run it, please post the exact message from VirtualBox.

And the output of this command:

rpm -qa | egrep -i "virtualbox | kernel"

On Mon, 12 Feb 2018 20:06:02 +0000, SF6 wrote:

> And on a technical side note, what does this have to do with the kernel?
> Why doesn’t this happen on Windows for instance?

The networking drivers are implemented as kernel modules. Windows’
kernel is very different architecturally from the Linux kernel.

What I found over the weekend was that if the running kernel and the
installed kernel dev packages don’t match, you’ll have problems
compiling. Make sure you’ve got the right version installed.

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Step by step what I have done:

  1. Updated the system sudo zypper dup
  2. Installed Virtualbox via Yast/Softwaremanager (from vendor openSUSE)
  3. Added my user david to vboxusers
  4. rebootet
  5. Started Virtualbox and set up a virtual drive and I get the following error:
 Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

'/sbin/vboxconfig'

as root.

where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT. 


I followed the hint in the error message, ran /sbin/vboxconfig which also failed because of missing packages. I copied the packages that were mentioned in the bash error message and ran /sbin/vboxconfig again which failed again - see first post.

rpm -qa | egrep -i "virtualbox | kernel"

Doesn’t give me any result back? :frowning:

First run ‘zypper dup’ if you haven’t already
Next. check permissions of /usr/lib/virtualbox/Virtualbox, it should be 4755, if it isn’t chmod it

/usr/lib/virtualbox/VirtualBox

shows

-rwsr-x--- 1 root vboxusers 158336 Feb 11 02:11 /usr/lib/virtualbox/VirtualBox


I belong to vboxusers group. Still need to correct?
zypper dup doesn’t show any updates.

david@linux-w3cc:~> groups david
david : users vboxusers

Thank you.

No update candidate for 'kernel-devel-4.15.2-1.4.noarch'. The highest available version is already installed.
'kernel-default-devel' is already installed.
No update candidate for 'kernel-default-devel-4.15.2-1.4.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Seems like I cannot find a matching version for kernel-devel and kernel-default?

Again, this shouldn’t matter if you install the openSUSE packages, the kernel-devel* packages are not needed then.

You should uninstall any VirtualBox* package first though.
So try this:

sudo zypper rm VirtualBox*
sudo zypper in -f virtualbox virtualbox-kmp-default

Sorry, my previous command was slightly wrong, it should have been:

rpm -qa | egrep -i "virtualbox|kernel"

(I didn’t expect the spaces to have any influence there, my fault… :wink: )

Here’s the output **before **I uninstall virtualbox like you suggested.

virtualbox-5.2.6-2.4.x86_64
kernel-devel-4.15.2-1.4.noarch
kernel-default-4.15.2-1.4.x86_64
virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64
virtualbox-host-source-5.2.6-2.4.noarch
kernel-firmware-20180119-1.1.noarch
kernel-macros-4.15.2-1.4.noarch
kernel-default-devel-4.15.2-1.4.x86_64
virtualbox-qt-5.2.6-2.4.x86_64
kernel-default-4.15.1-1.6.x86_64


Hm’ getting an error when trying to unisntall/install virtualbox:

david@linux-w3cc:~> sudo zypper rm virtualbox*
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 4 packages are going to be REMOVED:
  virtualbox virtualbox-host-kmp-default virtualbox-host-source virtualbox-qt

4 packages to remove.
After the operation, 69.1 MiB will be freed.
Continue? [y/n/...? shows all options] (y): y

(1/4) Removing virtualbox-host-source-5.2.6-2.4.noarch ...............................................................................................................................................................................................[done]
(2/4) Removing virtualbox-qt-5.2.6-2.4.x86_64 ........................................................................................................................................................................................................[done]
(3/4) Removing virtualbox-5.2.6-2.4.x86_64 ...........................................................................................................................................................................................................[done]
(4/4) Removing virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64 ................................................................................................................................................................................[done]
Additional rpm output:
**cat: write error: Broken pipe       **                                                                                                                                                                                                                        

david@linux-w3cc:~> sudo zypper in -f virtualbox virtualbox-kmp-default
Loading repository data...
Reading installed packages...
Package 'virtualbox-kmp-default' not found.
Forcing installation of 'virtualbox-5.2.6-2.4.x86_64' from repository 'openSUSE-Tumbleweed-Oss'.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  virtualbox virtualbox-host-kmp-default virtualbox-qt

The following recommended package was automatically selected:
  virtualbox-qt

3 new packages to install.
Overall download size: 20.2 MiB. Already cached: 0 B. After the operation, additional 64.3 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64                                                                                                                                              (1/3), 415.4 KiB (845.6 KiB unpacked)
Retrieving: virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64.rpm ...............................................................................................................................................................................[done]
Retrieving package virtualbox-5.2.6-2.4.x86_64                                                                                                                                                                         (2/3),  11.8 MiB ( 35.6 MiB unpacked)
Retrieving: virtualbox-5.2.6-2.4.x86_64.rpm ..........................................................................................................................................................................................................[done]
Retrieving package virtualbox-qt-5.2.6-2.4.x86_64                                                                                                                                                                      (3/3),   8.1 MiB ( 27.8 MiB unpacked)
Retrieving: virtualbox-qt-5.2.6-2.4.x86_64.rpm .......................................................................................................................................................................................................[done]
Checking for file conflicts: .........................................................................................................................................................................................................................[done]
(1/3) Installing: virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64 .............................................................................................................................................................................[done]
**Additional rpm output:
cat: write error: Broken pipe**


(2/3) Installing: virtualbox-5.2.6-2.4.x86_64 ........................................................................................................................................................................................................[done]
Additional rpm output:
setting /usr/lib/virtualbox/VBoxNetNAT to root:vboxusers 4750. (wrong permissions 0755)
setting /usr/lib/virtualbox/VBoxNetDHCP to root:vboxusers 4750. (wrong permissions 0750)
setting /usr/lib/virtualbox/VBoxNetAdpCtl to root:vboxusers 4750. (wrong permissions 0750)
setting /usr/lib/virtualbox/VBoxHeadless to root:vboxusers 4750. (wrong permissions 0750)


(3/3) Installing: virtualbox-qt-5.2.6-2.4.x86_64 .....................................................................................................................................................................................................[done]
Additional rpm output:
setting /usr/lib/virtualbox/VirtualBox to root:vboxusers 4750. (wrong permissions 0750)
setting /usr/lib/virtualbox/VBoxSDL to root:vboxusers 4750. (wrong permissions 0750)


Installation has completed with error.


Seems like you’re right and there is some issue with permissions. :frowning:

I suppose that’s the problem, especially if you already compiled the kernel module yourself previously.
Try to uninstall that.

Although I’m not sure whether this would actually remove a self-compiled kernel module, I suppose not.
What does this command give?

find /lib/modules/ -name vboxdrv.ko

That shouldn’t cause an error about the vboxdrv kernel module though.

Btw, to use VirtualBox (as user), the user needs to be a member of the group “vboxusers”. Is that the case?
You should get a specific error message if not though, at least that’s how it was in the past.

Any reason why you still have kernel-default-4.15.1-1.6.x86_64 installed.

virtualbox-5.2.6-2.4.x86_64
kernel-devel-4.15.2-1.4.noarch
kernel-default-4.15.2-1.4.x86_64
virtualbox-host-kmp-default-5.2.6_k4.15.2_1-2.4.x86_64
virtualbox-host-source-5.2.6-2.4.noarch
kernel-firmware-20180119-1.1.noarch
kernel-macros-4.15.2-1.4.noarch
kernel-default-devel-4.15.2-1.4.x86_64
virtualbox-qt-5.2.6-2.4.x86_64
kernel-default-4.15.1-1.6.x86_64

Likely because openSUSE keeps the latest two kernels installed by default… :wink:

Although, it would probably be a good idea to check whether 4.15.2 is actually used, as virtualbox-host-kmp-default is only installed for that one and might not work with the previous one.

uname -a

First run


zypper dup

again, then reboot. Next use YaST - System - Servicesmanager to start the Virtualbox service. And, indeed make sure your user is a member of the vboxusers group

Well, I noticed this in the compilation errors in the first post now:

Specify KERN_VER=<version> (currently 4.15.1-1-default) and run Make again.

So it seems that indeed kernel 4.15.1 is running. (and kernel*-devel 4.15.1 is not installed, so the compilation fails)

Just rebooting to kernel 4.15.2 should fix the problem then I suppose.

Thanks for all your help. I don’t know, it works now. I reinstalled it like three times, rebooted, used three zypper dups and now it works.

It must have been the kernel. Maybe when I installed the first time I ran zypper dup after I had installed virtualbox and then at this moment came a new kernel and things got messed up?

So for the future (assuming I have not added any repositories) I should do it this way:

  1. Zypper dup
  2. If new kernel, reboot
  3. Zypper in virtualbox
  4. Add user to vboxuser
  5. logout/login
  6. Everything should be fine.

What happens when the next kernel comes along?

Unlikely.
virtualbox-host-kmp-default should always be updated as well whenever the kernel gets updated.

It seems you still booted the old kernel though for some reason.

  1. Zypper in virtualbox

That’s only necessary if virtualbox isn’t installed yet though.
Not when you just update your system.

  1. Add user to vboxuser

That’s also not necessary on updates, only if it is a new installation or user.

What happens when the next kernel comes along?

It should just work.