Skip to content

Commit ecf3b67

Browse files
committed
Fix XFCE not starting on device boot-up
Change-type: patch Signed-off-by: Alexandru Costache <alexandru@balena.io>
1 parent 735f078 commit ecf3b67

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

jetson-orin/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/tegra
6363
# Prevent screen from turning off
6464
RUN echo "#!/bin/bash" > /etc/X11/xinit/xserverrc \
6565
&& echo "" >> /etc/X11/xinit/xserverrc \
66-
&& echo 'exec /usr/bin/X -s 0 dpms' >> /etc/X11/xinit/xserverrc && \
67-
echo 'modules=("tegra_drm" "nvidia_drm" "nvidia_modeset"); for module in "${modules[@]}"; do if lsmod | grep -q ${module} ; then echo "Found $module"; rmmod $module; fi; done; startxfce4 & sleep 5; modprobe tegra_drm; modprobe nvidia_drm; while [ 1 ]; do sleep 10; done; ' > /opt/startxfce.sh
66+
&& echo 'exec /usr/bin/X -s 0 dpms' >> /etc/X11/xinit/xserverrc
67+
68+
6869

6970
## If any apt packages install mesa-egl, it will overwrite the tegra-egl
7071
## symlink and ld path, so the following command will ensure tegra-egl remains
@@ -122,6 +123,8 @@ RUN echo "#!/bin/bash" > /etc/X11/xinit/xserverrc \
122123
## deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.6, CUDA Runtime Version = 12.6, NumDevs = 1
123124
## Result = PASS
124125

126+
COPY startxfce.sh /opt/startxfce.sh
127+
RUN chmod +x /opt/startxfce.sh
125128
COPY entry.sh /usr/bin/entry.sh
126129
RUN chmod +x /usr/bin/entry.sh
127130

jetson-orin/entry.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,4 @@ echo "Starting UDEV..."
6767
start_udev
6868

6969
echo "Starting xfce script."
70-
chmod +x /opt/startxfce.sh
7170
exec /opt/startxfce.sh

jetson-orin/startxfce.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Ensure plymouth exited so that it won't hold /dev/fb0 open and tegra_drm can be unloaded
4+
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket \
5+
dbus-send \
6+
--system \
7+
--print-reply \
8+
--dest=org.freedesktop.systemd1 \
9+
/org/freedesktop/systemd1 \
10+
org.freedesktop.systemd1.Manager.StopUnit \
11+
string:plymouth-quit.service string:replace
12+
13+
# Prevent "Server is already active for display 0" error,
14+
# in case X was forcedly closed before
15+
rm -rf /tmp/.X0-lock* || true
16+
17+
# Prevent black screen with cursor only
18+
rm -rf /root/.config/ || true
19+
20+
modules=("tegra_drm" "nvidia_drm" "nvidia_modeset"); for module in "${modules[@]}";
21+
do
22+
if lsmod | grep -q ${module} ; then
23+
echo "Found $module"; rmmod $module;
24+
fi;
25+
done;
26+
27+
startxfce4 & sleep 5;
28+
29+
modprobe tegra_drm;
30+
modprobe nvidia_drm;
31+
while [ 1 ]; do
32+
sleep 10;
33+
done;

0 commit comments

Comments
 (0)