# Full desktop on Raspberry Pi CM4 fails to start

**URL:** <https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413>\
**Category:** Product support\
**Tags:** x11, raspberrypi4\
**Created:** [September 24, 2024, 1:06pm UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413 "2024-09-24T13:06:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thives](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thives](https://forums.balena.io/u/thives)\
**Post date:** [September 24, 2024, 1:06pm UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/1 "2024-09-24T13:06:45Z")

</div>

Hi  
We attempted to get a desktop environment working on a Raspberry Pi CM4 on a custom board (the host image is Raspberry Pi CM4 IO Board). HDMI0 is connected to a monitor and we get a splash screen, but it fails to start X. See log below.

The example from [Running a full desktop in a container](https://blog.balena.io/running-a-desktop-manager-with-balena/) failed to build because of a dependency on an old distro version, so we updated it to buster.

The GPU is given 256MB shared RAM.

Here is the dockerfile:

```auto
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian:buster-run

# Install XORG
RUN install_packages xserver-xorg-core \
  xserver-xorg-input-all \
  xserver-xorg-video-fbdev \
  xorg \
  xinit \
  xfce4 \
  xfce4-terminal \
  x11-xserver-utils \
  dbus-x11 \
  matchbox-keyboard \
  xterm

# Disable screen from turning it off
RUN echo "#!/bin/bash" > /etc/X11/xinit/xserverrc \
  && echo "" >> /etc/X11/xinit/xserverrc \
  && echo "rm -f /tmp/.X0-lock" >> /etc/X11/xinit/xserverrc \
  && echo 'exec /usr/bin/X -s 0 dpms -nolisten tcp "$@"' >> /etc/X11/xinit/xserverrc 

# Setting working directory
WORKDIR /usr/src/app

COPY . ./

ENV UDEV=1

# Avoid requesting XFCE4 question on X start
ENV XFCE_PANEL_MIGRATE_DEFAULT=1

CMD ["bash", "start_x86.sh"]

```

Here is start\_x64.sh:

```auto
#!/usr/bin/bash

export DISPLAY=:0.0
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

# start desktop manager
echo "STARTING X"
startx

```

Here is output from journalctl on the host OS:

```auto
Sep 24 12:55:09 206eb30 balena-supervisor[210288]: [event] Event: Service restart {"service":{"appId":1,"serviceId":1,"serviceName":"main","commit":"10ca12e1ea5e","rele>
Sep 24 12:55:09 206eb30 e9ccf1b90d0b[2170]: STARTING X
Sep 24 12:55:09 206eb30 systemd-udevd[655932]: Using default interface naming scheme 'v250'.
Sep 24 12:55:09 206eb30 e9ccf1b90d0b[2170]: hostname: No address associated with hostname
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: xauth: (stdin):1: bad display name "206eb30:0" in "add" command
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: X.Org X Server 1.20.4
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: X Protocol Version 11, Revision 0
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Build Operating System: Linux 6.1.0-20-arm64 aarch64 Debian
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Current Operating System: Linux 206eb30 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A->
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Build Date: 15 April 2024 11:30:14AM
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: xorg-server 2:1.20.4-1+deb10u14 (https://www.debian.org/support) 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Current version of pixman: 0.36.0
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Before reporting problems, check http://wiki.x.org
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: to make sure that you have the latest version.
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Markers: (--) probed, (**) from config file, (==) default setting,
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (++) from command line, (!!) notice, (II) informational,
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (==) Log file: "/var/log/Xorg.0.log", Time: Tue Sep 24 12:55:10 2024
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (==) Using system config directory "/usr/share/X11/xorg.conf.d"
Sep 24 12:55:10 206eb30 systemd-udevd[656050]: Using default interface naming scheme 'v250'.
Sep 24 12:55:10 206eb30 systemd-logind[1820]: Watching system buttons on /dev/input/event0 (vc4)
Sep 24 12:55:10 206eb30 systemd-logind[1820]: Watching system buttons on /dev/input/event1 (vc4)
Sep 24 12:55:10 206eb30 systemd-journald[1192]: Missed 1 kernel messages
Sep 24 12:55:10 206eb30 kernel: broken atomic modeset userspace detected, disabling atomic
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Fatal server error:
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) AddScreen/ScreenInit failed for driver 0
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: Please consult the The X.Org Foundation support 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: at http://wiki.x.org
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: for help. 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) 
Sep 24 12:55:10 206eb30 e9ccf1b90d0b[2170]: (EE) Server terminated with error (1). Closing log file.

```

At this point we are stuck and can’t get a graphical environment up, even just a simple app like xterm. Does anyone have any suggestions as to what we can try next?

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [September 25, 2024, 1:08am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/2 "2024-09-25T01:08:20Z")

</div>

Hello, is there any further detail in the /var/log/Xorg.0.log file? (Feel free to post it here.)

What is the resolution of the monitor you have attached?

---

<div class="post-metadata">

**Author:** ![thives](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thives](https://forums.balena.io/u/thives)\
**Post date:** [September 25, 2024, 8:49am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/3 "2024-09-25T08:49:32Z")

</div>

The monitor is an old BenQ G2420HDBL with native resolution 1920x1080.  
Here is the contents of /var/log/Xorg.0.log from the container:

```auto
[424.639] 
X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[424.645] Build Operating System: Linux 6.1.0-20-arm64 aarch64 Debian
[424.645] Current Operating System: Linux 206eb30 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64
[424.645] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:640x480M@60D,margin_left=32,margin_right=32,margin_top=32,margin_bottom=32 smsc95xx.macaddr=2C:CF:67:58:14:5B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=null quiet splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory root=UUID=ba1eadef-02d9-4825-882e-0cbe0f4dc532 rootwait
[424.646] Build Date: 15 April 2024 11:30:14AM
[424.646] xorg-server 2:1.20.4-1+deb10u14 (https://www.debian.org/support) 
[424.646] Current version of pixman: 0.36.0
[424.646] Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[424.646] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[424.647] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Sep 25 08:41:29 2024
[424.649] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[424.649] (==) No Layout section. Using the first Screen section.
[424.650] (==) No screen section available. Using defaults.
[424.650] (**) |-->Screen "Default Screen Section" (0)
[424.650] (**) | |-->Monitor "<default monitor>"
[424.650] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[424.651] (==) Automatically adding devices
[424.651] (==) Automatically enabling devices
[424.651] (==) Automatically adding GPU devices
[424.651] (==) Max clients allowed: 256, resource mask: 0x1fffff
[424.651] (WW) The directory "/usr/share/fonts/X11/misc" does not exist.
[424.651] Entry deleted from font path.
[424.651] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[424.651] Entry deleted from font path.
[424.651] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[424.651] Entry deleted from font path.
[424.651] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[424.651] Entry deleted from font path.
[424.652] (WW) The directory "/usr/share/fonts/X11/Type1" does not exist.
[424.652] Entry deleted from font path.
[424.652] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[424.652] Entry deleted from font path.
[424.652] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[424.652] Entry deleted from font path.
[424.653] (==) FontPath set to:
	built-ins
[424.653] (==) ModulePath set to "/usr/lib/xorg/modules"
[424.653] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[424.653] (II) Loader magic: 0x558ee34e08
[424.653] (II) Module ABI versions:
[424.653] X.Org ANSI C Emulation: 0.4
[424.653] X.Org Video Driver: 24.0
[424.653] X.Org XInput driver : 24.1
[424.653] X.Org Server Extension : 10.0
[424.667] (--) using VT number 2

[424.667] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[424.671] (II) xfree86: Adding drm device (/dev/dri/card0)
[424.704] (II) xfree86: Adding drm device (/dev/dri/card1)
[424.705] (II) no primary bus or device found
[424.705] falling back to /sys/devices/platform/gpu/drm/card0
[424.705] (II) LoadModule: "glx"
[424.706] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[424.721] (II) Module glx: vendor="X.Org Foundation"
[424.721] compiled for 1.20.4, module version = 1.0.0
[424.722] ABI class: X.Org Server Extension, version 10.0
[424.723] (==) Matched modesetting as autoconfigured driver 0
[424.723] (==) Matched fbdev as autoconfigured driver 1
[424.723] (==) Assigned the driver to the xf86ConfigLayout
[424.723] (II) LoadModule: "modesetting"
[424.726] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[424.727] (II) Module modesetting: vendor="X.Org Foundation"
[424.727] compiled for 1.20.4, module version = 1.20.4
[424.727] Module class: X.Org Video Driver
[424.727] ABI class: X.Org Video Driver, version 24.0
[424.727] (II) LoadModule: "fbdev"
[424.746] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[424.747] (II) Module fbdev: vendor="X.Org Foundation"
[424.747] compiled for 1.20.0, module version = 0.5.0
[424.747] Module class: X.Org Video Driver
[424.747] ABI class: X.Org Video Driver, version 24.0
[424.747] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[424.747] (II) FBDEV: driver for framebuffer: fbdev
[424.817] (II) modeset(0): using drv /dev/dri/card0
[424.818] (WW) Falling back to old probe method for fbdev
[424.818] (II) Loading sub module "fbdevhw"
[424.818] (II) LoadModule: "fbdevhw"
[424.818] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[424.819] (II) Module fbdevhw: vendor="X.Org Foundation"
[424.819] compiled for 1.20.4, module version = 0.0.2
[424.819] ABI class: X.Org Video Driver, version 24.0
[424.824] (II) modeset(0): Creating default Display subsection in Screen section
	"Default Screen Section" for depth/fbbpp 24/32
[424.824] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[424.824] (==) modeset(0): RGB weight 888
[424.824] (==) modeset(0): Default visual is TrueColor
[424.824] (II) Loading sub module "glamoregl"
[424.824] (II) LoadModule: "glamoregl"
[424.824] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[424.843] (II) Module glamoregl: vendor="X.Org Foundation"
[424.847] compiled for 1.20.4, module version = 1.0.1
[424.847] ABI class: X.Org ANSI C Emulation, version 0.4
[425.144] (II) modeset(0): glamor X acceleration enabled on VC4 V3D 2.1
[425.145] (II) modeset(0): glamor initialized
[425.158] (II) modeset(0): Output HDMI-1 has no monitor section
[425.160] (II) modeset(0): Output HDMI-2 has no monitor section
[425.199] (II) modeset(0): EDID for output HDMI-1
[425.199] (II) modeset(0): Manufacturer: BNQ Model: 785f Serial#: 21573
[425.200] (II) modeset(0): Year: 2010 Week: 29
[425.200] (II) modeset(0): EDID Version: 1.3
[425.200] (II) modeset(0): Digital Display Input
[425.200] (II) modeset(0): Max Image Size [cm]: horiz.: 53 vert.: 29
[425.200] (II) modeset(0): Gamma: 2.20
[425.200] (II) modeset(0): DPMS capabilities: Off
[425.200] (II) modeset(0): Supported color encodings: RGB 4:4:4 YCrCb 4:4:4 
[425.200] (II) modeset(0): Default color space is primary color space
[425.200] (II) modeset(0): First detailed timing is preferred mode
[425.200] (II) modeset(0): redX: 0.649 redY: 0.338 greenX: 0.289 greenY: 0.609
[425.200] (II) modeset(0): blueX: 0.146 blueY: 0.070 whiteX: 0.313 whiteY: 0.329
[425.201] (II) modeset(0): Supported established timings:
[425.201] (II) modeset(0): 720x400@70Hz
[425.201] (II) modeset(0): 640x480@60Hz
[425.201] (II) modeset(0): 640x480@75Hz
[425.201] (II) modeset(0): 800x600@60Hz
[425.201] (II) modeset(0): 800x600@75Hz
[425.201] (II) modeset(0): 832x624@75Hz
[425.201] (II) modeset(0): 1024x768@60Hz
[425.201] (II) modeset(0): 1024x768@75Hz
[425.201] (II) modeset(0): 1280x1024@75Hz
[425.201] (II) modeset(0): 1152x864@75Hz
[425.201] (II) modeset(0): Manufacturer's mask: 0
[425.201] (II) modeset(0): Supported standard timings:
[425.201] (II) modeset(0): #0: hsize: 1152 vsize 720 refresh: 60 vid: 113
[425.201] (II) modeset(0): #1: hsize: 1280 vsize 720 refresh: 60 vid: 49281
[425.201] (II) modeset(0): #2: hsize: 1280 vsize 960 refresh: 60 vid: 16513
[425.201] (II) modeset(0): #3: hsize: 1280 vsize 1024 refresh: 60 vid: 32897
[425.201] (II) modeset(0): #4: hsize: 1600 vsize 900 refresh: 60 vid: 49321
[425.201] (II) modeset(0): #5: hsize: 1680 vsize 1050 refresh: 60 vid: 179
[425.201] (II) modeset(0): #6: hsize: 1920 vsize 1080 refresh: 60 vid: 49361
[425.201] (II) modeset(0): Supported detailed timing:
[425.201] (II) modeset(0): clock: 148.5 MHz Image Size: 477 x 268 mm
[425.205] (II) modeset(0): h_active: 1920 h_sync: 2008 h_sync_end 2052 h_blank_end 2200 h_border: 0
[425.205] (II) modeset(0): v_active: 1080 v_sync: 1084 v_sync_end 1089 v_blanking: 1125 v_border: 0
[425.205] (II) modeset(0): Serial No: 67A08481SL000
[425.205] (II) modeset(0): Ranges: V min: 50 V max: 76 Hz, H min: 24 H max: 83 kHz, PixClock max 175 MHz
[425.205] (II) modeset(0): Monitor name: G2420HDBL
[425.205] (II) modeset(0): EDID (in hex):
[425.205] (II) modeset(0): 00ffffffffffff0009d15f7845540000
[425.205] (II) modeset(0): 1d14010380351d782e6085a6564a9c25
[425.205] (II) modeset(0): 125054a56b80710081c081408180a9c0
[425.205] (II) modeset(0): b300d1c00101023a801871382d40582c
[425.205] (II) modeset(0): 4500dd0c1100001e000000ff00363741
[425.205] (II) modeset(0): 3038343831534c303030000000fd0032
[425.205] (II) modeset(0): 4c185311000a202020202020000000fc
[425.205] (II) modeset(0): 0047323432304844424c0a20202000be
[425.206] (II) modeset(0): Printing probed modes for output HDMI-1
[425.206] (II) modeset(0): Modeline "1920x1080"x60.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz eP)
[425.206] (II) modeset(0): Modeline "1680x1050"x59.9 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync (64.7 kHz e)
[425.206] (II) modeset(0): Modeline "1600x900"x60.0 108.00 1600 1624 1704 1800 900 901 904 1000 +hsync +vsync (60.0 kHz e)
[425.206] (II) modeset(0): Modeline "1280x1024"x75.0 135.00 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync (80.0 kHz e)
[425.206] (II) modeset(0): Modeline "1280x1024"x60.0 108.00 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync (64.0 kHz e)
[425.206] (II) modeset(0): Modeline "1280x960"x60.0 108.00 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync (60.0 kHz e)
[425.206] (II) modeset(0): Modeline "1152x864"x75.0 108.00 1152 1216 1344 1600 864 865 868 900 +hsync +vsync (67.5 kHz e)
[425.206] (II) modeset(0): Modeline "1280x720"x60.0 74.25 1280 1390 1430 1650 720 725 730 750 +hsync +vsync (45.0 kHz e)
[425.206] (II) modeset(0): Modeline "1024x768"x75.0 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync (60.0 kHz e)
[425.206] (II) modeset(0): Modeline "1024x768"x60.0 65.00 1024 1048 1184 1344 768 771 777 806 -hsync -vsync (48.4 kHz e)
[425.206] (II) modeset(0): Modeline "832x624"x74.6 57.28 832 864 928 1152 624 625 628 667 -hsync -vsync (49.7 kHz e)
[425.206] (II) modeset(0): Modeline "800x600"x75.0 49.50 800 816 896 1056 600 601 604 625 +hsync +vsync (46.9 kHz e)
[425.206] (II) modeset(0): Modeline "800x600"x60.3 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync (37.9 kHz e)
[425.206] (II) modeset(0): Modeline "640x480"x75.0 31.50 640 656 720 840 480 481 484 500 -hsync -vsync (37.5 kHz e)
[425.206] (II) modeset(0): Modeline "640x480"x59.9 25.18 640 656 752 800 480 490 492 525 -hsync -vsync (31.5 kHz e)
[425.206] (II) modeset(0): Modeline "720x400"x70.1 28.32 720 738 846 900 400 412 414 449 -hsync +vsync (31.5 kHz e)
[425.206] (II) modeset(0): EDID for output HDMI-2
[425.207] (II) modeset(0): Output HDMI-1 connected
[425.207] (II) modeset(0): Output HDMI-2 disconnected
[425.207] (II) modeset(0): Using exact sizes for initial modes
[425.207] (II) modeset(0): Output HDMI-1 using initial mode 1920x1080 +0+0
[425.207] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[425.207] (==) modeset(0): DPI set to (96, 96)
[425.207] (II) Loading sub module "fb"
[425.207] (II) LoadModule: "fb"
[425.210] (II) Loading /usr/lib/xorg/modules/libfb.so
[425.211] (II) Module fb: vendor="X.Org Foundation"
[425.211] compiled for 1.20.4, module version = 1.0.0
[425.211] ABI class: X.Org ANSI C Emulation, version 0.4
[425.211] (II) UnloadModule: "fbdev"
[425.211] (II) Unloading fbdev
[425.212] (II) UnloadSubModule: "fbdevhw"
[425.212] (II) Unloading fbdevhw
[425.212] (EE) 
Fatal server error:
[425.212] (EE) AddScreen/ScreenInit failed for driver 0
[425.213] (EE) 
[425.213] (EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
[425.213] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[425.213] (EE) 
[425.232] (EE) Server terminated with error (1). Closing log file.

```

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [September 25, 2024, 9:25am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/4 "2024-09-25T09:25:05Z")

</div>

Hello @thives could you please share more details of the hardware that you are using?

You mentioned `Raspberry Pi CM4 on a custom board` let’s discard first that there is any incompatibility here with the CM4 balenaOS image.

In addition, you are running the Dockerfile template designed for `x86` architecture instead of the Raspberry Pi. Could you please try the project running the Dockerfile template for Raspberry Pi 3?

Thanks!

---

<div class="post-metadata">

**Author:** ![thives](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thives](https://forums.balena.io/u/thives)\
**Post date:** [September 25, 2024, 12:33pm UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/5 "2024-09-25T12:33:10Z")

</div>

It works with the other Dockerfile as long as we use the raspberrypi3 image. We would prefer to use an image that matches our hardware as much as possible though. Do you happen to know what could be missing from our first attempts that caused the issue?

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [September 27, 2024, 10:44am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/6 "2024-09-27T10:44:53Z")

</div>

Hello @thives thanks for confirming that running the `raspberrypi3`!

Did you try to clone the repo and try with another baseimage more similar than your CM4 board (e.g.)?

```auto
FROM balenalib/raspberrypi4-64-debian:buster

```

or

```auto
FROM balenalib/raspberrypicm4-ioboard-debian:buster

```

Let us know if that works!

---

<div class="post-metadata">

**Author:** ![thives](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thives](https://forums.balena.io/u/thives)\
**Post date:** [October 2, 2024, 11:56am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/7 "2024-10-02T11:56:55Z")

</div>

It is the same story with both of those images (the cm4 image don’t have access to the same packages as the other 2 as well).

It seems to work when we do a balena push to the device in local mode, and then it fails after reset/reboot (still in local mode). Sometimes the container is repeatedly reset, and other times it shows a cmd line login after X fails to start (I’m guessing resetting is the correct behavior when X fails).

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [October 3, 2024, 10:11am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/8 "2024-10-03T10:11:37Z")

</div>

@thives could you please share the logs?

Thanks!

---

<div class="post-metadata">

**Author:** ![jakogut](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jakogut](https://forums.balena.io/u/jakogut)\
**Post date:** [October 3, 2024, 5:06pm UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/9 "2024-10-03T17:06:17Z")

</div>

Hello,

There’s a lot to go over here. First, you’ll want to make sure you’ve enabled either the vc4-kms-v3d or vc4-fkms-v3d overlay. These overlays enable the GPU and reserve memory for it.

Next, you’re on the right track with setting up Xorg as a display server. Another option that’s equally valid, and slightly more modern, is a Wayland compositor like Weston. Like an X server, a Wayland compositor exposes a UNIX socket (typically at `${XDG_RUNTIME_DIR}/wayland-1`, rather than `/tmp/.X11-unix/X0`) that clients can connect to. Clients find the correct socket using the `DISPLAY` variable for X11, and `WAYLAND_DISPLAY` for wayland. Wayland compositors also have general compatibility with X clients through Xwayland.

Your dockerfile is mostly correct. You shouldn’t need xserver-xorg-video-fbdev, however. This is an old school Device Dependent X (DDX) driver for the [framebuffer device](https://docs.kernel.org/fb/framebuffer.html) API, which is largely deprecated in favor of the Linux [Direct Rendering Manager](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) layer (DRM) and [kernel modesetting](https://www.kernel.org/doc/html/v4.15/gpu/drm-kms.html) (KMS). The Pi 4 supports KMS, so you want to use the modesetting DDX, included in the `xserver-xorg-core` package in Debian Buster, and only if you’re using Xorg. Any modern server will autoconfigure this driver when supported, without any explicit configuration. DDX drivers are no longer used with Wayland, as compositors interact with the kernel directly using the DRM and KMS interfaces.

Next, you probably don’t want to use the host OS dbus system bus inside your container for general applications. This bus is used for communicating with host OS services like systemd and NetworkManager. For example, to stop a host OS service, or configure a network interface from inside a container.

If you need IPC in your application, especially between user level programs running containerized, you can run a session bus in a container to allow your services to communicate together. You can find an example of this in the [dbus block](https://github.com/balena-labs-projects/dbus), but many applications also work fine without dbus, depending on the use case. Basic graphical applications don’t require a session bus, let alone access to the host OS system bus.

Your application will also need Mesa for libGL, libEGL, etc. for rendering. If you’re using a compose file, you’ll need to add a section to map the devices at `/dev/dri` into your container, or you can run it privileged (I don’t recommend this unless it’s necessary). If you’re not using a compose file, your container runs privileged by default, and has devices mapped into the container already.

Udev is really only necessary for notifying the display server, whether Xorg or Wayland based, of input devices. If you’re not using any input devices, udev is probably unnecessary.

Let us know if this helps, and if I can provide any further guidance. I’d start with ensuring the modesetting DDX is being used and go from there.

Updating to Debian bookworm would probably also be a good step, a Wayland compositor may be worth looking at, and I can also give you some tips on how to mount your own devtmpfs and run udev inside of any base image if that would be helpful.

---

<div class="post-metadata">

**Author:** ![thives](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thives](https://forums.balena.io/u/thives)\
**Post date:** [October 4, 2024, 7:36am UTC](https://forums.balena.io/t/full-desktop-on-raspberry-pi-cm4-fails-to-start/371413/10 "2024-10-04T07:36:54Z")

</div>

Currently the Dockerfile is almost identical to the one from the blog post.

The device host set up with development OS in local mode.

I might actually have an idea of what’s going wrong here. When we do a balena push it works and we get this log:

```auto
[Info] Streaming device logs...
[Live] Watching for file changes...
[Live] Waiting for device state to settle...
[Logs] [2024-10-04T07:03:42.995Z] Restarting service 'main sha256:5214087cb8c0037159f0a26e9936278484c6a95261ff8a6b3da2c659a536ea1f'
[Logs] [2024-10-04T07:03:43.815Z] Taking update locks
[Logs] [2024-10-04T07:03:43.622Z] [main] STARTING X
[Logs] [2024-10-04T07:03:43.992Z] [main] hostname: No address associated with hostname
[Logs] [2024-10-04T07:03:44.304Z] [main] xauth: (stdin):1: bad display name "206eb30:0" in "add" command
[Logs] [2024-10-04T07:03:44.304Z] [main] 
[Logs] [2024-10-04T07:03:44.359Z] [main] 
[Logs] [2024-10-04T07:03:44.359Z] [main] X.Org X Server 1.20.4
[Logs] [2024-10-04T07:03:44.359Z] [main] X Protocol Version 11, Revision 0
[Logs] [2024-10-04T07:03:44.359Z] [main] Build Operating System: Linux 6.1.0-20-arm64 aarch64 Debian
[Logs] [2024-10-04T07:03:44.360Z] [main] Current Operating System: Linux 206eb30 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64
[Logs] [2024-10-04T07:03:44.360Z] [main] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:640x480M@60D,margin_left=32,margin_right=32,margin_top=32,margin_bottom=32 smsc95xx.macaddr=2C:CF:67:58:14:5B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=null quiet splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory root=UUID=ba1eadef-02d9-4825-882e-0cbe0f4dc532 rootwait
[Logs] [2024-10-04T07:03:44.360Z] [main] Build Date: 15 April 2024 11:30:14AM
[Logs] [2024-10-04T07:03:44.361Z] [main] xorg-server 2:1.20.4-1+deb10u14 (https://www.debian.org/support) 
[Logs] [2024-10-04T07:03:44.361Z] [main] Current version of pixman: 0.36.0
[Logs] [2024-10-04T07:03:44.361Z] [main] Before reporting problems, check http://wiki.x.org
[Logs] [2024-10-04T07:03:44.361Z] [main] to make sure that you have the latest version.
[Logs] [2024-10-04T07:03:44.361Z] [main] Markers: (--) probed, (**) from config file, (==) default setting,
[Logs] [2024-10-04T07:03:44.361Z] [main] (++) from command line, (!!) notice, (II) informational,
[Logs] [2024-10-04T07:03:44.362Z] [main] (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[Logs] [2024-10-04T07:03:44.362Z] [main] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Oct 4 07:03:44 2024
[Logs] [2024-10-04T07:03:44.362Z] [main] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[Logs] [2024-10-04T07:03:44.908Z] [main] (EE) 
[Logs] [2024-10-04T07:03:44.909Z] [main] Fatal server error:
[Logs] [2024-10-04T07:03:44.910Z] [main] (EE) AddScreen/ScreenInit failed for driver 0
[Logs] [2024-10-04T07:03:44.910Z] [main] (EE) 
[Logs] [2024-10-04T07:03:44.910Z] [main] (EE) 
[Logs] [2024-10-04T07:03:44.910Z] [main] Please consult the The X.Org Foundation support 
[Logs] [2024-10-04T07:03:44.910Z] [main] at http://wiki.x.org
[Logs] [2024-10-04T07:03:44.911Z] [main] for help. 
[Logs] [2024-10-04T07:03:44.911Z] [main] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[Logs] [2024-10-04T07:03:44.911Z] [main] (EE) 
[Logs] [2024-10-04T07:03:44.934Z] [main] (EE) Server terminated with error (1). Closing log file.
[Logs] [2024-10-04T07:03:45.555Z] Killing service 'main sha256:5214087cb8c0037159f0a26e9936278484c6a95261ff8a6b3da2c659a536ea1f'
[Logs] [2024-10-04T07:03:56.763Z] Service exited 'main sha256:5214087cb8c0037159f0a26e9936278484c6a95261ff8a6b3da2c659a536ea1f'
[Logs] [2024-10-04T07:03:56.851Z] Killed service 'main sha256:5214087cb8c0037159f0a26e9936278484c6a95261ff8a6b3da2c659a536ea1f'
[Logs] [2024-10-04T07:03:58.766Z] Installing service 'main sha256:27cc1c73f71d754735a8447ae6a5b7f76b5b79fed95294ec4267cc312fd0620c'
[Logs] [2024-10-04T07:03:58.891Z] Installed service 'main sha256:27cc1c73f71d754735a8447ae6a5b7f76b5b79fed95294ec4267cc312fd0620c'
[Logs] [2024-10-04T07:03:58.892Z] Starting service 'main sha256:27cc1c73f71d754735a8447ae6a5b7f76b5b79fed95294ec4267cc312fd0620c'
[Logs] [2024-10-04T07:03:59.839Z] Started service 'main sha256:27cc1c73f71d754735a8447ae6a5b7f76b5b79fed95294ec4267cc312fd0620c'
[Logs] [2024-10-04T07:04:00.462Z] [main] Starting X in 2 seconds
[Logs] [2024-10-04T07:04:01.724Z] Releasing update locks
[Logs] [2024-10-04T07:04:02.526Z] [main] hostname: No address associated with hostname
[Logs] [2024-10-04T07:04:02.581Z] [main] xauth: file /root/.Xauthority does not exist
[Logs] [2024-10-04T07:04:02.602Z] [main] xauth: (stdin):1: bad display name "206eb30:0" in "add" command
[Logs] [2024-10-04T07:04:02.611Z] [main] 
[Logs] [2024-10-04T07:04:02.706Z] [main] 
[Logs] [2024-10-04T07:04:02.707Z] [main] X.Org X Server 1.20.4
[Logs] [2024-10-04T07:04:02.707Z] [main] X Protocol Version 11, Revision 0
[Logs] [2024-10-04T07:04:02.707Z] [main] Build Operating System: Linux 5.4.0-109-generic aarch64 Debian
[Logs] [2024-10-04T07:04:02.707Z] [main] Current Operating System: Linux 206eb30 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64
[Logs] [2024-10-04T07:04:02.708Z] [main] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:640x480M@60D,margin_left=32,margin_right=32,margin_top=32,margin_bottom=32 smsc95xx.macaddr=2C:CF:67:58:14:5B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=null quiet splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory root=UUID=ba1eadef-02d9-4825-882e-0cbe0f4dc532 rootwait
[Logs] [2024-10-04T07:04:02.708Z] [main] Build Date: 04 April 2023 07:50:56AM
[Logs] [2024-10-04T07:04:02.709Z] [main] xorg-server 2:1.20.4-1+rpt4+deb10u9 (https://www.debian.org/support) 
[Logs] [2024-10-04T07:04:02.709Z] [main] Current version of pixman: 0.36.0
[Logs] [2024-10-04T07:04:02.709Z] [main] Before reporting problems, check http://wiki.x.org
[Logs] [2024-10-04T07:04:02.710Z] [main] to make sure that you have the latest version.
[Logs] [2024-10-04T07:04:02.710Z] [main] Markers: (--) probed, (**) from config file, (==) default setting,
[Logs] [2024-10-04T07:04:02.710Z] [main] (++) from command line, (!!) notice, (II) informational,
[Logs] [2024-10-04T07:04:02.711Z] [main] (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[Logs] [2024-10-04T07:04:02.711Z] [main] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Oct 4 07:04:02 2024
[Logs] [2024-10-04T07:04:02.715Z] [main] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[Live] Device state settled
[Logs] [2024-10-04T07:04:04.398Z] [main] (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.

```

Then we reset the device and it boots and fails. There’s a character limit on these posts, so I’ll have to upload the log file, but I’m seeing is this in there:  
[balena.log](https://forums.balena.io/uploads/short-url/8dQzde7dd5zU7v8ossY2x1ypSZP.log) (315.3 KB)

```auto
Oct 04 07:15:50 206eb30 ca5ad6274071[2169]: [debug] Replacing container for service main because of config changes:
Oct 04 07:15:50 206eb30 balena-supervisor[3483]: [debug] Replacing container for service main because of config changes:
Oct 04 07:15:50 206eb30 ca5ad6274071[2169]: [debug] Non-array fields: {"added":{"environment":{"XFCE_PANEL_MIGRATE_DEFAULT":"1"}},"deleted":{},"updated":{"image":"sha256:5214087cb8c0037159f0a26e9936278484c6a95261ff8a6b3da2c659a536ea1f","labels":{"io.balena.device-type":"raspberrypicm4-ioboard"},"command":{"1":"start_x86.sh"}}}

```

You can see that the hash matches that of the container that was replaced by the balena push command. The log also references start\_x86.sh, which was from a previous attempt last week. Does this mean that the container that we now install with balena push is not persistent? The documentation [here](https://docs.balena.io/reference/balena-cli/#push-fleetordevice) does not mention this.
