Skip to content

Setting Up Multipass on Arch Linux - Complete Guide

Published: at 10:00 AM

Setting Up Multipass on Arch Linux - Complete Guide

Multipass provides a streamlined way to launch and manage Ubuntu virtual machines on Linux, macOS, and Windows. While it’s officially supported on Ubuntu, this guide walks through installing and configuring Multipass on Arch Linux, enabling you to quickly spin up development environments and test deployments.

Prerequisites

Before starting, ensure you have:

Installation Steps

1. Install Required Dependencies

First, install the necessary packages from the official repositories:

sudo pacman -S qemu-base libvirt dnsmasq apparmor edk2-ovmf git cmake gcc

These packages provide:

2. Set Up System Services

Enable and start the required system services:

# Enable and start libvirt
sudo systemctl enable --now libvirtd.service

# Enable and start AppArmor
sudo systemctl enable --now apparmor.service

3. Configure User Permissions

Add your user to the necessary groups to allow VM management without sudo:

sudo usermod -a -G libvirt,kvm $USER

Important: Log out and back in for these group changes to take effect.

4. Configure OVMF for UEFI Support

Set up the OVMF firmware for QEMU:

sudo mkdir -p /usr/share/qemu
sudo ln -s /usr/share/edk2/x64/OVMF.fd /usr/share/qemu/OVMF.fd

5. Install Multipass from AUR

Using an AUR helper (like yay):

yay -S canonical-multipass

Or manually:

git clone https://aur.archlinux.org/canonical-multipass.git
cd canonical-multipass
makepkg -si

6. Start Multipass Service

Enable and start the Multipass daemon:

sudo systemctl enable --now multipassd.service

7. Verify Installation

Confirm that Multipass is installed correctly:

multipass version
multipass list

Usage Examples

Launching Ubuntu Instances

Basic Instance

Create a default Ubuntu 20.04 LTS instance:

multipass launch 20.04 --name my-instance

High-Resource Development Instance

Create an instance with custom resources:

multipass launch 20.04 --name dev-instance --cpus 4 --memory 8G --disk 50G

Managing Instances

List All Instances

View all your Multipass instances:

multipass list

Access Instance Shell

Connect to an instance’s terminal:

multipass shell instance-name

Stopping an Instance

Pause a running instance:

multipass stop instance-name

Deleting an Instance

Remove instances you no longer need:

multipass delete instance-name
multipass purge  # Remove deleted instances completely

Troubleshooting

OVMF Firmware Issues

If you encounter errors related to OVMF.fd:

# Verify OVMF installation
ls -l /usr/share/edk2/x64/OVMF.fd

# Recreate symlink if needed
sudo rm /usr/share/qemu/OVMF.fd
sudo ln -s /usr/share/edk2/x64/OVMF.fd /usr/share/qemu/OVMF.fd

Service Connection Issues

If Multipass fails to connect to the daemon:

# Check service status
systemctl status multipassd

# Check logs
journalctl -u multipassd

# Restart service
sudo systemctl restart multipassd

Permission Issues

For permission-related errors:

# Verify group membership
groups | grep -E "libvirt|kvm"

# Fix permissions if needed
sudo chmod 666 /dev/kvm

Security Considerations

AppArmor Profiles

Ensure AppArmor is properly configured:

# Verify profiles are loaded
aa-status | grep multipass

Network Security

Resource Limits

multipass info instance-name

Access Control

Maintenance

Updating Multipass

Keep Multipass updated with:

yay -Syu canonical-multipass

Backing Up Instance Data

Back up your instance data:

multipass stop instance-name
cp -r /var/lib/multipass/data/instance-name backup/

Regular Clean-Up

Perform maintenance to free up resources:

# Remove old instances
multipass delete unused-instance
multipass purge

# Clear cache
rm -rf ~/.cache/multipass

Advanced Configuration

Custom Image Source

Use a different Ubuntu image server:

multipass set local.image-servers="https://cloud-images.ubuntu.com/releases/"

Shared Folders

Mount a host directory in your instance:

multipass mount /path/to/host/directory instance-name:/path/in/instance

Bridged Networking

For direct network access, use a bridge:

# First create a bridge using netctl or systemd-networkd
# Then launch with:
multipass launch --network bridge=br0

Conclusion

Multipass offers a lightweight alternative to traditional virtualization tools, making it perfect for development and testing. While not officially supported on Arch Linux, following this guide provides a stable and functional installation for quickly spinning up Ubuntu instances.

With Multipass configured on your Arch Linux system, you can now create consistent development environments, test deployments across different Ubuntu versions, and isolate projects within individual VMs.