Problems running GTK# app with Mono using torizon/weston container

Hi all!

I am trying to dockerize one of our applications. It is based on .NET and GTK#. Our setup is as follows:

  • Apalis iMX6Q 2 GB IT V1.1D
  • Custom base board (but we also have an Ixora V1.0A)
  • Custom LCD display connected via RGB24
  • TorizonCore 5.7.0+build.15
  • customized SplashScreen (company logo)
  • custom docker container based on torizon/weston:2
  • custom docker-compose file to start the custom container

The container itself starts and the screen turns dark blue - so far so good. Now I access the container and manually start the app using mono. After a few seconds the program terminates. From our apps log file I see that the application stops on gtk_init, because it is unable to open display :0 … now I tried changing $GDK_BACKEND but honestly, right now I am a bit lost. Maybe you can help me with some ideas on how to proceed. How do I make the app find the correct display?

The container is based on weston:

ARG IMAGE_ARCH=linux/arm
# For arm64 use:
# ARG IMAGE_ARCH=linux/arm64
ARG BASE_NAME=weston
# For arm64v8 use:
# ARG BASE_NAME=wayland-base-vivante
ARG IMAGE_TAG=2
ARG DOCKER_REGISTRY=torizon
FROM --platform=$IMAGE_ARCH $DOCKER_REGISTRY/$BASE_NAME:$IMAGE_TAG AS base

# Install the weston compositor and dependencies for mono-app
RUN apt-get -y update && apt-get install -y --no-install-recommends \
    systemd dbus \
    mono-runtime \
    libglib2.0 gdb-minimal gtk-sharp2 \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*


RUN mkdir -p /opt/mono-app

# Create appuser and set appuser permissions
RUN \
    groupadd --gid 1001 appuser && \
    useradd --gid 1001 --uid 1001 --create-home appuser && \
    mkdir -p /etc/sudoers.d/ && \
    chgrp -R appuser /usr/local && \
    find /usr/local -type d | xargs chmod g+w && \
    echo "default ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/appuser && \
    chmod 0440 /etc/sudoers.d/appuser
# and run as appuser
#USER appuser


COPY MonoApp_3.21.0.17693 /opt/mono-app/


#ENV DISPLAY=:0
#ENV WAYLAND_DISPLAY=wayland-0
#ENV WAYLAND_USER=torizon
#ENV XDG_RUNTIME_DIR=/tmp/1000-runtime-dir
#ENV GDK_BACKEND=wayland


VOLUME /dev/dri /dev/dri
VOLUME /var/run/dbus /var/run/dbus
VOLUME /run/dbus /run/dbus
VOLUME /tmp /tmp


#ENTRYPOINT mono --debug /opt/mono-app/App.exe

The docker-compose.yml currently only has one service in it:

version: "2.4"
services:
  weston-mono-app:
    image: weston-mono-app:latest
    container_name: weston-mono-app
    network_mode: host
    security_opt:
      - seccomp:unconfined
    stdin_open: true # -i /interactive
    tty: true        # -t /
    privileged: true
    cap_add:
      - ALL
    device_cgroup_rules:
      - 'c 4:0 rmw'
      - 'c 4:7 rmw'
      - 'c 13:* rmw'
      - 'c 226:* rmw'
    volumes:
      - type: bind
        source: /tmp
        target: /tmp
      - type: bind
        source: /dev/dri
        target: /dev/dri
      - type: bind
        source: /run/udev
        target: /run/udev
      - type: bind
        source: /var/run/dbus
        target: /var/run/dbus
    restart: always

Here is the weston startup output:

