X11 application works in "local mode" but not otherwise

I’m developing an Electron app that runs in a Balena container. The container contains the built electron app and X11/electron-related dependencies.

When I use local mode, everything works great! However, when I push the app to BalenaCloud, I get the following X11 error:

Fatal server error:
(EE) no screens found(EE)

More info:

  • Running on RPi 4 (4gb)
  • Using balena images:
    • balena-cloud-raspberrypi4-64-2.60.1+rev5-dev-v11.14.0.img
    • balena-cloud-APPNAME-raspberrypi4-64-2.60.1+rev5-dev-v11.14.0.img

Here’s what I’ve done to try and debug this:

Grabbed /var/log/Xorg.0.log from a device running in “local mode” and one provisioned through the cloud (same physical device, I just flashed two separate SD cards and swapped them). The files are very different, and I’ll include them in full below, but some highlights:

  • The device running in local mode has an extra kernel command line argument (as indicated by X11): video=HDMI-A-1:1280x800M@60
  • The local mode device loads two devices, while the cloud device does not:
    • xfree86: Adding drm device (/dev/dri/card1)
    • xfree86: Adding drm device (/dev/dri/card0)
  • On the local mode device, I can see the GPU device at /sys/devices/platform/gpu/drm/card1. There is no “gpu” path under /sys/devices/platform on the cloud-provisioned device

The devices are running the exact same project, docker-compose file, etc.

Here’s /var/log/Xorg.0.log from the “local mode” (working) device:

[ 10103.698]
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[ 10103.698] Build Operating System: Linux 4.19.0-12-arm64 aarch64 Debian
[ 10103.698] Current Operating System: Linux 2f2e9fb90156 5.4.58 #1 SMP PREEMPT Wed Nov 11 13:05:43 UTC 2020 aarch64
[ 10103.698] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 video=HDMI-A-1:1280x800M@60 smsc95xx.macaddr=DC:A6:32:5C:31:EF vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=UUID=77cdc686-251e-4ab3-905d-bf6b15a5a3c0 rootwait
[ 10103.698] Build Date: 01 December 2020  05:59:57PM
[ 10103.698] xorg-server 2:1.20.4-1+deb10u2 (https://www.debian.org/support)
[ 10103.698] Current version of pixman: 0.36.0
[ 10103.698] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[ 10103.699] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 10103.699] (==) Log file: "/var/log/Xorg.0.log", Time: Sun Dec  6 22:42:19 2020
[ 10103.700] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 10103.700] (==) No Layout section.  Using the first Screen section.
[ 10103.700] (==) No screen section available. Using defaults.
[ 10103.700] (**) |-->Screen "Default Screen Section" (0)
[ 10103.700] (**) |   |-->Monitor "<default monitor>"
[ 10103.701] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[ 10103.701] (==) Automatically adding devices
[ 10103.701] (==) Automatically enabling devices
[ 10103.701] (==) Automatically adding GPU devices
[ 10103.701] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 10103.701] (WW) The directory "/usr/share/fonts/X11/misc" does not exist.
[ 10103.701] 	Entry deleted from font path.
[ 10103.701] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 10103.701] 	Entry deleted from font path.
[ 10103.702] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[ 10103.702] 	Entry deleted from font path.
[ 10103.702] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[ 10103.702] 	Entry deleted from font path.
[ 10103.702] (WW) The directory "/usr/share/fonts/X11/Type1" does not exist.
[ 10103.702] 	Entry deleted from font path.
[ 10103.702] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[ 10103.702] 	Entry deleted from font path.
[ 10103.702] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[ 10103.702] 	Entry deleted from font path.
[ 10103.702] (==) FontPath set to:
	built-ins
[ 10103.702] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 10103.702] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[ 10103.702] (II) Loader magic: 0x556d18be08
[ 10103.702] (II) Module ABI versions:
[ 10103.702] 	X.Org ANSI C Emulation: 0.4
[ 10103.702] 	X.Org Video Driver: 24.0
[ 10103.702] 	X.Org XInput driver : 24.1
[ 10103.702] 	X.Org Server Extension : 10.0
[ 10103.706] (--) using VT number 2

