How to load signed Virtualbox kernel modules automatically

Questions about virtualization software
Forum rules
Before you post please read how to get help
Post Reply
inckie
Level 1
Level 1
Posts: 12
Joined: Sun Apr 07, 2013 3:50 am

How to load signed Virtualbox kernel modules automatically

Post by inckie » Wed Apr 24, 2019 10:50 am

I'm using Secure Boot and I have signed the kernel modules and enrolled the key on my laptop, and VirtualBox is working fine now.

But I have to run all these modprobe manually before i start using VirtualBox, each time i start my laptop:

Code: Select all

sudo modprobe vboxdrv
sudo modprobe vboxnetadp
sudo modprobe vboxnetflt
sudo modprobe vboxpci
Also I have to modprobe ALL the modules, if I only modprobe the vboxdrv, VirtualBox will still say the vboxdrv module is not loaded.

What is the "best pratices" fix for this (minor) issue ?

I used these commands to sign all the modules and rebooted to finish enrollment.

Code: Select all

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/"
export KBUILD_SIGN_PIN='SOMEPASSWORD'
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetadp)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetflt)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxpci)
sudo mokutil --import MOK.der

aleon1220
Level 1
Level 1
Posts: 15
Joined: Wed May 08, 2019 2:30 am

Re: How to load signed Virtualbox kernel modules automatically

Post by aleon1220 » Mon Jul 15, 2019 7:25 pm

There must be a setting in your system that enables secure boot. Please in your BIOS disable secure boot and enable any VTX Virtualization settings.
Of course backup your files and snapshot system before this process.
Happy Linux :-)

Post Reply

Return to “Virtualization”