How to use Multipass remotely

This document will demonstrate how to use Multipass remotely. This can be useful, for example, if you want to run your VMs on a more powerful machine.

Contents:

Expose Multipass to your network

To expose Multipass to your network, pass --address when starting the daemon:

$ multipassd --help
# ...
  --address <server_name:port>                      specifies which address to
                                                    use for the multipassd
                                                    service; a socket can be
                                                    specified using
                                                    unix:<socket_file>

The client accepts the MULTIPASS_SERVER_ADDRESS environment variable that overrides the default:

$ MULTIPASS_SERVER_ADDRESS=<hostname>:51001 multipass find
Image                       Aliases           Version          Description
...
21.10                       impish            20220118         Ubuntu 21.10

Caveats:

  • Because mounts are executed as privileged users, it is recommended to use client authentication, so you can explicitly allow clients access with a shared passphrase.
    Alternatively, you can multipass set local.privileged-mounts=false to disable the mounts feature altogether.
  • Additionally, the mount command takes a target filepath which is resolved daemon-side, meaning that directories are mounted from the system that the daemon is running on, not the client.
  • Some commands (shell, exec, mount) currently rely on direct networking between the client and the instance, for those to work you’ll need to ensure routing between them is possible.

Change the daemon settings

Linux

You can systemctl edit snap.multipass.multipassd.service and place content along these lines (replace <hostname> with the hostname or the IP you want it to listen on) in:

[Service]
ExecStart=
ExecStart=/usr/bin/snap run multipass.multipassd --address <hostname>:51005

Restart the service then:

$ snap stop multipass
$ snap start multipass

macOS

On macOS you’ll need to add it to the service definition (again, replace <hostname>) and reload it:

$ sudo /usr/libexec/PlistBuddy \
  -c "Add :ProgramArguments: string --address" \
  -c "Add :ProgramArguments: string <hostname>:51001" \
  /Library/LaunchDaemons/com.canonical.multipassd.plist
$ sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist
$ sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist

NB: reinstallation / upgrade will overwrite those changes

Windows

On Windows you’d need to edit/recreate the service definition, and that’s non-trivial (if you do, remember to pass /svc as the first argument to the multipassd.exe binary, and that we currently use the LocalService account)…

As a one-time thing you can use the Start parameters field in the Services panel after stopping the service:


Let us know how this worked for you and what you’d like to see next!


Last updated 2 months ago.