Ubuntu Multipass -- Best Virtualisation tool for Developers


Table of Contents

Canonical developed Ubuntu Multipass, a command-line utility for quickly and easily creating Ubuntu virtual machines on all major operating systems.

As the name implies, Ubuntu Multipass can launch virtual instances of Ubuntu and other custom images. It can be configured with cloud-init exactly like any other public cloud and can create a virtual Ubuntu environment with a single command.

We can use it for a variety of purposes, including software development and testing, as well as creating our own mini cloud. In this tutorial, we will learn how to install Ubuntu Multipass on Linux, Windows, and Mac, as well as how to create our first Ubuntu VM. We’ll also learn how to use the command-line interface to configure and manage our virtual machines.

Purpose of Using Multipass

Before we proceed, consider why someone would need to use Ubuntu Multipass when there are numerous alternatives.

Ubuntu Multipass lets you run Ubuntu VMs with a single command, and managing different VMs is just as simple.   We can install it on a server and launch VMs to perform our services without interfering with the host server.

We can also use it to quickly access Ubuntu command-line by installing it on Windows and Mac, which would have been a little more difficult otherwise.

As stated previously, Multipass allows users to configure their virtual machines with cloud-init. We can use cloud-init to install/update packages, launch/configure packages, generate and run shell scripts, and so on.

Install Ubuntu Mulipass

Ubuntu Multipass is available for Windows, Mac, and, of course, any Linux version.

Install Ubuntu Multipass in Linux

Ubuntu Multipass is available as a snap package on Linux distributions. So , we’ll need snapd installed on our distributions.

Ubuntu comes with snap pre-installed. If you’re running a customized/minimal version of Ubuntu or another Linux distribution that doesn’t have snapd installed (such as Linux Mint), you can install it with the command –

sudo apt install snapd

Once you have installed snapd on your Linux distribution, we can use snap command to install Ubuntu Multipass.

sudo snap install multipass

Install Ubuntu Multipass in Windows

On Windows, we will need Windows 10 Pro/Enterprise/Education v 1803 or later, or any Windows version with VirtualBox installed.

Install Ubuntu Multpass in Mac

Just like Windows, you can download and install Ubuntu Multipass binary on Mac.

Ubuntu Multipass Commands

Launch an instance

Creating an instance with Ubuntu Multipass is a breeze.

multipass launch <image-name>

If we do not pass any parameter to the launch command, it’ll create an instance of the latest Ubuntu release.

multipass launch ubuntu --name UbuntuLTS

With --name argument, we can rename our instance.

multipass launch docker --name dockerInstance --memory 2G

With --memory argument, we can allocate the memory to our virtual instance.

multipass launch kinetic --name ubuntu2210 --memory 2G --cpus 1

With --cpus argument, we can allocate the number of cpu cores to the instance.

multipass launch jellyfin --name jellyFin --memory 4G --cpus 2 --disk 40G

With --disk argument, we can allocate the amount of storage to the instance.

List Images

multipass find

The find command lists all the available images.

sandy@LinuxAndUbuntu:~$ multipass find
Image                       Aliases           Version          Description
snapcraft:core18            18.04             20201111         Snapcraft builder for Core 18
snapcraft:core20            20.04             20210921         Snapcraft builder for Core 20
snapcraft:core22            22.04             20220426         Snapcraft builder for Core 22
snapcraft:devel                               20230213         Snapcraft builder for the devel series
core                        core16            20200818         Ubuntu Core 16
core18                                        20211124         Ubuntu Core 18
core20                                        20230119         Ubuntu Core 20
core22                                        20230119         Ubuntu Core 22
18.04                       bionic            20230210         Ubuntu 18.04 LTS
20.04                       focal             20230209         Ubuntu 20.04 LTS
22.04                       jammy,lts         20230210         Ubuntu 22.04 LTS
22.10                       kinetic           20230202         Ubuntu 22.10
daily:23.04                 devel,lunar       20230202         Ubuntu 23.04
appliance:adguard-home                        20200812         Ubuntu AdGuard Home Appliance
appliance:mosquitto                           20200812         Ubuntu Mosquitto Appliance
appliance:nextcloud                           20200812         Ubuntu Nextcloud Appliance
appliance:openhab                             20200812         Ubuntu openHAB Home Appliance
appliance:plexmediaserver                     20200812         Ubuntu Plex Media Server Appliance
anbox-cloud-appliance                         latest           Anbox Cloud Appliance
charm-dev                                     latest           A development and testing environment for charmers
docker                                        0.4              A Docker environment with Portainer and related tools
jellyfin                                      latest           Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media.
minikube                                      latest           minikube is local Kubernetes

Stop an instance

multipass stop <instance-name>

stop command followed by the instance name will shutdown the instance immediately. We can also pass -t parameter to schedule a shutdown. -t argument accepts the number of minutes to shutdown.

multipass stop jellyFin -t 3

