5

I've been running an Electron App on a Pi4, Ubuntu 22.04 Server, and Gnome desktop without issue. Since it runs as a kiosk anyway as a single app, I've been attempting to eliminate Gnome and just launching from the CLI (with X installed). However, I'm getting:

ERROR:ozone_platform_x11.cc(247) Missing X server or $DISPLAY
The platform failed to initialize. Exiting.

I've read about setting "DISPLAY=$HOST_IP:10.0", however I'm not clear where that would be set, or if that's applicable to this situation. I'm pretty new to this part, so any help would be appreciated!

Cornelius Qualley
  • 721
  • 5
  • 10
  • 19

1 Answers1

2

The display is set as an environment variable on the xclient side so it knows where to send the output at the xserver. For example, if I'm running the xserver on a Windows box at 192.168.0.5 then on the client do:

$ export DISPLAY=192.168.0.5:0.0

This will tell the xclient to send output to that url on display zero. You can have more than one display but for this example we will keep it simple.

If your xclient is, say, Ubunto via WSL2 on Windows you can simply put this line in the Ubunto ~/.bash file and it will automagically figure out the correct display value:

# enable the display for XWindows

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

To verify your display is set do:

$ echo $DISPLAY

172.26.112.1:0.0 <-- just an example url, probably not yours

Kenny Cason
  • 497
  • 5
  • 17
  • I tried the above solution but it still doesn't work also... I was using Docker environment with Debian – Nora Oct 17 '22 at 10:24
  • Please add to your question above the actual CLI command you are using and show the output error. This could be unrelated to the DISPLAY variable but I need to see the CLI to help determine the cause. If we need to take this offline please let me know. – Kenny Cason Oct 17 '22 at 14:23