apalis-imx6-10932060:/var/sota/storage/docker-compose$ docker-compose up &
Creating weston-mono-app ... done
Attaching to weston-mono-app
weston-mono-app    | SoC is: 'i.MX6Q'
weston-mono-app    | SoC has GPU: true
weston-mono-app    | SoC has DPU: false
weston-mono-app    | g2d implementation: viv
weston-mono-app    | Removing previously created '.X*-lock' entries under /tmp before starting Weston. Pass 'IGNORE_X_LOCKS=1' environment variable to Weston container to disable this behavior.
weston-mono-app    | dos2unix: converting file /etc/xdg/weston/weston.ini to Unix format...
weston-mono-app    | dos2unix: converting file /etc/xdg/weston-dev/weston.ini to Unix format...
weston-mono-app    | Switching VT mode of /dev/tty7 to text
weston-mono-app    | Date: 2022-09-29 UTC
weston-mono-app    | [13:58:32.307] weston 9.0.0
weston-mono-app    |                https://wayland.freedesktop.org
weston-mono-app    |                Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
weston-mono-app    |                Build: 9.0.0
weston-mono-app    | [13:58:32.308] Command line: /usr/bin/weston --current-mode
weston-mono-app    | Date: 2022-09-29 UTC
weston-mono-app    | [13:58:32.307] weston 9.0.0
weston-mono-app    |                https://wayland.freedesktop.org
weston-mono-app    |                Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
weston-mono-app    |                Build: 9.0.0
weston-mono-app    | [13:58:32.308] Command line: /usr/bin/weston --current-mode
weston-mono-app    | [13:58:32.309] OS: Linux, 5.4.193-5.7.0+git.f5d73fd6e9f8, #1-TorizonCore SMP Fri Jun 24 10:15:32 UTC 2022, armv7l
weston-mono-app    | [13:58:32.310] Using config file '/etc/xdg/weston/weston.ini'
weston-mono-app    | [13:58:32.311] Output repaint window is 7 ms maximum.
weston-mono-app    | [13:58:32.311] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/drm-backend.so'
weston-mono-app    | [13:58:32.309] OS: Linux, 5.4.193-5.7.0+git.f5d73fd6e9f8, #1-TorizonCore SMP Fri Jun 24 10:15:32 UTC 2022, armv7l
weston-mono-app    | [13:58:32.310] Using config file '/etc/xdg/weston/weston.ini'
weston-mono-app    | [13:58:32.311] Output repaint window is 7 ms maximum.
weston-mono-app    | [13:58:32.311] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/drm-backend.so'
weston-mono-app    | [13:58:32.333] initializing drm backend
weston-mono-app    | [13:58:32.333] initializing drm backend
weston-mono-app    | [13:58:32.334] logind: not running in a systemd session
weston-mono-app    | [13:58:32.334] logind: cannot setup systemd-logind helper (-61), using legacy fallback
weston-mono-app    | [13:58:32.334] logind: not running in a systemd session
weston-mono-app    | [13:58:32.334] logind: cannot setup systemd-logind helper (-61), using legacy fallback
weston-mono-app    | [13:58:32.347] using /dev/dri/card1
weston-mono-app    | [13:58:32.347] using /dev/dri/card1
weston-mono-app    | [13:58:32.347] DRM: supports atomic modesetting
weston-mono-app    | [13:58:32.347] DRM: supports atomic modesetting
weston-mono-app    | [13:58:32.347] DRM: supports GBM modifiers
weston-mono-app    | [13:58:32.348] DRM: supports picture aspect ratio
weston-mono-app    | [13:58:32.349] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/gl-renderer.so'
weston-mono-app    | [13:58:32.347] DRM: supports GBM modifiers
weston-mono-app    | [13:58:32.348] DRM: supports picture aspect ratio
weston-mono-app    | [13:58:32.349] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/gl-renderer.so'
weston-mono-app    | [13:58:32.812] EGL client extensions: EGL_EXT_device_base
weston-mono-app    |                EGL_EXT_device_enumeration EGL_EXT_device_query
weston-mono-app    |                EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses
weston-mono-app    |                EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device
weston-mono-app    |                EGL_EXT_platform_wayland EGL_KHR_platform_wayland
weston-mono-app    |                EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_gbm
weston-mono-app    |                EGL_KHR_platform_gbm[13:58:32.812] EGL client extensions: EGL_EXT_device_base
weston-mono-app    |                EGL_EXT_device_enumeration EGL_EXT_device_query
weston-mono-app    |                EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses
weston-mono-app    |                EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device
weston-mono-app    |                EGL_EXT_platform_wayland EGL_KHR_platform_wayland
weston-mono-app    |                EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_gbm
weston-mono-app    |                EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
weston-mono-app    |  EGL_MESA_platform_surfaceless
weston-mono-app    | [13:58:32.819] EGL version: 1.4
weston-mono-app    | [13:58:32.819] EGL vendor: Mesa Project
weston-mono-app    | [13:58:32.819] EGL client APIs: OpenGL OpenGL_ES
weston-mono-app    | [13:58:32.819] EGL extensions: EGL_ANDROID_blob_cache
weston-mono-app    |                EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age
weston-mono-app    |                EGL_EXT_image_dma_buf_import
weston-mono-app    |                EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2
weston-mono-app    |                EGL_KHR_config_attribs EGL_KHR_create_context
weston-mono-app    |                EGL_KHR_create_context_no_error EGL_KHR_fence_sync
weston-mono-app    |                EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image
weston-mono-app    |                EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
weston-mono-app    |                EGL_KHR_gl_texture_cubemap_image EGL_KHR_image
weston-mono-app    |                EGL_KHR_image_base EGL_KHR_image_pixmap
weston-mono-app    |                EGL_KHR_no_config_context EGL_KHR_reusable_sync
weston-mono-app    |                EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float
weston-mono-app    |                EGL_KHR_wait_sync EGL_MESA_configless_context
weston-mono-app    |                EGL_MESA_drm_image EGL_MESA_image_dma_buf_export
weston-mono-app    |                EGL_MESA_query_driver EGL_WL_bind_wayland_display
weston-mono-app    | [13:58:32.819] EGL_KHR_surfaceless_context available
weston-mono-app    | [13:58:32.819] EGL version: 1.4
weston-mono-app    | [13:58:32.819] EGL vendor: Mesa Project
weston-mono-app    | [13:58:32.819] EGL client APIs: OpenGL OpenGL_ES
weston-mono-app    | [13:58:32.819] EGL extensions: EGL_ANDROID_blob_cache
weston-mono-app    |                EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age
weston-mono-app    |                EGL_EXT_image_dma_buf_import
weston-mono-app    |                EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2
weston-mono-app    |                EGL_KHR_config_attribs EGL_KHR_create_context
weston-mono-app    |                EGL_KHR_create_context_no_error EGL_KHR_fence_sync
weston-mono-app    |                EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image
weston-mono-app    |                EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
weston-mono-app    |                EGL_KHR_gl_texture_cubemap_image EGL_KHR_image
weston-mono-app    |                EGL_KHR_image_base EGL_KHR_image_pixmap
weston-mono-app    |                EGL_KHR_no_config_context EGL_KHR_reusable_sync
weston-mono-app    |                EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float
weston-mono-app    |                EGL_KHR_wait_sync EGL_MESA_configless_context
weston-mono-app    |                EGL_MESA_drm_image EGL_MESA_image_dma_buf_export
weston-mono-app    |                EGL_MESA_query_driver EGL_WL_bind_wayland_display
weston-mono-app    | [13:58:32.819] EGL_KHR_surfaceless_context available
weston-mono-app    | [13:58:32.833] GL version: OpenGL ES 2.0 Mesa 20.3.5
weston-mono-app    | [13:58:32.833] GLSL version: OpenGL ES GLSL ES 1.0.16
weston-mono-app    | [13:58:32.833] GL vendor: etnaviv
weston-mono-app    | [13:58:32.833] GL version: OpenGL ES 2.0 Mesa 20.3.5
weston-mono-app    | [13:58:32.833] GLSL version: OpenGL ES GLSL ES 1.0.16
weston-mono-app    | [13:58:32.833] GL vendor: etnaviv
weston-mono-app    | [13:58:32.833] GL renderer: Vivante GC2000 rev 5108
weston-mono-app    | [13:58:32.833] GL renderer: Vivante GC2000 rev 5108
weston-mono-app    | [13:58:32.833] GL extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays
weston-mono-app    |                GL_EXT_texture_filter_anisotropic
weston-mono-app    |                GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1
weston-mono-app    |                GL_EXT_texture_format_BGRA8888
weston-mono-app    |                GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24
weston-mono-app    |                GL_OES_element_index_uint GL_OES_fbo_render_mipmap
weston-mono-app    |                GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
weston-mono-app    |                GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot
weston-mono-app    |                GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture
weston-mono-app    |                GL_AMD_performance_monitor GL_OES_packed_depth_stencil
weston-mono-app    |                GL_EXT_texture_type_2_10_10_10_REV GL_OES_get_program_binary
weston-mono-app    |                GL_APPLE_texture_max_level GL_EXT_discard_framebuffer
weston-mono-app    |                GL_EXT_read_format_bgra GL_EXT_frag_depth
weston-mono-app    |                GL_NV_fbo_color_attachments GL_OES_EGL_image_external
weston-mono-app    |                GL_OES_EGL_sync GL_OES_vertex_array_object
weston-mono-app    |                GL_ANGLE_pack_reverse_row_order
weston-mono-app    |                GL_ANGLE_texture_compression_dxt3
weston-mono-app    |                GL_ANGLE_texture_compression_dxt5
weston-mono-app    |                GL_EXT_occlusion_query_boolean GL_EXT_unpack_subimage
weston-mono-app    |                GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth
weston-mono-app    |                GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers
weston-mono-app    |                GL_EXT_map_buffer_range GL_KHR_debug
weston-mono-app    |                GL_KHR_texture_compression_astc_ldr GL_NV_pixel_buffer_object
weston-mono-app    |                GL_OES_required_internalformat GL_OES_surfaceless_context
weston-mono-app    |                GL_EXT_separate_shader_objects
weston-mono-app    |                GL_EXT_compressed_ETC1_RGB8_sub_texture
weston-mono-app    |                GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp
weston-mono-app    |                GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex
weston-mono-app    |                GL_OES_texture_border_clamp GL_KHR_no_error
weston-mono-app    |                GL_KHR_texture_compression_astc_sliced_3d
weston-mono-app    |                GL_EXT_texture_compression_s3tc_srgb
weston-mono-app    |                GL_KHR_parallel_shader_compile
weston-mono-app    | [13:58:32.833] GL extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays
weston-mono-app    |                GL_EXT_texture_filter_anisotropic
weston-mono-app    |                GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1
weston-mono-app    |                GL_EXT_texture_format_BGRA8888
weston-mono-app    |                GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24
weston-mono-app    |                GL_OES_element_index_uint GL_OES_fbo_render_mipmap
weston-mono-app    |                GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
weston-mono-app    |                GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot
weston-mono-app    |                GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture
weston-mono-app    |                GL_AMD_performance_monitor GL_OES_packed_depth_stencil
weston-mono-app    |                GL_EXT_texture_type_2_10_10_10_REV GL_OES_get_program_binary
weston-mono-app    |                GL_APPLE_texture_max_level GL_EXT_discard_framebuffer
weston-mono-app    |                GL_EXT_read_format_bgra GL_EXT_frag_depth
weston-mono-app    |                GL_NV_fbo_color_attachments GL_OES_EGL_image_external
weston-mono-app    |                GL_OES_EGL_sync GL_OES_vertex_array_object
weston-mono-app    |                GL_ANGLE_pack_reverse_row_order
weston-mono-app    |                GL_ANGLE_texture_compression_dxt3
weston-mono-app    |                GL_ANGLE_texture_compression_dxt5
weston-mono-app    |                GL_EXT_occlusion_query_boolean GL_EXT_unpack_subimage
weston-mono-app    |                GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth
weston-mono-app    |                GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers
weston-mono-app    |                GL_EXT_map_buffer_range GL_KHR_debug
weston-mono-app    |                GL_KHR_texture_compression_astc_ldr GL_NV_pixel_buffer_object
weston-mono-app    |                GL_OES_required_internalformat GL_OES_surfaceless_context
weston-mono-app    |                GL_EXT_separate_shader_objects
weston-mono-app    |                GL_EXT_compressed_ETC1_RGB8_sub_texture
weston-mono-app    |                GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp
weston-mono-app    |                GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex
weston-mono-app    |                GL_OES_texture_border_clamp GL_KHR_no_error
weston-mono-app    |                GL_KHR_texture_compression_astc_sliced_3d
weston-mono-app    |                GL_EXT_texture_compression_s3tc_srgb
weston-mono-app    |                GL_KHR_parallel_shader_compile
weston-mono-app    | [13:58:32.834] GL ES 2 renderer features:
weston-mono-app    |                read-back format: BGRA
weston-mono-app    |                wl_shm sub-image to texture: yes
weston-mono-app    |                EGL Wayland extension: yes
weston-mono-app    | [13:58:32.834] GL ES 2 renderer features:
weston-mono-app    |                read-back format: BGRA
weston-mono-app    |                wl_shm sub-image to texture: yes
weston-mono-app    |                EGL Wayland extension: yes
weston-mono-app    | [13:58:32.856] event1  - gpio-keys: is tagged by udev as: Keyboard
weston-mono-app    | [13:58:32.856] event1  - gpio-keys: is tagged by udev as: Keyboard
weston-mono-app    | [13:58:32.856] event1  - gpio-keys: device is a keyboard
weston-mono-app    | [13:58:32.856] event1  - gpio-keys: device is a keyboard
weston-mono-app    | [13:58:32.873] event0  - stmpe-ts: is tagged by udev as: Touchscreen
weston-mono-app    | [13:58:32.873] event0  - stmpe-ts: is tagged by udev as: Touchscreen
weston-mono-app    | [13:58:32.874] event0  - stmpe-ts: device is a touch device
weston-mono-app    | [13:58:32.874] event0  - stmpe-ts: device is a touch device
weston-mono-app    | [13:58:32.912] libinput: configuring device "gpio-keys".
weston-mono-app    | [13:58:32.912] libinput: configuring device "gpio-keys".
weston-mono-app    | [13:58:32.913] Touchscreen - stmpe-ts - /sys/devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-2/2-0041/stmpe-ts/input/input0/event0
weston-mono-app    | [13:58:32.913] Touchscreen - stmpe-ts - /sys/devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-2/2-0041/stmpe-ts/input/input0/event0
weston-mono-app    | [13:58:32.913] libinput: configuring device "stmpe-ts".
weston-mono-app    | [13:58:32.913] libinput: configuring device "stmpe-ts".
weston-mono-app    | [13:58:32.913] input device event0 has no enabled output associated (none named), skipping calibration for now.
weston-mono-app    | [13:58:32.913] input device event0 has no enabled output associated (none named), skipping calibration for now.
weston-mono-app    | [13:58:32.914] DRM: head 'HDMI-A-1' found, connector 54 is disconnected.
weston-mono-app    | [13:58:32.914] DRM: head 'HDMI-A-1' found, connector 54 is disconnected.
weston-mono-app    | [13:58:32.916] DRM: head 'DPI-1' found, connector 56 is connected, EDID make 'unknown', model 'unknown', serial 'unknown'
weston-mono-app    | [13:58:32.916] DRM: head 'DPI-1' found, connector 56 is connected, EDID make 'unknown', model 'unknown', serial 'unknown'
weston-mono-app    | [13:58:32.919] DRM: head 'VGA-1' found, connector 58 is disconnected.
weston-mono-app    | [13:58:32.920] Registered plugin API 'weston_drm_output_api_v1' of size 12
weston-mono-app    | [13:58:32.920] Registered plugin API 'weston_drm_virtual_output_api_v1' of size 24
weston-mono-app    | [13:58:32.921] Chosen EGL config details: id:  13 rgba: 8 8 8 0 buf: 24 dep:  0 stcl: 0 int: 1-1 type: win vis_id: XRGB8888 (0x34325258)
weston-mono-app    | [13:58:32.921] Output DPI-1 (crtc 41) video modes:
weston-mono-app    |                800x480@60.1, preferred, current, 33.2 MHz
weston-mono-app    | [13:58:32.922] associating input device event1 with output DPI-1 (none by udev)
weston-mono-app    | [13:58:32.922] associating input device event0 with output DPI-1 (none by udev)
weston-mono-app    | [13:58:32.919] DRM: head 'VGA-1' found, connector 58 is disconnected.
weston-mono-app    | [13:58:32.920] Registered plugin API 'weston_drm_output_api_v1' of size 12
weston-mono-app    | [13:58:32.920] Registered plugin API 'weston_drm_virtual_output_api_v1' of size 24
weston-mono-app    | [13:58:32.921] Chosen EGL config details: id:  13 rgba: 8 8 8 0 buf: 24 dep:  0 stcl: 0 int: 1-1 type: win vis_id: XRGB8888 (0x34325258)
weston-mono-app    | [13:58:32.921] Output DPI-1 (crtc 41) video modes:
weston-mono-app    |                800x480@60.1, preferred, current, 33.2 MHz
weston-mono-app    | [13:58:32.922] associating input device event1 with output DPI-1 (none by udev)
weston-mono-app    | [13:58:32.922] associating input device event0 with output DPI-1 (none by udev)
weston-mono-app    | [13:58:32.925] Output 'DPI-1' enabled with head(s) DPI-1
weston-mono-app    | [13:58:32.925] Compositor capabilities:
weston-mono-app    |                arbitrary surface rotation: yes
weston-mono-app    |                screen capture uses y-flip: yes
weston-mono-app    |                presentation clock: CLOCK_MONOTONIC, id 1
weston-mono-app    |                presentation clock resolution: 0.000000001 s
weston-mono-app    | [13:58:32.926] Loading module '/usr/lib/arm-linux-gnueabihf/weston/desktop-shell.so'
weston-mono-app    | [13:58:32.925] Output 'DPI-1' enabled with head(s) DPI-1
weston-mono-app    | [13:58:32.925] Compositor capabilities:
weston-mono-app    |                arbitrary surface rotation: yes
weston-mono-app    |                screen capture uses y-flip: yes
weston-mono-app    |                presentation clock: CLOCK_MONOTONIC, id 1
weston-mono-app    |                presentation clock resolution: 0.000000001 s
weston-mono-app    | [13:58:32.926] Loading module '/usr/lib/arm-linux-gnueabihf/weston/desktop-shell.so'
weston-mono-app    | [13:58:32.930] launching '/usr/lib/arm-linux-gnueabihf/weston-keyboard'
weston-mono-app    | [13:58:32.930] launching '/usr/lib/arm-linux-gnueabihf/weston-keyboard'
weston-mono-app    | [13:58:32.936] Loading module '/usr/lib/arm-linux-gnueabihf/weston/screen-share.so'
weston-mono-app    | [13:58:32.936] Loading module '/usr/lib/arm-linux-gnueabihf/weston/screen-share.so'
weston-mono-app    | [13:58:32.954] Screen share failed: No wl_shm found
weston-mono-app    | [13:58:32.955] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/xwayland.so'
weston-mono-app    | [13:58:32.954] Screen share failed: No wl_shm found
weston-mono-app    | [13:58:32.955] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/xwayland.so'
weston-mono-app    | [13:58:33.024] Registered plugin API 'weston_xwayland_v1' of size 16
weston-mono-app    | [13:58:33.024] Registered plugin API 'weston_xwayland_surface_v1' of size 8
weston-mono-app    | [13:58:33.024] Registered plugin API 'weston_xwayland_v1' of size 16
weston-mono-app    | [13:58:33.024] xserver listening on display :0
weston-mono-app    | [13:58:33.024] Registered plugin API 'weston_xwayland_surface_v1' of size 8
weston-mono-app    | [13:58:33.024] xserver listening on display :0
weston-mono-app    | [13:58:33.026] launching '/usr/lib/arm-linux-gnueabihf/weston-desktop-shell'
weston-mono-app    | [13:58:33.026] launching '/usr/lib/arm-linux-gnueabihf/weston-desktop-shell'
weston-mono-app    | [13:58:33.130] unknown child process exited
weston-mono-app    | [13:58:33.130] unknown child process exited

