VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Discussions related to using VirtualBox on Linux hosts.
CiscoStud
Posts: 1
Joined: 12. May 2016, 15:40

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by CiscoStud »

Just go to terminal and reinstall with "sudo virtualbox-dkms" and then reinstalled VirtualBox and everything works. ~Ubuntu 16.04 Mate
cdrandall
Posts: 1
Joined: 18. May 2016, 04:32

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by cdrandall »

I have had the exact same problem with not having the kernel modules loaded on two different machines.
The first one is a Red Hat 6.8 box that was running Vbox great until I updated to the latest kernel this week. I was unable to get vbox to work with this latest kernel and had to revert to the previous version.

Today I loaded vbox on my Fedora 23 system at home for the first time and had the same issue.

I'm wondering if it is a compatibility issue with the latest Linux Kernel
captain_frog
Posts: 2
Joined: 31. May 2016, 11:24

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by captain_frog »

After spending hours fighting with this problem, the solution that worked for me :
Access the BIOS and disable SECURE BOOT
AE4ML
Posts: 2
Joined: 2. Jun 2016, 15:30

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by AE4ML »

This didn't work for Ubuntu 16.04 .
1. Kernel directory is wrong.
2. no sign-file
Geppux
Posts: 9
Joined: 9. Jul 2016, 14:24

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by Geppux »

The solution of Fayce66 worked also for me and now the virtual machine starts but... only if the selection of the network is NAT, if I want to use bridge the virtual machine doesn't start if secure boot is enabled... how can I solve this? how can I sign the network adapter installation so that I can keep the secure boot enabled?
Thank you.
Giuseppe
DiWa51
Posts: 2
Joined: 10. Jul 2016, 18:09

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by DiWa51 »

Geppux wrote:... the virtual machine starts but... only if the selection of the network is NAT, if I want to use bridge the virtual machine doesn't start if secure boot is enabled... how can I solve this? how can I sign the network adapter installation so that I can keep the secure boot enabled?
Same for me, so I applied the same technique again on vboxnetflt that was complaining not being loaded with the same generated key.

Code: Select all

/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetflt)
Now my VM starts and runs ;)

Thanks again Fayce66
Geppux
Posts: 9
Joined: 9. Jul 2016, 14:24

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by Geppux »

Thank you Diwa51, now the network is working in bridge mode and secure boot enabled, but if in the guest machine I try to make and apt-get update or install doesn't work with secure boot enabled (please see enclosed jpg). It stuck and there is no download.
network-error.jpg
network-error.jpg (123.82 KiB) Viewed 7823 times
Have you an idea of how to solve the problem?
Thank you.
Giuseppe
Geppux
Posts: 9
Joined: 9. Jul 2016, 14:24

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by Geppux »

..... :? --- after 10 minuts started to work... I don't understand why, but needs almost 10 minutes before starting to download...but it works.
clivend
Posts: 1
Joined: 20. Jul 2016, 10:40
Primary OS: Ubuntu 12.04
VBox Version: OSE Debian
Guest OSses: Ubuntu server, OSX, Windows 10, Android

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by clivend »

[Ubuntu 14.04]

I followed Fayce66 instructions and enrolled key on reboot, but when I run

Code: Select all

sudo keyctl list %:.system_keyring
I cannot see the new key in the list, nor is loaded by EFI. I am disabling secureboot now, but I need it back in order to install windows 10 alongside ubuntu

EDIT

I tried to import the key again, and I got

Code: Select all

SKIP: MOK.der is already enrolled
and in dmesg output I found

Code: Select all

[    6.055449] Request for unknown module key 'MOK: 70b16d5a79b3d68186c430effdbab41da14b2682' err -11
bugsDOTlaunchpadDOTnet/ubuntu/+source/virtualbox/+bug/1574300
kakoma
Posts: 1
Joined: 22. Jul 2016, 05:06

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by kakoma »

Fayce66's solution worked for me too. It should be added to the documentation here virtualbox(dot)org(slash)wiki(slash)Linux_Downloads because anyone with secureBoot enabled, which is the default setting in a lot of hardware, will run into this issue and lose some hair trying to solve it
If anyone here can make the update, please do
mrummuka
Posts: 2
Joined: 11. Jul 2016, 17:49

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by mrummuka »

Although this is slightly off-topic I'm posting Fedora adaptations below, as I encountered the same problems when installing VirtualBox 5.1 to Fedora 24 w/ Kernel 4.6.4-301 according to instructions http://www.if-not-true-then-false.com/2 ... -hat-rhel/ and I managed to use Fayce66's solution to overcome them as follows:

1) Installation of VirtualBox first stuck with both SELINUX denials & failure in inserting kernel module

Code: Select all

user@localhost:$ sudo dnf install VirtualBox-5.1
--clipclip--
Running transaction
  Installing  : VirtualBox-5.1-5.1.2_108956_fedora24-1.x86_64                                                                         1/1 

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

vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.
  Verifying   : VirtualBox-5.1-5.1.2_108956_fedora24-1.x86_64                                                                         1/1 

Installed:
  VirtualBox-5.1.x86_64 5.1.2_108956_fedora24-1                                                                                           

Complete!
2. Resolving SELINUX denial(s) produced by installation
SELinux is preventing vboxdrv.sh from open access on the file /etc/udev/rules.d/60-vboxdrv.rules.

***** Plugin catchall (100. confidence) suggests **************************

