[PATCH 1/1] kas-container: fallback to xterm if TERM is not supported

2 views
Skip to first unread message

Felix Moessbauer

unread,
Jul 23, 2025, 6:07:23 AMJul 23
to kas-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Felix Moessbauer, Michael Adler
Currently, we just forward the TERM variable into the container. This
breaks, if the user uses a terminal emulator on the host that misses the
terminfo inside the container (like foot). Then, tools like kas menu or
bitbake fail to start.

To mitigate this, we check in the container entrypoint if we have the
terminfo for that terminal. If not, we fall back to xterm, as nearly all
terminal emulators implement a superset of xterm.

Reported-by: Michael Adler <michae...@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
container-entrypoint | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/container-entrypoint b/container-entrypoint
index 927248db7..b9514a445 100755
--- a/container-entrypoint
+++ b/container-entrypoint
@@ -54,6 +54,11 @@ may also need to update the host distribution (e.g. Debian Jessie -> Stretch).
EOF
fi

+# if the container is started from a not supported terminal, fallback to xterm
+if [ -n "$TERM" ]; then
+ infocmp "$TERM" > /dev/null || TERM=xterm
+fi
+
if [ -z "$USER_ID" ] || [ "$USER_ID" = 0 ]; then
# Not a kas-container call, or we shall run everything as root
GOSU=""
--
2.50.0

Felix Moessbauer

unread,
Jul 23, 2025, 6:11:37 AMJul 23
to kas-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Felix Moessbauer, Michael Adler
Currently, we just forward the TERM variable into the container. This
breaks, if the user uses a terminal emulator on the host that misses the
terminfo inside the container (like foot). Then, tools like kas menu or
bitbake fail to start.

To mitigate this, we check in the container entrypoint if we have the
terminfo for that terminal. If not, we fall back to xterm, as nearly all
terminal emulators implement a superset of xterm.

Reported-by: Michael Adler <michae...@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
Changes since v1:

- also redirect stderr

container-entrypoint | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/container-entrypoint b/container-entrypoint
index 927248db7..2694e15a1 100755
--- a/container-entrypoint
+++ b/container-entrypoint
@@ -54,6 +54,11 @@ may also need to update the host distribution (e.g. Debian Jessie -> Stretch).
EOF
fi

+# if the container is started from a not supported terminal, fallback to xterm
+if [ -n "$TERM" ]; then
+ infocmp "$TERM" > /dev/null 2>&1 || TERM=xterm

Michael Adler

unread,
Jul 23, 2025, 6:35:32 AMJul 23
to Felix Moessbauer, kas-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com
Works for me, thanks :)

Tested-by: Michael Adler <michae...@siemens.com>

--
Michael Adler

Siemens AG
Technology
Connectivity & Edge
Open Source Embedded Systems
FT RPD CED OES-DE
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann
Snabe; Managing Board: Roland Busch, Chairman, President and Chief Executive
Officer; Cedrik Neike, Matthias Rebellius, Ralf P. Thomas, Judith Wiese;
Registered offices: Berlin and Munich, Germany; Commercial registries:
Berlin-Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322

Jan Kiszka

unread,
Aug 7, 2025, 12:10:29 PMAug 7
to Felix Moessbauer, kas-...@googlegroups.com, cedric.h...@siemens.com, Michael Adler
Thanks, applied.

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages