Skip to content

Instantly share code, notes, and snippets.

@Postrediori
Last active July 24, 2024 07:54
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 image formats:

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

Source: https://superuser.com/questions/554862/how-to-convert-img-to-usable-virtualbox-format/555170#555170

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