If you believe that vboxdrv.sh should be allowed open access on the 60-vboxdrv.rules file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'vboxdrv.sh' --raw | audit2allow -M my-vboxdrvsh
# semodule -X 300 -i my-vboxdrvsh.pp
(...) =>

Code: Select all

user@localhost:$ sudo ausearch -c 'vboxdrv.sh' --raw | audit2allow -M my-vboxdrvsh
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i my-vboxdrvsh.pp
user@localhost:$   sudo semodule -X 300 -i my-vboxdrvsh.pp 
3. Uninstall & reinstall VirtualBox just to make sure it produces the same error as before but with no SELINUX denials this time

Code: Select all

user@localhost:$  sudo dnf remove VirtualBox-5.1
--clipclip--
Removed:
  VirtualBox-5.1.x86_64 5.1.2_108956_fedora24-1 
user@localhost:$  sudo dnf install VirtualBox-5.1
--clipclip--
Transaction test succeeded.
Running transaction
  Installing  : VirtualBox-5.1-5.1.2_108956_fedora24-1.x86_64                                                                         1/1 

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

vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.
  Verifying   : VirtualBox-5.1-5.1.2_108956_fedora24-1.x86_64                                                                         1/1 

Installed:
  VirtualBox-5.1.x86_64 5.1.2_108956_fedora24-1                                                                                           

Complete!
4. key signing: as in Ubuntu

Code: Select all

user@localhost:$ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Akrog/"
5. Added key to UEFI boot (as in Ubuntu)

Code: Select all

user@localhost:$ sudo mokutil --import MOK.der
user@localhost:$ sudo reboot now
+ Followed instructions for UEFI key import from https://sourceware.org/systemtap/wiki/SecureBoot
6. locating kernel module(s) for Fedora (notice misc):

Code: Select all

user@localhost:$ modinfo vboxdrv
filename: /lib/modules/4.6.4-301.fc24.x86_64/misc/vboxdrv.ko
--clipclip--
7. Checking what other module(s) are there:

Code: Select all

user@localhost:$ ll /lib/modules/4.6.4-301.fc24.x86_64/misc/
total 13968
-rw-r--r--. 1 root root 12106179 Jul 25 22:58 vboxdrv.ko
-rw-r--r--. 1 root root   509147 Jul 25 22:59 vboxnetadp.ko
-rw-r--r--. 1 root root   856947 Jul 25 22:59 vboxnetflt.ko
-rw-r--r--. 1 root root   820715 Jul 25 22:59 vboxpci.ko

8. Whether or not it was a good idea I tested signing all the module(s):

Code: Select all

user@localhost:$ sudo /usr/src/kernels/4.6.4-301.fc24.x86_64/scripts/sign-file sha256  ./MOK.priv ./MOK.der /lib/modules/4.6.4-301.fc24.x86_64/misc/vboxdrv.ko
user@localhost:$ sudo  /usr/src/kernels/4.6.4-301.fc24.x86_64/scripts/sign-file sha256  ./MOK.priv ./MOK.der /lib/modules/4.6.4-301.fc24.x86_64/misc/vboxnetadp.ko
user@localhost:$ sudo  /usr/src/kernels/4.6.4-301.fc24.x86_64/scripts/sign-file sha256  ./MOK.priv ./MOK.der /lib/modules/4.6.4-301.fc24.x86_64/misc/vboxnetflt.ko
user@localhost:$ sudo  /usr/src/kernels/4.6.4-301.fc24.x86_64/scripts/sign-file sha256  ./MOK.priv ./MOK.der /lib/modules/4.6.4-301.fc24.x86_64/misc/vboxpci.ko 
And I finally got Virtualbox to start :D
McDragon
Posts: 3
Joined: 22. Jul 2014, 09:43

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by McDragon »

I was having the same problem on my Thinkpad T440s and what solved it was disabling secure boot in the BIOS. Thats it.
TavuL
Posts: 1
Joined: 16. Oct 2016, 03:14

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by TavuL »

I did everything exactly as posted here, and even had the correct outputs as posted here for my VMWare. vmmon and vmnet were signed. I am in Ubuntu 16.04LTS. However the VMś wont run...I keep getting the same message : "Failed to open /dev/vmmon/ verify kernel vmmon is loaded. Failed to initialize monitor." Any help or suggestions? Thanks in advance!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by Perryg »

Code: Select all

Failed to open /dev/vmmon/ verify kernel vmmon is loaded
The module you list is VMware and this is VirtualBox forums. Perhaps you need to ask them.
joesse
Posts: 1
Joined: 5. Mar 2017, 14:27

Re: VirtualBox on Ubuntu 16.04 fails to load VirtualBox Kernel Modules

Post by joesse »

Thank you, fayce66,

this works perfectly. Some observations I made:

In Ubuntu when you "sudo" it will use your normal working account and ask your user password. For the mokutil stuff you should use your real root account. The best is to "su root" to make sure you are using that account.

Ubuntu is updating the kernel rather frequently. When the kernel is updated, you have to start vmware. It will inform you that there new modules to be compiled and installed. Only after that the new modules to be signed are present.

The command to sign is better:

Code: Select all

/usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 cert/MOK.priv  cert/MOK.der /lib/modules/`uname -r`/misc/vmmon.ko
That is the ony command to be executed after the kernel update and it will find the file path automagically.

Joesse
Post Reply