vboxsign signs and loads the VirtualBox kernel modules on a Linux host with Secure Boot enabled.
- signs the
vboxdrv,vboxnetflt,vboxnetadp, andvboxpcikernel modules with a MOK (Machine Owner Key) keypair, skipping any module that's already signed - loads each module with
modprobeafter signing - re-execs itself with
sudoautomatically if not already run as root
- Linux (with Secure Boot and a MOK keypair enrolled via
mokutil)
- a MOK keypair (
MOK.priv,MOK.der) already generated and enrolled withmokutil --import - matching
linux-headers-$(uname -r)installed (for the kernel'ssign-filetool) - VirtualBox installed (for the kernel modules themselves)
Point the script at your key directory one of three ways (CLI flag beats env var beats the in-script default):
- Edit the script — change the
dir=default placeholder (/home/directory/of/keys) to wherever yourMOK.priv/MOK.deractually live. - Set
VBOXSIGN_KEYS_DIRin your environment. - Pass
-k/--keys-dir DIRfor a one-run override.
Then:
sudo vboxsign(or just vboxsign — it re-execs itself under sudo -E if needed, preserving VBOXSIGN_KEYS_DIR)
Run after a kernel update, when Secure Boot is rejecting the unsigned VirtualBox modules:
vboxsignPoint at a non-default key directory for this run only, without editing the script:
vboxsign --keys-dir /mnt/keys/vbox-mok- Requires root; automatically re-runs itself via
sudoif not already root. - Skips signing (but still attempts to load) any module that's already signed.
- The commented-out block for an encrypted (GPG-protected) private key is inert by default — the script expects an unencrypted
MOK.privunless you uncomment and adapt that section yourself. - The final
shred -vfuz MOK.privcleanup line is also commented out by default, so the private key is left in place after a run unless you opt in.
- The hardcoded key directory (
/home/directory/of/keys) is a placeholder by design (this repo is public) — point it at your own key location by editing the script, settingVBOXSIGN_KEYS_DIR, or passing--keys-dir. - Designed to be re-run safely after every kernel update, since new kernel builds need the modules re-signed against the running kernel's headers.