Getting Erlang's observer working on Alpine Linux

Problem statement

When running Erlang VM on a remote Alpine Linux node (connected via ssh), I want Erlang’s observer package to work.

As it turns out, there are few issues with that.


I start with clean 3.15 install, to avoid interference. Since Alpine Linux edge has also 24.1.4-r0 version, I won’t bother upgrading.

To install:

$ sed -i -r 's,# *(.*3.15/comm),\1,' /etc/apk/repositories 
$ apk add erlang erlang-observer

First start1:

$ erl -oldshell
Eshell V12.1.4  (abort with ^G)
1> observer:start().
** exception error: undefined function wx_object:start/3
     in function  observer_wx:start/0 (observer_wx.erl, line 68)

OK, that did not go well.

Quick look at gives us:

erlang subpackages

so based on the exception we’re probably missing:

$ apk add erlang-wx

which then gives us:

$ erl -oldshell
Eshell V12.1.4  (abort with ^G)
1> observer:start().
08:08:17: Error: Unable to initialize GTK+, is DISPLAY set properly?

Hm, I forgot to ssh -X instead of just ssh. But oops:

$ ssh alpine2 -X
X11 forwarding request failed on channel 0

Okay, easy fix:

$ # enable X11 forwarding in sshd
$ sed -i -r 's/^X11Forw.*/X11Forwarding yes/' /etc/ssh/sshd_config
$ /etc/init.d/sshd restart

But it’s still failing:

$ ssh alpine2 -X
X11 forwarding request failed on channel 0


$ ssh alpine2 -X -v true 2>&1 | grep X11
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Remote: No xauth program; cannot forward X11.
X11 forwarding request failed on channel 0

Aha! After apk add xauth observer starts:

$ ssh alpine2 -X
/usr/bin/xauth:  file /root/.Xauthority does not exist
$ echo $DISPLAY
$ erl -oldshell
Eshell V12.1.4  (abort with ^G)
1> observer:start().

Unfortunately it looks like this:

broken observer

Obviously some font is missing. But which?

I couldn’t easily figure that one out, so I tried couple of monospaced and lucked out with apk add terminus-font:

fixed observer


Thus, in order to make observer work in fresh alpinelinux install, one needs to2:

# enable community repo
sed -i -r 's,# *(.*3.15/comm),\1,' /etc/apk/repositories 
apk update
# install
apk add erlang-observer erlang-wx xauth terminus-font
# enable x11 forwarding
sed -i -r 's/^X11Forw.*/X11Forwarding yes/' /etc/ssh/sshd_config
/etc/init.d/sshd restart

To make this more pleasant for everybody, I’ve opened a bug #13405 on Alpine aports.

Update 2021-01-13: This was merged as !29353 so erlang* packages >= 24.1.4-r1 should have proper xauth, erlang-wx, and terminus-font dependencies (where applicable). Btw, that original bug led to #13406 (apk silently ignores malformed depends).

  1. erl -oldshell because it skips the long Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:no-native-stack] banner that messes up my mojo, in case you were wondering. But if you know how to bypass the banner without using old shell, I’m all ears. ;)

  2. As root, and verified for Alpine Linux 3.15.0