A simple GUI Shell for a Multipass VM
Multipass
Multipass is an easy way to run a VM on a variety of platforms. But the VM doesn’t have graphics support and this can be limiting.
Mir
Mir is a set of libraries that facilitate building GUI shells and provides a number of “platforms” that these run on, one of these “platforms” is X11.
The Mir X11 platform is important here because we can use ssh “X forwarding” to run a GUI shell on a
Egmde
Egmde is a GUI shell built with Mir and available as a “snap”.
Putting it together
What follows assumes that you’ve (for example) set up ssh on your host system. (So that, for example, cat ~/.ssh/id_rsa.pub
works. I think that a reasonable assumption for anyone reading this far but I’ll make it explict.
We can put all the above pieces together as follows:
#!/bin/sh
multipass launch -n egmde-multipass --cloud-init - <<EOF
ssh_authorized_keys:
- $(cat ~/.ssh/id_rsa.pub)
packages:
- xwayland
- fonts-freefont-ttf
- gnome-terminal
- libglib2.0-bin
runcmd:
- sudo snap install --classic --edge egmde
EOF
This sets up a VM called egmde-multipass with egmde, a couple of packages it needs and enables ssh access.
We can then use this VM as follows:
multipass start egmde-multipass
ssh -X ubuntu@$(multipass info egmde-multipass --format csv | awk -F, '/^egmde-multipass/ { print $3 }') egmde.remote
This will open a “remote” egmde shell as a “Mir-on-X” window on your desktop.
In your VM you can install and run X or Wayland based applications and these will appear by the magic of X-forwarding in the “Mir-on-X” window on your desktop.