VirtualBox kernel modules will not load on boot (even with dkms)

There are a number of small bugs with VirtualBox in Cooker and one kind of big one.

$ rpm -qa | grep virtual
dkms-virtualbox-5.2.22-1.x86_64
qt5-qtvirtualkeyboard-5.11.2-2.x86_64
virtualbox-5.2.22-1.x86_64

The big one is that kernel modules do not load on boot. I have to modprobe them every time I reboot. I tried adding them to /etc/modprobe.preload.d/modprobe-preload.conf and that did not work. Then as you see I tried installing dkms-virtualbox. Well that won’t work currently because:

Preinstalling packages needed for building kernel modules. Please wait... 

  Installing       : dkms-2.6.1-5.noarch                                                                                                                                2/3 
  Running scriptlet: dkms-2.6.1-5.noarch                                                                                                                                2/3 
Failed to try-restart fedora-loadmodules.service: Unit fedora-loadmodules.service not found.
warning: %post(dkms-2.6.1-5.noarch) scriptlet failed, exit status 5

Error in POSTIN scriptlet in rpm package dkms
Installed: dkms-2.6.1-5.noarch
Installed: dkms-virtualbox-5.2.22-1.x86_64
  Installing       : dkms-virtualbox-5.2.22-1.x86_64                                                                                                                    3/3 
  Running scriptlet: dkms-virtualbox-5.2.22-1.x86_64                                                                                                                    3/3 
+ /usr/sbin/dkms --rpm_safe_upgrade add -m virtualbox -v 5.2.22-1

Creating symlink /var/lib/dkms/virtualbox/5.2.22-1/source ->
                 /usr/src/virtualbox-5.2.22-1

DKMS: add completed.
+ /usr/sbin/dkms --rpm_safe_upgrade build -m virtualbox -v 5.2.22-1

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....(bad exit status: 2)
./vboxbuild /lib/modules/4.19.2-desktop-2omv4000/build........
/usr/sbin/dkms: line 1418: /var/lib/dkms/virtualbox/5.2.22-1///module/symvers.gz: No such file or directory
cleaning build area....(bad exit status: 2

Complete output of ‘dnf install dkms-virtualbox’:

dkms-virtualbox.txt (6.8 KB)

So apparently we need fedora-loadmodules.service? I’m wondering what made it go away I had it about a week or 10 days ago.

# systemctl status fedora-loadmodules.service
Unit fedora-loadmodules.service could not be found.

Note: Also even if dkms-virtualbox did work it is missing vboxpci module which according to @Colin we need in OpenMandriva for all VBox features to work. This needs to be looked at as well.

Note-2: make.log says “ERROR: Kernel configuration is invalid.”

make.log.txt (287.7 KB)

So how things are working now is that when I first boot in to Cooker if I run:

# lsmod | grep vbox

there is no output and VirtualBox will not run VM’s. If I:

# modprobe vboxdrv && modprobe vboxpci && modprobe vboxnetflt && modprobe vboxnetflt

then:

# lsmod | grep vbox
vboxpci                28672  0
vboxnetadp             28672  0
vboxnetflt             32768  0
vboxdrv               479232  3 vboxpci,vboxnetadp,vboxnetflt

and now VirtualBox will run VM’s.

Two or the more minor bugs are in this here and here. They are minor and don’t affect usability of VirtualBox.

Duh, is this a typo?

Failed to try-restart fedora-loadmodules.service: Unit fedora-loadmodules.service not found.

fedora-load-modules.service? Don’t have that either and I’ve checked on 2 computers.

# systemctl status fedora-load-modules
Unit fedora-load-modules.service could not be found.

# systemctl status fedora-loadmodules
Unit fedora-loadmodules.service could not be found.

I looked in:

# systemctl list-unit-files

and there is no longer any fedora-whatever.services at all. I realize this may not be all that is wrong with the loading of VirtualBox kernel modules.

I’m told that devs are working on a fix for this.

Note: For most users of VirtualBox on your host machine only ‘vboxdrv’ is mandatory for VBox to work. I have verified that on a Cooker host machine. What the others are for (From Arch Linux wiki):

  • vboxnetadp and vboxnetflt are both needed when you intend to use the bridged or host-only networking feature. More precisely, vboxnetadp is needed to create the host interface in the VirtualBox global preferences, and vboxnetflt is needed to launch a virtual machine using that network interface.

  • vboxpci is needed when your virtual machine needs to pass through a PCI device on your host.

So for most users if for some reason VirtualBox kernel modules aren’t being loaded automatically then you should only need:

# modprobe vboxdrv

for VirtualBox host machine to work.

One fix is here

I assume that after reboot vbox modules are loaded?

1 Like

Yesterday on IRC @bero told me to remove the dkms stuff and this would be fixed in some script or scripts. Anyway I will update and reboot and report back shortly.

Apologies for not responding sooner. dkms-vbox is not installed because @bero said that is what I should do.

No when I reboot VBox modules are not loaded. I have to run modprobe on them every time I boot.

$ uname -a
Linux ben79-pc 4.19.4-desktop-1omv4000 #1 SMP Mon Nov 26 15:19:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa | grep virtualbox
virtualbox-5.2.22-1.x86_64

$ rpm -qa | grep vbox
x11-driver-video-vboxvideo-5.2.22-1.x86_64

After every boot we see:

$ lsmod | grep vbox

is empty every time. The fact that I run modprobe yet modules are not loaded on next boot seems odd.

What is the output of:
systemctl status loadmodules.service

1 Like
$ systemctl status loadmodules.service
● loadmodules.service - Load legacy module configuration
   Loaded: loaded (/lib/systemd/system/loadmodules.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
Condition: start condition failed at Wed 2018-11-28 07:56:45 CST; 29s ago
           ├─ ConditionPathExists=|/etc/rc.modules was not met
           └─ ConditionDirectoryNotEmpty=|/etc/sysconfig/modules was not met

This is with kernel:

$ uname -a
Linux ben79-pc 4.19.4-desktop-1omv4000 #1 SMP Mon Nov 26 15:19:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

More:

$ ls -la /etc/rc.modules
ls: cannot access '/etc/rc.modules': No such file or directory

$ ls -la /etc/sysconfig/modules
ls: cannot access '/etc/sysconfig/modules': No such file or directory

Post-edit: Possibly incorrect paths or file names?

Ok i know what is the issue.

We are installing modules conf files into wrong directory. I’ll fix it soon.
https://www.freedesktop.org/software/systemd/man/modules-load.d.html

1 Like

OK, thanks. Much appreciated.

Should be fixed

1 Like

Yes, this is fixed. Thanks @TPG. This is what it looks like immediately after booting:

$ lsmod | grep vbox
vboxnetadp             28672  0
vboxnetflt             32768  0
vboxdrv               483328  2 vboxnetadp,vboxnetflt 

in other words expected behavior.

1 Like

Awesome. Thanks.