and here I have the output of the manual action from within the container:

apalis-imx6-10932060:/var/sota/storage/docker-compose$ docker exec -it weston-mono-app bash
root@apalis-imx6-10932060:/home/torizon# nohup mono --debug /opt/mono-app/app.exe
nohup: ignoring input and appending output to 'nohup.out'
weston-mono-app    | [14:00:43.826] Spawned Xwayland server, pid 48
weston-mono-app    | [14:00:43.826] Spawned Xwayland server, pid 48
weston-mono-app    | Require OpenGL version 2.1 or later.
weston-mono-app    | Failed to initialize glamor
weston-mono-app    | Failed to initialize glamor, falling back to sw
weston-mono-app    | Require OpenGL version 2.1 or later.
weston-mono-app    | Failed to initialize glamor
weston-mono-app    | Failed to initialize glamor, falling back to sw
weston-mono-app    | [14:00:44.885] xfixes version: 5.0
weston-mono-app    | [14:00:44.885] xfixes version: 5.0
weston-mono-app    | [14:00:44.958] created wm, root 1298
weston-mono-app    | [14:00:44.958] created wm, root 1298
weston-mono-app    | The XKEYBOARD keymap compiler (xkbcomp) reports:
weston-mono-app    | > Warning:          Unsupported maximum keycode 569, clipping.
weston-mono-app    | >                   X11 cannot support keycodes above 255.
weston-mono-app    | The XKEYBOARD keymap compiler (xkbcomp) reports:
weston-mono-app    | > Warning:          Unsupported maximum keycode 569, clipping.
weston-mono-app    | >                   X11 cannot support keycodes above 255.
weston-mono-app    | Errors from xkbcomp are not fatal to the X server
weston-mono-app    | Errors from xkbcomp are not fatal to the X server
root@apalis-imx6-10932060:/home/torizon#
root@apalis-imx6-10932060:/home/torizon# cat /opt/mono-app/log/GLib.log
2022-09-29 | 14:00:45.0785 | WARN  | Message: cannot open display: :0
Level: Warning
Domain: Gtk
StackTrace:   at App.Program.GLibLogHandler (System.String logDomain, GLib.LogLevelFlags logLevel, System.String message) [0x00000] in <92e3f0a23961483db8b8e6c8c29e71c9>:0
  at GLib.Log.<LogFuncTrampoline>m__0 (System.String domain, GLib.LogLevelFlags level, System.String message, GLib.LogFunc user_data) [0x00000] in <918680a31aa84cb89cfa7cab56ea29b8>:0
  at Gtk.Application.gtk_init (System.Int32& , System.IntPtr& ) [0x00000] in <91487213bf394f4aaf87012594abed2f>:0
  at Gtk.Application.Init () [0x00000] in <91487213bf394f4aaf87012594abed2f>:0
  at App.Program.InitializeApplication () [0x00000] in <92e3f0a23961483db8b8e6c8c29e71c9>:0
  at App.Program.Main (System.String[] args) [0x00000] in <92e3f0a23961483db8b8e6c8c29e71c9>:0

 (Program.GLibLogHandler:0)
root@apalis-imx6-10932060:/home/torizon#

Thanks, and best regards
bgo

Hi @bgo,

I think the problem is related to a permission issue related to Wayland, as detailed in these two links:

If you look at the entrypoint script used in our torizon/weston:2 container, you can see that torizon is the owner of the directory referenced in $XDG_RUNTIME_DIR. This is likely the same for your docker image, given that it is derived from torizon/weston:2.

Try running the GTK# app inside the container as user torizon and see if it works.

Best regards,
Lucas Akira

Hi @lucas_a.tx ,
thank you for the links and the hint. Running the app as user ‘torizon’ shows me a mono crash report. I will get back to you once I analyzed it.
Best regards,
bgo

Hi @bgo !

As a side note, Mono uses Windows.Forms, which is legacy.

I am not a dotNet expert, but maybe it is better to use a GUI Framework that doesn’t rely on legacy elements. Some examples: Avalonia, Uno Platform.

Best regards,

Hi @henrique.tx ,

thank you, I will discuss it with the team.

Best regards,
bgo