# Running a CLI Application on Device Display

**URL:** <https://forums.balena.io/t/running-a-cli-application-on-device-display/4955>\
**Category:** Product support\
**Tags:** raspberrypi3\
**Created:** [January 10, 2019, 11:49pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955 "2019-01-10T23:49:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowderd](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lowderd](https://forums.balena.io/u/lowderd)\
**Post date:** [January 10, 2019, 11:49pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/1 "2019-01-10T23:49:43Z")

</div>

Hello!

I’m currently working on moving a project that is using a CLI interface on Raspbian Lite to balenaCloud. The Dockerfile is currently working correctly and I can interact with the CLI using the Terminal on the balenaCloud Dashboard.

I need to configure the Raspberry Pi to use the connected display and keyboard for displaying and receiving input, however I’ve only been able to get the standard BalenaOS screen to be displayed. Are there any tutorials on how to display and receive input using a terminal on the device?

Thanks,  
Duncan

---

<div class="post-metadata">

**Author:** ![richbayliss](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/richbayliss/32/1054_2.png) [@richbayliss](https://forums.balena.io/u/richbayliss)\
**Post date:** [January 11, 2019, 2:35pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/5 "2019-01-11T14:35:48Z")

</div>

@lowderd yeah that might be an issue since getty is waiting on TTY1. You could run an Xorg session though and bring up a full screen Xterm?

I think we have someone putting together a blog post for starting Xorg from a container, so look out for that one.

---

<div class="post-metadata">

**Author:** ![richbayliss](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/richbayliss/32/1054_2.png) [@richbayliss](https://forums.balena.io/u/richbayliss)\
**Post date:** [January 11, 2019, 2:35pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/6 "2019-01-11T14:35:57Z")

</div>

@lowderd yeah that might be an issue since getty is waiting on TTY1. You could run an Xorg session though and bring up a full screen Xterm?  
I think we have someone putting together a blog post for starting Xorg from a container, so look out for that one.

---

<div class="post-metadata">

**Author:** ![deanputney](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/deanputney/32/1468_2.png) [@deanputney](https://forums.balena.io/u/deanputney)\
**Post date:** [January 14, 2019, 11:19pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/8 "2019-01-14T23:19:26Z")

</div>

I’d also be interested in this blog post. I can definitely get xterm to start up but so far it just won’t respond to the keyboard despite a number of different approaches.

Is there any information your team could provide in advance of the blog post? Any idea when that might come out? Thanks!

---

<div class="post-metadata">

**Author:** ![lowderd](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lowderd](https://forums.balena.io/u/lowderd)\
**Post date:** [January 18, 2019, 10:08pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/9 "2019-01-18T22:08:48Z")

</div>

To get input from the attached keyboard I needed to set UDEV=1, I was use to using the resin base images and hadn’t read about the change in the balenalib base images that sets UDEV off by default. Here’s an example Dockerfile that will run a script titled ‘script.sh’ in xterm on startup.

```
FROM balenalib/raspberrypi3-python:latest

ENV UDEV=1

RUN apt-get update && apt-get install -y \
    xorg \
    xserver-xorg \
    xserver-xorg-core \
    xserver-xorg-input-evdev \
    xserver-xorg-input-kbd \
    xinit \
    xterm

COPY ./script.sh ./

CMD xinit -geometry 1024x600 -e "./script.sh"
```

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [January 24, 2019, 5:14pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/10 "2019-01-24T17:14:45Z")

</div>

Hey @lowderd, just a quick update on this. I have the sample project working, I will just finish a few detail and I will send you the git-repo link once I push everything to github.

The blog post should go live next week or so.

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [January 25, 2019, 4:04am UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/11 "2019-01-25T04:04:49Z")

</div>

@lowderd here you go: [https://github.com/balena-io-playground/balena-x11-example](https://github.com/balena-io-playground/balena-x11-example)

Keep in mind that it is still WIP.

Cheers

---

<div class="post-metadata">

**Author:** ![chrisys](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/chrisys/32/1731_2.png) [@chrisys](https://forums.balena.io/u/chrisys)\
**Post date:** [March 12, 2019, 10:54pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/16 "2019-03-12T22:54:36Z")

</div>

Hi all, we have today published a blog post that covers running an x11 GUI application with a mouse and keyboard on balenaCloud. Here’s the link: [https://www.balena.io/blog/running-a-desktop-manager-with-balena/](https://www.balena.io/blog/running-a-desktop-manager-with-balena/)

---

<div class="post-metadata">

**Author:** ![lowderd](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lowderd](https://forums.balena.io/u/lowderd)\
**Post date:** [March 13, 2019, 7:57pm UTC](https://forums.balena.io/t/running-a-cli-application-on-device-display/4955/19 "2019-03-13T19:57:02Z")

</div>

Thanks! This is an awesome example and exactly what we were looking for.