Once the instance is scheduled to shutdown, the instance state will change from Running to Delayed Shutdown.

We can also cancel a scheduled shutdown by using -c argument to the stop command.

multipass stop jellyFin -c

Restart an instance

multipass restart <instance-name>

We can also restart all instances at once by passing --all argument.

multipass restart --all

Some instances may need to wait for certain processes to finish before initiating a restart. By passing --timeout option, we can pass the maximum time that it can wait for the command(s) to complete.

multipass restart UbuntuLTS --timeout 180

Delete an instance

multipass delete <instance-name>

delete command followed by the instance name will put the instance in Deleted state. Note that the instance can be recovered from the Deleted state anytime. If we want to delete the instance completely, without any chance of recovering it, we can pass --purge argument to the command.

multipass delete UbuntuLTS --purge

List instances

multipass list
sandy@LinuxAndUbuntu:~$ multipass list
Name                    State             IPv4             Image
UbuntuLTS               Running    Ubuntu 22.04 LTS
amused-moth             Stopped           --               Ubuntu 22.04 LTS
brisk-hamster           Deleted           --               Not Available
exotic-coati            Running     Ubuntu 22.04 LTS
jellyFin                Running     Ubuntu 22.04 LTS
ltsRelease              Running     Ubuntu 22.04 LTS
ubuntu2210              Running    Ubuntu 22.10

list option lists all the instances. The default output format is table. We can get the output in json, csv, and yaml by passing --format option to the list command.

multipass list --format yaml
sandy@LinuxAndUbuntu:~$ multipass list --format yaml
  - state: Running
    release: Ubuntu 22.04 LTS
  - state: Stopped
    release: Ubuntu 22.04 LTS
  - state: Deleted
    release: Not Available
  - state: Running
    release: Ubuntu 22.04 LTS
  - state: Running
    release: Ubuntu 22.04 LTS
  - state: Running
    release: Ubuntu 22.04 LTS
  - state: Running
    release: Ubuntu 22.10

Show instance information

multipass info <instance-name>
sandy@LinuxAndUbuntu:~$ multipass info UbuntuLTS
Name:           UbuntuLTS
State:          Running
Release:        Ubuntu 22.04.1 LTS
Image hash:     4401cf7e9948 (Ubuntu 22.04 LTS)
CPU(s):         1
Load:           0.00 0.00 0.00
Disk usage:     1.4GiB out of 4.7GiB
Memory usage:   149.5MiB out of 965.9MiB
Mounts:         --

We can also pass --all to get the information of all the instances. With the additional option --format, we can format the output in json, csv, and yaml.

Login to an instance

multipass shell <instance-name>

Please ensure that the instance you’re trying to connect is in the Running state.

sandy@LinuxAndUbuntu:~$ multipass shell UbuntuLTS
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-60-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Feb 14 16:12:08 UTC 2023

  System load:  0.001953125       Processes:             89
  Usage of /:   30.6% of 4.67GB   Users logged in:       0
  Memory usage: 18%               IPv4 address for ens3:
  Swap usage:   0%

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

Last login: Tue Feb 14 15:11:17 2023 from
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.


Ubuntu Multipass Advanced

Now that we have basic understanding of Ubuntu Multipass, we can now start to learn some advanced tasks that we can perform on our multipass instances.

1. Mount File Systems

Immediately after initiating our first instance, we will need to provide it access to our local storage. We can mount local directory with mount command.

multipass mount <host-directory> <instance-name>:<instance-directory>

Remember above we created a jellyfin instance. We can now add our local Video directory to the instance using the following command –

multipass mount /home/sandy/Videos/ jellyfin:/media

2. Set environment variables

multipass exec <instance-name> --env <variable-name>=<value> <command>

3. Share files between host and instance

Transfer files/directories from host to instance.

multipass transfer <source-file/directory> <instance-name>:<destination-directory>

Transfer files/directories from the instance to host.

multipass transfer <instance-name>:<destination-directory> <source-file/directory>

For example, to transfer a video stored locally in /home/sandy/Videos to our instance jellyfin, we can use the following command –

multipass transfer /home/sandy/Videos/video.mp4 jellyfin:/media

Troubleshooting common errors

multipass launch: Not enough memory

Resolution: Increase the instance memory with --memory option.

multipass launch: Not enough disk space

Resolution: Increase the instance disk with --disk option.

multipass mount: Cannot mount directory

Resolution: Please check that the host directory you’re trying to mount is accessible.

Debugging instances

multipass debug [instance-name]


So there you have it, Ubuntu Multipass, the quick and easy to use to tool to launch VMs on your Linux, Windows, and Mac operating systems. We can use it for all sort of purposes. I am currently hosting a local media server using Multipass.

If you have any doubt, please let us know in the comment section. If you’re already using Ubuntu Multipass, share with us what you’re using it for. 🙂

Linux toolsUncategorized