Running Mir servers over VNC

Remote desktop support

There’s a long standing request on the Mir github asking for “remote desktop support”. One possible solution is X-forwarding over ssh:

ssh -XC <login@remote> sh -lc 'egmde --shell-enable-autostart'

But there are performance (and other) issues with X forwarding.


One of the protocols mentioned in the request is VNC which has some potential for better performance. While using Xfvb for some testing, I realized that there was also a possibility of using this with x11vnc to set up a VNC server.

I’m going to describe how to do this while tunneling the VNC connection over ssh. There are obviously other options for those familiar with the technology.

The server

There are some pre-requisites: the server needs an ssh server, egmde, Xvfb, x11vnc, and inotifywait installed, but with these in place this script will start up a VNC server running a Mir desktop:


x11_auth_file=$(mktemp --tmpdir="${XDG_RUNTIME_DIR}")

# If there's already a compositor for WAYLAND_DISPLAY choose another
  while [ -e "${XDG_RUNTIME_DIR}/wayland-${port}" ]; do
    let port+=1

xvfb-run --auth-file=${x11_auth_file} --server-num=${DISPLAY_NO} egmde&

trap "kill $xvfb_pid" INT TERM

  inotifywait -qq --timeout 5 --event create $(dirname "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}")

env -u WAYLAND_DISPLAY x11vnc -display ${DISPLAY} -bg -nopw -listen localhost -xkb -auth ${x11_auth_file} -ncache 10


Towards the end of the output, this will display:

The VNC desktop is:      localhost:0

These numbers are needed when setting up the client.

The client

The client system needs ssh and gvncviewer installed.

To tunnel the VNC connection over SSH we use the following incantation:

ssh -N -T -L 5900:localhost:5900 <hostname>

Use the number from above and the name of the actual host computer.

And to connect:

gvncviewer localhost:0

This will bring up a VNC viewer with the egmde desktop running on the host system.

Am I understanding correctly that these are solutions to remote-desktop in a strictly headless setting on the server side?

Or more directly: is it possible to use this approach to connect a vnc client to a mir-kiosk device and see the same screen/output simultaneously displayed on the mir-kiosk hardware?

Correct, this is “remote desktop” (not necessarily “headless”), not screen sharing.

There’s some discussion around what would be needed for various related scenarios on this issue: