Skip to content

Multipass cheatsheet

Multipass Commands

  • find
  • launch
  • multipass list
  • multipass shell \<VM name>

Example command:

multipass launch lunar --name VM1 --disk 20G -m 2G -c 1 --cloud-init cloud-config.yml

Multipass Information

snap info multipass
name:      multipass
summary:   Instant Ubuntu VMs
description: |
  Multipass is a tool to launch and manage VMs on Windows, Mac, and Linux that simulates a cloud
  environment with support for cloud-init. Get Ubuntu on-demand with clean integration to your IDE
  and version control on your native platform.

  Launch an instance (by default you get the current Ubuntu LTS)

     multipass launch --name foo

  Run commands in that instance, try running bash (logout or ctrl-d to quit)

     multipass exec foo -- lsb_release -a

  Pass a cloud-init metadata file to an instance on launch

     multipass launch -n bar --cloud-init cloud-config.yaml

  See your instances

     multipass list

  Stop and start instances

     multipass stop <instance_name>
     multipass stop --force <instance_name>
     multipass start <instance_name>

  Get help

     multipass help

::: admonition What is Multipass?

Multipass is a mini-cloud on your workstation. :::

Multipass is already a very user-friendly tool, offering ultra-lightweight virtualization that is very easy to use. There are multiple older alternatives, such as [Vagrant]{.title-ref}, for example.

Tutorial

Installation

$ snap install multipass
multipass 1.8.0 from Canonical✓ installed

The multipass service is managed by systemd on Linux, making it very easy to manage:

systemctl status snap.multipass.multipassd

Launch

# Spin up an Ubuntu 20.04 instance
# multipass launch 20.04
Launched: accustomed-corgi
$ multipass exec glowing-ibex -- uname -rp
5.4.0-94-generic aarch64

# Delete VM
$ multipass delete glowing-ibex

# Permanently delete VM
$ multipass delete glowing-ibex

$ multipass ls
Name                    State             IPv4             Image
glowing-ibex            Deleted           --               Not Available
$ multipass purge
$ multipass ls
No instances found.

Launch Examples:

multipass launch --name debian11 -vvvv https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-amd64.qcow2
multipass launch --name debian12 -vvvv https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
multipass launch --name testvm --cloud-init cloud-init.yaml 23.10
multipass launch --name debian12 --cloud-init cloud-init.yaml https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2

Find Image

multipass find

Image                       Aliases           Version          Description
20.04                       focal,lts         20220118         Ubuntu 20.04 LTS
21.10                       impish            20220118         Ubuntu 21.10
daily:22.04                 devel,jammy       20220123         Ubuntu 22.04 LTS
docker                                        latest           A Docker environment with Portainer and related tools
minikube                                      latest           Minikube is local Kubernetes

Virtual Machine Configuration

multipass launch --name k3s --cpus 4 --mem 2048M --disk 5G

You can list available instances with the command:

$ multipass list

Or stop or start your instances with:

$ multipass stop my-instance
$ multipass start my-instance

Of course, you can execute a shell in your instance:

$ multipass shell my-instance

or:

$ multipass exec k3s -- bash

Miscellaneous

Simple to use

You can manage the entire VM lifecycle with 3 commands.

  • Spin up an Ubuntu 20.04 VM: [multipass launch 20.04]{.title-ref}
  • Enter the VM terminal: [multipass shell \<vm name>]{.title-ref}
  • Delete the VM: [multipass delete \<vm name>]{.title-ref}

Simple VM Customization

  • Launch VM with 2 CPUs:

    multipass launch 20.04 --cpus 2
    
  • Launch VM with 1GB memory:

    multipass launch 20.04 --mem 1G
    
  • Launch VM with 5GB disk:

    multipass launch 20.04 --disk 5G
    

Mount a Directory

Mount a host directory to VM:

multipass mount /host/path <vm name>:/some/path

Mount a partition as native:

multipass mount -u 1000:1000 -g 1000:1000 -t native <directory_path> <machine_name>:<destination_path>

To unmount:

multipass umount <machine_name>:<mounted_path>

Simple File Transfers

Transfer a file from host to VM:

multipass transfer script.sh <vm name>:/tmp/script.sh

Transfer a file from VM to host:

multipass transfer <vm name>:/root/script.sh /path/on/host

::: note ::: title Note :::

The [-r]{.title-ref} option allows you to copy (recursively) a directory. :::

Delete

Simple cleanup (and recovery):

Delete a VM: multipass delete <vm name>
Permanently delete all VMs: multipass purge
Recover a deleted VM: multipass recover <vm name>

Multipass Info

Allows you to get the IP address without opening a shell:

multipass info <name>
Name:           <name>
State:          Running
Snapshots:      0
IPv4:           10.190.208.11
Release:        Ubuntu 24.04 LTS
Image hash:     bc984eb1d1ef (Ubuntu 24.04 LTS)
CPU(s):         1
Load:           0.00 0.00 0.00
Disk usage:     2.0GiB out of 4.8GiB
Memory usage:   348.7MiB out of 956.1MiB

Purge or Recover

multipass purge: Deletes all instances marked for \"deletion\"

multipass delete --purge <vmname>
multipass purge

Networks

[multipass networks]{.title-ref} allows you to configure the network (add interfaces, bridges, routes to another VM, etc...)

::: note ::: title Note :::

At least one important point about network configuration:

  • The virtual machine must be able to communicate with the outside (bridge mode)
  • The virtual machine must be able to communicate with the host machine
  • The virtual machine must be able to communicate with other VMs hosted on the host machine :::

The Service

The service is managed by [systemctl]{.title-ref}

systemctl status snap.multipass.multipassd