[ 10103.707] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[ 10103.712] (II) xfree86: Adding drm device (/dev/dri/card1)
[ 10103.725] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 10103.727] (II) no primary bus or device found
[ 10103.727] 	falling back to /sys/devices/platform/gpu/drm/card1
[ 10103.727] (II) LoadModule: "glx"
[ 10103.728] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[ 10103.738] (II) Module glx: vendor="X.Org Foundation"
[ 10103.738] 	compiled for 1.20.4, module version = 1.0.0
[ 10103.738] 	ABI class: X.Org Server Extension, version 10.0
[ 10103.738] (==) Matched modesetting as autoconfigured driver 0
[ 10103.738] (==) Matched fbdev as autoconfigured driver 1
[ 10103.738] (==) Assigned the driver to the xf86ConfigLayout
[ 10103.738] (II) LoadModule: "modesetting"
[ 10103.738] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[ 10103.739] (II) Module modesetting: vendor="X.Org Foundation"
[ 10103.739] 	compiled for 1.20.4, module version = 1.20.4
[ 10103.739] 	Module class: X.Org Video Driver
[ 10103.739] 	ABI class: X.Org Video Driver, version 24.0
[ 10103.739] (II) LoadModule: "fbdev"
[ 10103.739] (WW) Warning, couldn't open module fbdev
[ 10103.739] (EE) Failed to load module "fbdev" (module does not exist, 0)
[ 10103.739] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 10103.763] (II) modeset(0): using drv /dev/dri/card1
[ 10103.763] (II) modeset(0): Creating default Display subsection in Screen section
	"Default Screen Section" for depth/fbbpp 24/32
