Graphical desktop in Multipass

Graphical desktop can be viewed in various ways. We describe here the simplest one, RDP (Remote Display Protocol). Other methods include VNC and X11 (the latter is described here).

The images used by Multipass do not come with a graphical desktop installed. For this reason, a desktop environment must be installed (we use ubuntu-desktop but there are as many other options as flavors of Ubuntu exist), along with the RDP server (we will use here xrdp but there are also other options such as freerdp). For this, we must log in to the running Multipass instance first, doing

multipass shell headbanging-squid

and, once inside the instance,

sudo apt update
sudo apt install ubuntu-desktop xrdp

Then, we need a user with a password in order to log in. One possibility is to set a password to the default ubuntu user.

sudo passwd ubuntu

We will be asked to enter and re-enter a password. And we are done on the server side.

For the client, we can use on Windows the “Remote Desktop Connection” application. There, we enter the virtual machine’s IP address (which can be found by issuing the command ip addr on the guest), set the session to XOrg and enter the username and password we created on the previuos step. And we are done… a graphical desktop!

To connect on MacOS, we can use the “Microsoft Remote Desktop” application, from the Mac App Store.

On Linux, there are applications such as Remmina to visualize the desktop (make sure the package remmina-plugin-rdp is installed in your host along with remmina, and that username and password are specified using the “New connection profile” button in the top left of the window).

Note: the setup described here was tested using Multipass 20.04 instances on Windows 10 Pro and on Ubuntu 20.04 hosts.

3 Likes

Thank you for the great info! Finding anything on using a GUI desktop in Multipass is difficult. I’ve recently found how to customise certain aspects of the machine configuration here. How would I (if it’s even possible) alter the configuration after the VM is created? Also, is there a complete list of what is configurable anywhere in the documentation? Thank you very much for your time and help!

Hi! The configuration of the instance can’t be changed through the Multipass interface at the moment (this is indeed a feature we are considering for being added the future).

However, you can alter the VM configuration through some backends. IIRC, through libvirt in Linux, VirtualBox in Windows and MacOS and Hyper-V on Windows.

To change the backend, just do
multipass set local.driver={libvirt|virtualbox|hyperv}
and then, use the backend-specific configuration to change the parameters you want.

Hope this helps!

Hi, Luis. Thanks for the fast response! That’s the method I tried yesterday. Unfortunately, the vm stopped working and I started getting odd error messages. When I set local.driver back to qemu, the default, it didn’t help. I just received different error messages. I finally deleted and reinstalled multipass. I’d like to find the files where the configuration is set so I can edit them manually. When I see what’s possible, maybe I can make a gui. I’m using XFCE on a Q4OS (debian 10) installation and trying to keep things light. I was shocked at how many dependencies that were necessary for the libvirt/virtual-manager solution! Thanks again for your help. Peace.
[EDIT: For typo]

Hi Tim! Changing the backend while a machine is running can have unexpected results, sorry for not being clear about that on my previous message. Moreover, VM’s are not preserved when you change the backend. For your use case, I think using libvirt is better because it lets you fine-control through a GUI or terminal your VM. If you want to stick to qemu anyway, you can find config files under /var/snap/multipass/common, but I warn you that this may change at any moment. (Caveat emptor: manually modifying the files there is not advised because it can result in data loss.)

Happy Independence Day, if you celebrate it. You were perfectly clear, it was I who needed clarity. I would never change values like that on a running machine. Of course, I stop the VM anytime I want to “play” with the configuration. I think it was what you said about VM’s “not preserved when you change the backend” that shed light on my issue. Would would be the best method of tracking changes, or suggested changes, to the code base? Is there an irc or mailing list? I would like to learn more about the internals. One final question (for now): if I were to attempt a gui based on multipass ‘out of the box’, as it were, using qemu, where would I write config changes? I assume the files you mentioned in /var/snap/multipass/common, while the VM is stopped? Why might changes there cause data loss? Perhaps I’d better start reading the code. :slight_smile: Thanks for your patience! Enjoy your weekend!
[EDIT: for typos]

Hi Tim! About your question, yes, configuration files are there. I say that modifying files there can cause data loss because Multipass cannot guarantee a VM will keep working if the backend parameters are modified: it’s a matter of the backend program. That is why we provide only a small subset of options to be modified via the multipass executable.

You can join #multipass on FreeNode for some help. You can also take a look to the code on the git repo, https://github.com/canonical/multipass .

Hope this helps!

1 Like

Hi all

I have found that despite of WSL and WSL2 presence, the fastest way to launch linux GUI on Windows is using of multipass.
And we really need 20.04 to seamlessly connect with mstsc.exe

choco install multipass
multipass launch -n test-gui -v focal

But in a short time there is also a need to resize the root filesystem having the vhdx backend expanded.

I can manually Resize-VHD -Path …ubuntu-20.04-server-cloudimg-amd64.vhdx,
but I lack any working linux knowledge to continue.

Do you have a recommended process to make it done fast?

Hi @sundmoon,

Multipass does not support image resizing after the virtual machine was created. The simplest solution would be to create the VM specifying a big disk size, such as 20 gigabytes, which is way larger than the current 5 gigabyte default:

multipass launch focal -n test-gui -d 20G

Note that a virtual disk size of 100Gb does not imply that the file will necessarily have 20Gb.

To resize the disk in Windows after the creation of the virtual machine, you will need to resize the partition containing Linux (after resizing the virtual image as you proposed). For that, you will need to boot a virtual machine with an ISO containing a partitioning tool such as Gparted and the disk you resized as secondary disk. This solution is much more involved and I do not advise attempting it; moreover, I didn’t test it under Windows :slight_smile:

Hope this helps!

Thanks
I had overlooked this switch

Is there a way to define an env var like this
VAGRANT_HOME = C:\A\Vagrant\vagrant.d ?

??? = C:\A\Multipass\multipassd

Hi,

I don’t fully understand your question. Do you want to add an environment variable on Windows?

Yes it is
I want to move my big vhdx files to some short path

Hi @sundmoon,

Multipass does not support, for the time being, moving images to another path. Specifying a custom location for the images is certainly something we should think about. You can find your vhdx images in the AppData\Roaming\multipassd\vault\instances folder, under your home.