How to use VirtualBox in Multipass on Windows

Note: Please see instead How to set up the driver.

If you want to (or have to), you can change the hypervisor that Multipass uses to VirtualBox. To that end, install VirtualBox, if you haven’t yet. You may find that you need to run the VirtualBox installer as administrator. You can then tell Multipass to use it (also with Administrator privileges):

PS> multipass set local.driver=virtualbox

From then on, all instances started with multipass launch will use VirtualBox behind the scenes.


Finding Multipass instances in VirtualBox

Multipass runs as the System account, so to see the instances in VirtualBox, or through the VBoxManage command, you have to run those as that user via PsExec -s. Download and unpack in your Downloads folder, and in an administrative PowerShell, run:

PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s -i $env:VBOX_MSI_INSTALL_PATH\VirtualBox.exe

To list the instances on the command line:

PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s $env:VBOX_MSI_INSTALL_PATH\VBoxManage.exe list vms
"primary" {05a04fa0-8caf-4c35-9d21-ceddfe031e6f}

NOTE: You can still use the multipass client and the system menu icon, and any changes you make to the configuration of the instances in VirtualBox will be persistent. They may not be represented in Multipass commands such as multipass info , though.

Port forwarding

To expose a service running inside the instance on your host, you can use VirtualBox’s port forwarding feature, for example:

PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s $env:VBOX_MSI_INSTALL_PATH\VBoxManage.exe controlvm "primary" natpf1 "myservice,tcp,,8080,,8081"

You can then open, say, http://localhost:8081/, and the service running inside the instance on port 8080 will be exposed.

If you want to switch back to the default driver:

PS> multipass set local.driver=hyperv

Instances created with VirtualBox don’t get transferred, but you can always come back to them.