[ 10103.763] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[ 10103.763] (==) modeset(0): RGB weight 888
[ 10103.763] (==) modeset(0): Default visual is TrueColor
[ 10103.763] (II) Loading sub module "glamoregl"
[ 10103.763] (II) LoadModule: "glamoregl"
[ 10103.764] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[ 10103.772] (II) Module glamoregl: vendor="X.Org Foundation"
[ 10103.773] 	compiled for 1.20.4, module version = 1.0.1
[ 10103.773] 	ABI class: X.Org ANSI C Emulation, version 0.4
[ 10103.939] (II) modeset(0): Refusing to try glamor on llvmpipe
[ 10103.940] (EE) modeset(0): glamor initialization failed
[ 10103.940] (II) modeset(0): ShadowFB: preferred NO, enabled NO
[ 10103.947] (II) modeset(0): Output HDMI-1 has no monitor section
[ 10103.947] (II) modeset(0): EDID for output HDMI-1
[ 10103.947] (II) modeset(0): Manufacturer: PTC  Model: 701  Serial#: 0
[ 10103.947] (II) modeset(0): Year: 2017  Week: 4
[ 10103.947] (II) modeset(0): EDID Version: 1.4
[ 10103.947] (II) modeset(0): Digital Display Input
[ 10103.948] (II) modeset(0): 8 bits per channel
[ 10103.948] (II) modeset(0): Digital interface is undefined
[ 10103.948] (II) modeset(0): Aspect ratio: 1.00 (landscape)
[ 10103.948] (II) modeset(0): Gamma: 2.20
[ 10103.948] (II) modeset(0): DPMS capabilities: StandBy
[ 10103.948] (II) modeset(0): Supported color encodings: RGB 4:4:4
[ 10103.948] (II) modeset(0): First detailed timing is preferred mode
[ 10103.948] (II) modeset(0): Preferred mode is native pixel format and refresh rate
[ 10103.948] (II) modeset(0): redX: 0.589 redY: 0.354   greenX: 0.334 greenY: 0.582
[ 10103.948] (II) modeset(0): blueX: 0.158 blueY: 0.133   whiteX: 0.317 whiteY: 0.335
[ 10103.948] (II) modeset(0): Manufacturer's mask: 0
[ 10103.948] (II) modeset(0): Supported detailed timing:
[ 10103.948] (II) modeset(0): clock: 71.1 MHz   Image Size:  217 x 136 mm
[ 10103.948] (II) modeset(0): h_active: 1280  h_sync: 1290  h_sync_end 1300 h_blank_end 1440 h_border: 0
[ 10103.948] (II) modeset(0): v_active: 800  v_sync: 805  v_sync_end 810 v_blanking: 823 v_border: 0
[ 10103.948] (II) modeset(0): Supported detailed timing:
[ 10103.948] (II) modeset(0): clock: 72.5 MHz   Image Size:  217 x 136 mm
[ 10103.948] (II) modeset(0): h_active: 1280  h_sync: 1360  h_sync_end 1392 h_blank_end 1423 h_border: 0
[ 10103.948] (II) modeset(0): v_active: 800  v_sync: 848  v_sync_end 896 v_blanking: 846 v_border: 0
[ 10103.948] (II) modeset(0):  C3GRN�101WX1
[ 10103.948] (II) modeset(0): Unknown vendor-specific block 0
[ 10103.948] (II) modeset(0): EDID (in hex):
[ 10103.948] (II) modeset(0): 	00ffffffffffff004283010700000000
[ 10103.948] (II) modeset(0): 	041b0104a001007882f887965a559528
[ 10103.948] (II) modeset(0): 	22515500000001010101010101010101
[ 10103.948] (II) modeset(0): 	010101010101c61b00a0502017300a0a
[ 10103.948] (II) modeset(0): 	5500d9880000001a521c008f50202e30
[ 10103.948] (II) modeset(0): 	5020000fd9880000001a000000fe0043
[ 10103.948] (II) modeset(0): 	3347524e803130315758310a00000000
[ 10103.948] (II) modeset(0): 	00004132a80000000001010a20200082
[ 10103.948] (II) modeset(0): Printing probed modes for output HDMI-1
[ 10103.949] (II) modeset(0): Modeline "1280x800"x60.0   71.10  1280 1290 1300 1440  800 805 810 823 +hsync -vsync (49.4 kHz eP)
[ 10103.949] (II) modeset(0): Output HDMI-1 connected
[ 10103.949] (II) modeset(0): Using exact sizes for initial modes
[ 10103.949] (II) modeset(0): Output HDMI-1 using initial mode 1280x800 +0+0
[ 10103.949] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[ 10103.949] (==) modeset(0): DPI set to (96, 96)
[ 10103.949] (II) Loading sub module "fb"
[ 10103.949] (II) LoadModule: "fb"
[ 10103.949] (II) Loading /usr/lib/xorg/modules/libfb.so
[ 10103.949] (II) Module fb: vendor="X.Org Foundation"
[ 10103.949] 	compiled for 1.20.4, module version = 1.0.0
[ 10103.949] 	ABI class: X.Org ANSI C Emulation, version 0.4
[ 10103.952] (==) modeset(0): Backing store enabled
[ 10103.952] (==) modeset(0): Silken mouse enabled
[ 10104.039] (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
[ 10104.040] (==) modeset(0): DPMS enabled
[ 10104.040] (II) Initializing extension Generic Event Extension
[ 10104.040] (II) Initializing extension SHAPE
[ 10104.041] (II) Initializing extension MIT-SHM
[ 10104.041] (II) Initializing extension XInputExtension
[ 10104.041] (II) Initializing extension XTEST
[ 10104.042] (II) Initializing extension BIG-REQUESTS
[ 10104.042] (II) Initializing extension SYNC
[ 10104.042] (II) Initializing extension XKEYBOARD
[ 10104.043] (II) Initializing extension XC-MISC
[ 10104.043] (II) Initializing extension SECURITY
[ 10104.043] (II) Initializing extension XFIXES
[ 10104.044] (II) Initializing extension RENDER
[ 10104.044] (II) Initializing extension RANDR
[ 10104.045] (II) Initializing extension COMPOSITE
[ 10104.045] (II) Initializing extension DAMAGE
[ 10104.045] (II) Initializing extension MIT-SCREEN-SAVER
[ 10104.045] (II) Initializing extension DOUBLE-BUFFER
[ 10104.046] (II) Initializing extension RECORD
[ 10104.046] (II) Initializing extension DPMS
[ 10104.046] (II) Initializing extension Present
[ 10104.047] (II) Initializing extension DRI3
[ 10104.047] (II) Initializing extension X-Resource
[ 10104.047] (II) Initializing extension XVideo
[ 10104.047] (II) Initializing extension XVideo-MotionCompensation
[ 10104.047] (II) Initializing extension SELinux
[ 10104.047] (II) SELinux: Disabled on system
[ 10104.047] (II) Initializing extension GLX
[ 10104.048] (II) AIGLX: Screen 0 is not DRI2 capable
[ 10104.054] (II) IGLX: Loaded and initialized swrast
[ 10104.054] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[ 10104.054] (II) Initializing extension XFree86-VidModeExtension
[ 10104.054] (II) Initializing extension XFree86-DGA
[ 10104.055] (II) Initializing extension XFree86-DRI
[ 10104.055] (II) Initializing extension DRI2
[ 10104.056] (II) modeset(0): Damage tracking initialized
[ 10104.056] (II) modeset(0): Setting screen physical size to 338 x 211
[ 10107.348] (II) modeset(0): Disabling kernel dirty updates, not required.

Here’s the same log file from the cloud-provisioned (not working) device:

[  1647.635]
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[  1647.635] Build Operating System: Linux 4.19.0-12-arm64 aarch64 Debian
[  1647.635] Current Operating System: Linux 1d1afa61580e 5.4.58 #1 SMP PREEMPT Wed Nov 11 13:05:43 UTC 2020 aarch64
[  1647.636] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=800 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:5C:31:EF vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=UUID=ba1eadef-c587-4ca5-b0ca-d4ae7220e646 rootwait
[  1647.638] Build Date: 01 December 2020  05:59:57PM
[  1647.638] xorg-server 2:1.20.4-1+deb10u2 (https://www.debian.org/support)
[  1647.638] Current version of pixman: 0.36.0
[  1647.638] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[  1647.638] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[  1647.638] (==) Log file: "/var/log/Xorg.0.log", Time: Mon Dec  7 00:18:34 2020
[  1647.639] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[  1647.640] (==) No Layout section.  Using the first Screen section.
[  1647.640] (==) No screen section available. Using defaults.
[  1647.640] (**) |-->Screen "Default Screen Section" (0)
[  1647.640] (**) |   |-->Monitor "<default monitor>"
[  1647.644] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[  1647.644] (==) Automatically adding devices
[  1647.644] (==) Automatically enabling devices
[  1647.644] (==) Automatically adding GPU devices
[  1647.644] (==) Max clients allowed: 256, resource mask: 0x1fffff
[  1647.645] (WW) The directory "/usr/share/fonts/X11/misc" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/Type1" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[  1647.645] 	Entry deleted from font path.
[  1647.645] (==) FontPath set to:
	built-ins
[  1647.645] (==) ModulePath set to "/usr/lib/xorg/modules"
[  1647.645] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[  1647.645] (II) Loader magic: 0x5562d58e08
[  1647.645] (II) Module ABI versions:
[  1647.645] 	X.Org ANSI C Emulation: 0.4
[  1647.645] 	X.Org Video Driver: 24.0
[  1647.645] 	X.Org XInput driver : 24.1
[  1647.645] 	X.Org Server Extension : 10.0
[  1647.647] (--) using VT number 2

[  1647.647] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[  1647.649] (II) no primary bus or device found
[  1647.649] (II) LoadModule: "glx"
[  1647.649] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[  1647.652] (II) Module glx: vendor="X.Org Foundation"
[  1647.652] 	compiled for 1.20.4, module version = 1.0.0
[  1647.652] 	ABI class: X.Org Server Extension, version 10.0
[  1647.653] (==) Matched modesetting as autoconfigured driver 0
[  1647.653] (==) Matched fbdev as autoconfigured driver 1
[  1647.653] (==) Assigned the driver to the xf86ConfigLayout
[  1647.653] (II) LoadModule: "modesetting"
[  1647.653] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[  1647.654] (II) Module modesetting: vendor="X.Org Foundation"
[  1647.654] 	compiled for 1.20.4, module version = 1.20.4
[  1647.654] 	Module class: X.Org Video Driver
[  1647.654] 	ABI class: X.Org Video Driver, version 24.0
[  1647.654] (II) LoadModule: "fbdev"
[  1647.655] (WW) Warning, couldn't open module fbdev
[  1647.655] (EE) Failed to load module "fbdev" (module does not exist, 0)
[  1647.655] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[  1647.661] (WW) Falling back to old probe method for modesetting
[  1647.661] (EE) open /dev/dri/card0: No such file or directory
[  1647.661] (WW) Falling back to old probe method for modesetting
[  1647.661] (EE) open /dev/dri/card0: No such file or directory
[  1647.661] (EE) No devices detected.
[  1647.661] (EE)
Fatal server error:
[  1647.661] (EE) no screens found(EE)
[  1647.662] (EE)
Please consult the The X.Org Foundation support
	 at http://wiki.x.org
 for help.
[  1647.662] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[  1647.662] (EE)
[  1647.678] (EE) Server terminated with error (1). Closing log file.

Any help/thoughts/condolences are welcomed and appreciated! Thanks in advance!

I found a fix! For anyone else that encounters this, make sure that you have vc4-fkms-v3d as a DT overlay in BalenaCloud. That was the difference between my local and cloud configurations.