Skip to content

Instantly share code, notes, and snippets.

@Postrediori
Last active November 27, 2024 12:55
Show Gist options
  • Save Postrediori/a9e1f60e615163b76b427789c8a4653c to your computer and use it in GitHub Desktop.
Save Postrediori/a9e1f60e615163b76b427789c8a4653c to your computer and use it in GitHub Desktop.
VirtualBox HowTos

VirtualBox HowTos

Contents

Manually sign VirtualBox kernel modules on Linux to run with SecuteBoot

Part 1. Generate custom keys

  • Install mokutil package
sudo dnf install mokutil
  • Create RSA key under new folder
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/"
  • This command will ask you to add a password, you need this password after the next reboot
sudo mokutil --import MOK.der
  • Reboot your system and a blue screen appear, select Enroll MOK --> Continue --> put the previous password and your system will start

Part 2. Sign kernel modules (must be repeated each time modules are updated)

Run the following command with root privileges from a directory with MOK.priv and MOK.der files from the previous step:

for drv in vboxdrv vboxnetadp vboxnetflt; do
    f=$(modinfo -n $drv)
    unzstd ${f}
    /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der ${f%.*}
    zstd -f ${f%.*}
    rm -f ${f%.*}
done

Restart driver

sudo modprobe vboxdrv

Based on: https://stackoverflow.com/a/61248316

Troubleshoot USB pass-through on Linux

Add current user to vboxusers group:

sudo usermod -aG vboxusers $USER

Convert disk images

Use VBoxManage to convert from RAW to other image formats:

VBoxManage convertfromraw --format VDI [filename].img [filename].vdi

Links:

Convert between image formats, e.g. from VHDX to VDI:

VBoxManage clonemedium disk C:\Path1\Disk1.vhdk C:\Path2\Disk2.vdi --format vdi

Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment