Tutorial roadblock: Common Problem 2: Unable to connect to Wayland server

I am trying to follow this tutorial:

When symlinking the Wayland socket into the in-snap $XDG_RUNTIME_DIR:

michael@snapdev:~/glmark2-example$ snap run glmark2-example
Error: main: Could not initialize canvas
Segmentation fault (core dumped)
michael@snapdev:~/glmark2-example$ snap run --shell glmark2-example
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

michael@snapdev:/home/michael/glmark2-example$ echo $XDG_RUNTIME_DIR
/run/user/1000/snap.glmark2-example
michael@snapdev:/home/michael/glmark2-example$ mkdir -p $XDG_RUNTIME_DIR
michael@snapdev:/home/michael/glmark2-example$ ln -s $XDG_RUNTIME_DIR/../wayland-0 $XDG_RUNTIME_DIR/
michael@snapdev:/home/michael/glmark2-example$ ls /run/user/0
ls: cannot access '/run/user/0': No such file or directory
michael@snapdev:/home/michael/glmark2-example$ ls /run/user/0/wayland-0
ls: cannot access '/run/user/0/wayland-0': No such file or directory
michael@snapdev:/home/michael/glmark2-example$ echo $WAYLAND_DISPLAY

michael@snapdev:/home/michael/glmark2-example$ 

According to the tutorial I should have $WAYLAND_DISPLAY set to wayland-0, and the symlinking the socket should have worked (exist).

You have to be consistent which user the Wayland server and Wayland client run as.

You’re running glmark2-example as “michael”, so the server should do that too. (Did you fail to keep miral-kiosk running?)

As you’re running as “michael” you should be looking in /run/user/1000/ (not /run/user/0/) for wayland-0.