VirtualBox and Secure Boot

If you run Linux with secure boot you can get problems working with VirtualBox. VirtualBox requires special modules which should be added to the kernel in the boot time. It happens that this modules are not recognized as native on the boot so they are rejected. To enable this modules they have to be signed by secure key.
First of all, you have to generate a key:
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive name/"

Than, sign required modules. Hereby is a code snippet you can use to solve this problem:
for f in $(dirname $(modinfo -n vboxdrv))/*.ko;
    do echo "Signing $f"; sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $f;
done


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 vboxguest)
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 /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxsf)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxvideo)

After, import key:
sudo mokutil --import MOK.der
Reboot.

 Sources: One and Two

Comments

Popular posts from this blog

Install Kubeflow locally

RabbitMQ and OpenShift