# GUI / Xinit problems

**URL:** <https://forums.balena.io/t/gui-xinit-problems/874>\
**Category:** Product support\
**Tags:** x11\
**Created:** [April 30, 2017, 8:25pm UTC](https://forums.balena.io/t/gui-xinit-problems/874 "2017-04-30T20:25:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [April 30, 2017, 8:25pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/1 "2017-04-30T20:25:30Z")

</div>

Hello Resin Team and Docker Friends,

I am currently working on a project which involves a Python GUI which needs to be feed from a Docker Container to an HDMI screen, getting input from Mouse and Keyboard - using the current ResinOS as a local install (so the current resinOS 2.0.0+rev3.dev for RPi3). There are some projects which do the same and I found here, namely:

> **[TechHub/RPiBrowser-resin.io](https://github.com/TechHub/RPiBrowser-resin.io)**
>
> RPi client code to spawn a browser and show the community messages on the display, using Resin.io - TechHub/RPiBrowser-resin.io

  

> **[pcarranzav/resin-electron-app](https://github.com/pcarranzav/resin-electron-app)**
>
> Contribute to pcarranzav/resin-electron-app development by creating an account on GitHub.

  

> **[balena-io/balena-electronjs](https://github.com/balena-io/balena-electronjs)**
>
> electronJS-based resin application template. Contribute to balena-io/balena-electronjs development by creating an account on GitHub.

As I do try to make an small, reusable (for different projects :)) and somehow reliable working solution, I went with [https://github.com/pcarranzav/resin-electron-app](https://github.com/pcarranzav/resin-electron-app) as a starting point and created following scripts based on the code shown there:

> **[nmaas87/docker-raspbian\_xinit](https://github.com/nmaas87/docker-raspbian_xinit/tree/master/xinit_latest)**
>
> Dockerfile for Raspbian ARM Container with xinit. Contribute to nmaas87/docker-raspbian\_xinit development by creating an account on GitHub.

The Dockerfile contains additional stuff like using the current jessie Image from resin, the only thing I changed was adding the cross-build stuff which the resin Team described, so that I can let this image build on [hub.docker.com](http://hub.docker.com) :).

In my example, I launched gedit in the end through launch\_app.sh - but - most of the time, this does not work correctly: It does only grab keyboard/mouse input from time to time. Any ideas on how to improve the code and make it work more reliable? (If I try to run it with docker run nmaas87/docker-raspbian\_xinit:latest it does not work at all - only pushing it via rdt somehow works…)

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 1, 2017, 3:10pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/2 "2017-05-01T15:10:32Z")

</div>

Hi, checking it out if we can see anything obviously wrong.  
In general you will have to look at the logs, if possible, see what’s in `dmesg`, etc.

> [@nmaas87](#):
>
> (If I try to run it with docker run nmaas87/docker-raspbian\_xinit:latest it does not work at all

Sorry, this is not very clear. Where do you run it like that? On your local, not Raspberry Pi machine? Or otherwise?

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 1, 2017, 3:38pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/3 "2017-05-01T15:38:41Z")

</div>

> [@imrehg](#):
>
> Sorry, this is not very clear. Where do you run it like that? On your local, not Raspberry Pi machine? Or otherwise?

I try to run it on my RPi 3 with latest resinOS :). Using the locally attached keyboard and mouse on that device. Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 1, 2017, 4:22pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/4 "2017-05-01T16:22:11Z")

</div>

OK I got some new info.

I can now run the container directly from the RPi 3 via following command:

```auto
docker run --privileged nmaas87/docker-raspbian_xinit:latest

```

It did not work because I forgot about privileged mode ☹. However, still no Mouse and Keyboard - even if I mount the whole /dev/ directory to the folder (only for debug purposes ;)).

I can also use rdt to push the container, but I need to remove the cross-build-start and end before pushing from the Dockerfile - which is clear, otherwise the container would try to build itself on the ARM Hardware waiting for some x64 system… ( [https://github.com/nmaas87/docker-raspbian\_xinit/blob/master/xinit\_latest/Dockerfile](https://github.com/nmaas87/docker-raspbian_xinit/blob/master/xinit_latest/Dockerfile) ). I did also remove -use\_cursor no from [https://github.com/nmaas87/docker-raspbian\_xinit/blob/master/xinit\_latest/src/launch\_app.sh](https://github.com/nmaas87/docker-raspbian_xinit/blob/master/xinit_latest/src/launch_app.sh) to be sure that the windowmanager would be able to use the cursor - but in fact, no matter if I enable or disable it or remove it, the cursor is visible. If I remove it from the config, I get a small black box in the left (0,0) coordinate. But nothing else changes.

```auto
maas@Munin:~/Schreibtisch/docker-raspbian_xinit/xinit_latest$ sudo rdt push 192.168.4.74 -s . -n gui
* Building..
- Stopping and Removing any previous 'gui' container
- Building new 'gui' image
Step 1 : FROM nmaas87/docker-raspbian_qemu:latest
 ---> 4073f3881ae6
Step 2 : MAINTAINER Nico Maas <mail@nico-maas.de>
 ---> Using cache
 ---> da972a7dd2ba
Step 3 : ENV DEBIAN_FRONTEND noninteractive
 ---> Using cache
 ---> 87c41703e1f4
Step 4 : RUN apt-get update && apt-get install -yq --no-install-recommends alsa-utils xinput-calibrator autoconf build-essential git openssh-server xserver-xorg-core xorg libgtk2.0-0 libnotify4 libgconf2-4 libnss3 libasound2 matchbox sudo locales whois gedit && apt-get autoremove -qqy && apt-get autoclean -y && apt-get clean && rm -rf /var/lib/apt/lists/* && mkdir /var/lib/apt/lists/partial && mkdir /var/run/sshd && echo 'root:resin' | chpasswd && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
 ---> Using cache
 ---> 78148d6cf14d
Step 5 : RUN touch /usr/share/locale/locale.alias && sed -i "s/^#\ \+\(de_DE.UTF-8\)/\1/" /etc/locale.gen && locale-gen de_DE de_DE.UTF-8
 ---> Using cache
 ---> ef485e0541b1
Step 6 : ENV LANG de_DE.UTF-8 LC_ALL de_DE.UTF-8 LANGUAGE de_DE:de
 ---> Using cache
 ---> 3ff6e5ab0b8d
Step 7 : RUN useradd --groups=sudo --create-home --home-dir=/home/pi --shell=/bin/bash --password=$(mkpasswd pi) pi && sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
 ---> Running in cebaee0dd6b4
 ---> 20b64f700075
Removing intermediate container cebaee0dd6b4
Step 8 : RUN mkdir -p /usr/src/app && ln -s /usr/src/app /app
 ---> Running in a8ef9665e9e8
 ---> 478211144810
Removing intermediate container a8ef9665e9e8
Step 9 : WORKDIR /usr/src/app
 ---> Running in 07dd70dc0212
 ---> 598c4d8c6217
Removing intermediate container 07dd70dc0212
Step 10 : COPY src /usr/src/app
 ---> ddacff36f29c
Removing intermediate container ff03e44a7f19
Step 11 : COPY src/start.sh /start.sh
 ---> f7f437de82a8
Removing intermediate container 674258f8bdf1
Step 12 : CMD bash /start.sh
 ---> Running in 1a475702fdf8
 ---> ccdb0245a189
Removing intermediate container 1a475702fdf8
Successfully built ccdb0245a189
- Creating 'gui' container
- Starting 'gui' container

rdt push completed successfully!
* Streaming application logs..
Invalid card number.
2Usage: amixer <options> [command]

Available options:
  -h,--help this help
  -c,--card N select the card
  -D,--device N select the device, default 'default'
  -d,--debug debug mode
  -n,--nocheck do not perform range checking
  -v,--version print version of this program
  -q,--quiet be quiet
  -i,--inactive show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin Read and execute commands from stdin sequentially
  -R,--raw-volume Use the raw value (default)
  -M,--mapped-volume Use the mapped volume

Available commands:
  scontrols show all mixer simple controls
  scontents show contents of all mixer simple controls (default command)
  sset sID P set contents for one mixer simple control
  sget sID get contents for one mixer simple control
  controls show all controls for given card
  contents show contents of all controls for given card
  cset cID P set control contents for one control
  cget cID get control contents for one control
2Usage: amixer <options> [command]

Available options:
  -h,--help this help
  -c,--card N select the card
  -D,--device N select the device, default 'default'
  -d,--debug debug mode
  -n,--nocheck do not perform range checking
  -v,--version print version of this program
  -q,--quiet be quiet
  -i,--inactive show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin Read and execute commands from stdin sequentially
  -R,--raw-volume Use the raw value (default)
  -M,--mapped-volume Use the mapped volume

Available commands:
  scontrols show all mixer simple controls
  scontents show contents of all mixer simple controls (default command)
  sset sID P set contents for one mixer simple control
  sget sID get contents for one mixer simple control
  controls show all controls for given card
  contents show contents of all controls for given card
  cset cID P set control contents for one control
  cget cID get control contents for one control
Invalid card number.

X.Org X Server 1.18.4
Release Date: 2016-07-19
"X Protocol Version 11, Revision 0
9Build Operating System: Linux 4.4.26-v7+ armv7l Raspbian
XCurrent Operating System: Linux resin 4.4.48 #2 SMP Thu Apr 13 05:03:46 UTC 2017 armv7l
Kernel command line: �8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2709.boardrev=0xa02082 bcm2709.serial=0xf2ef8db0 smsc95xx.macaddr=B8:27:EB:EF:8D:B0 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 bcm2709.uart_clock=4800000P0 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 coMnsole=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
)Build Date: 11 November 2016 11:59:59AM
>xorg-server 2:1.18.4-2+rpi1 (https://www.debian.org/support) 
"Current version of pixman: 0.33.3
d	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, .(**) from config file, (==) default setting,
	%(++) from command line, (!!) notice, E(II) informational,
	(WW) warning, (EE) error, (NI) not implemented, S(??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Mon May 1 15:58:02 2017
@(==) Using system config directory "/usr/share/X11/xorg.conf.d"
*modprobe: FATAL: Module g2d_23 not found.
}
**(gedit:35): WARNING**: Could not load Gedit repository: Typelib file for namespace 'GtkSource', version '3.0' not found
�
(gedit:35): dconf-WARNING **: failed to commit changes to dconf: Failed to execute child process "dbus-launch" (No such file or directory)
�
(gedit:35): dconf-WARNING **: failed to commit changes to dconf: Failed to execute child process "dbus-launch" (No such file or directory)

```

However, no mouse/keyboard support either and - as with the direct approach. And it feels like gedit seems to die after 10 cursor blinks or so (the textcursor stops blinking after about 10 blinks or so…)

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 1, 2017, 5:55pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/5 "2017-05-01T17:55:22Z")

</div>

First things first: managed to make your setup work, seems like you are missing some dependencies.

First I’ve installed [`xinput`](https://packages.debian.org/search?keywords=xinput) to see what devices were available in the system, and no real device was (running `xinput -list` after the X server started):

```auto
⎡ Virtual core pointer id=2	[master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4	[slave pointer (2)]
⎣ Virtual core keyboard id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5	[slave keyboard (3)]

```

Then after installing [`evtest`](https://packages.debian.org/search?keywords=evtest) to see input events, it probably pulled in enough dependencies, and now my mouse and keyboard shows up:

```auto
⎡ Virtual core pointer id=2	[master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4	[slave pointer (2)]
⎜ ↳ MOSART Semi. 2.4G Wireless Mouse id=8	[slave pointer (2)]
⎣ Virtual core keyboard id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5	[slave keyboard (3)]
    ↳ USB Keyboard id=7	[slave keyboard (3)]
    ↳ USB Keyboard id=6	[slave keyboard (3)]

```

And `gedit` worked:

 ![](https://global.discourse-cdn.com/balena/original/1X/917a348a50193006076f4e4ebcd1281647d8cc7b.jpg)

In these kinds of situations, it helps to have as many tools to debug as possible.

Hope this will help to get ahead with your project!

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 1, 2017, 7:24pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/6 "2017-05-01T19:24:03Z")

</div>

Thank you @imrehg, that is awesome news.  
However, I could sadly not reproduce your success.  
I did install xinput and evtest into the image and started xinput -list, which only showed “no available xserver”, while evtest showed my keyboard. gedit did not work. Could you please edit my Dockerfile, so that I could rebuild my image from scratch and had a “known good” starting point? Somehow i’m missing something here…

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 1, 2017, 7:27pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/7 "2017-05-01T19:27:10Z")

</div>

You have to run that command from within the area of xinit (that is in launch\_app.sh in your setup), as all other X commands to talk to the server.

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 2, 2017, 8:43pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/8 "2017-05-02T20:43:40Z")

</div>

Thank you @imrehg, I could get it working now. Key was to _really_ start the INITSYSTEM and start the [start.sh](http://start.sh) not via CMD, but via an systemd service. From that moment on, the GUI could launch gedit and the needed services - which were - so it seems like you found out - missing some dependencies. Thank you very much for your help :)!

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 3, 2017, 3:25pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/9 "2017-05-03T15:25:10Z")

</div>

🎉 Glad to hear it works, and keep us posted about your project! 😃

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 16, 2017, 6:40am UTC](https://forums.balena.io/t/gui-xinit-problems/874/10 "2017-05-16T06:40:38Z")

</div>

Thank you, I am making good progress and maybe get around to make a little tutorial on how to build such appliances with resin/resinOS in form a blogpost today 🙂 - maybe I can apply with that for blog4swag and help other people with similiar problems out :)! _and now gets to work on that_ 😉

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 16, 2017, 8:49am UTC](https://forums.balena.io/t/gui-xinit-problems/874/11 "2017-05-16T08:49:23Z")

</div>

That sounds great, looking forward to it! And yeah, #blog4swag it 😉

---

<div class="post-metadata">

**Author:** ![nmaas87](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/nmaas87/32/5570_2.png) [@nmaas87](https://forums.balena.io/u/nmaas87)\
**Post date:** [May 16, 2017, 2:58pm UTC](https://forums.balena.io/t/gui-xinit-problems/874/12 "2017-05-16T14:58:13Z")

</div>

Thank you very much, I just got it working and blogged it! 😄

> **[\[resinOS\] Dockerize your own Flask GUI with resinOS](https://www.nico-maas.de/?p=1646)**
>
> I have been working with Docker and resin.io as well as resinOS for quite some time now and I am actively using those services actively for different projects: The possibility to just throw away a …
