chromium-kiosk 2 contiainers, working on RPI4 not on RPI3B+

Hi,

We try to setup a two container, communicating with a websocket, between chromium and a websocket server in Qt5.

It works, based on this project: https://github.com/jayatvars/balena-chromium-kiosk

Here is our code :

This code is working on raspberrypi 4 but not on RPI3B+

Here’s the log related to Xserver failing, any idea?

20.02.20 23:03:58 (+0100) <qtapp> Echoserver listening on port 1234
20.02.20 23:04:06 (+0100) <chromium-kiosk> xinit: giving up
20.02.20 23:04:06 (+0100) <chromium-kiosk> xinit: unable to connect to X server: Cannot assign requested address
20.02.20 23:04:06 (+0100) <chromium-kiosk> xinit: server error
20.02.20 23:04:06 (+0100) <chromium-kiosk> xauth: (argv):1:  bad display name "bk-rpi-531582a:0" in "remove" command
20.02.20 23:04:06 (+0100) <chromium-kiosk> useradd: user 'chromium' already exists
20.02.20 23:04:06 (+0100) <chromium-kiosk> hostname: No address associated with hostname
20.02.20 23:04:07 (+0100) <chromium-kiosk> xauth: (stdin):1:  bad display name "bk-rpi-531582a:0" in "add" command
20.02.20 23:04:07 (+0100) <chromium-kiosk> 
20.02.20 23:04:07 (+0100) <chromium-kiosk> 
20.02.20 23:04:07 (+0100) <chromium-kiosk> X.Org X Server 1.20.4
20.02.20 23:04:07 (+0100) <chromium-kiosk> X Protocol Version 11, Revision 0
20.02.20 23:04:07 (+0100) <chromium-kiosk> Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
20.02.20 23:04:07 (+0100) <chromium-kiosk> Current Operating System: Linux bk-rpi-531582a 4.19.71 #1 SMP PREEMPT Fri Jan 31 09:53:40 UTC 2020 aarch64
20.02.20 23:04:07 (+0100) <chromium-kiosk> Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=256M video=HDMI-A-1:1920x1080@60 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=PARTUUID=564dc7a5-02 rootwait
20.02.20 23:04:07 (+0100) <chromium-kiosk> Build Date: 05 June 2019  12:49:54PM
20.02.20 23:04:07 (+0100) <chromium-kiosk> xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
20.02.20 23:04:07 (+0100) <chromium-kiosk> Current version of pixman: 0.36.0
20.02.20 23:04:07 (+0100) <chromium-kiosk> 	Before reporting problems, check http://wiki.x.org
20.02.20 23:04:07 (+0100) <chromium-kiosk> 	to make sure that you have the latest version.
20.02.20 23:04:07 (+0100) <chromium-kiosk> Markers: (--) probed, (**) from config file, (==) default setting,
20.02.20 23:04:07 (+0100) <chromium-kiosk> 	(++) from command line, (!!) notice, (II) informational,
20.02.20 23:04:07 (+0100) <chromium-kiosk> 	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
20.02.20 23:04:07 (+0100) <chromium-kiosk> (==) Log file: "/home/chromium/.local/share/xorg/Xorg.0.log", Time: Thu Feb 20 22:04:07 2020
20.02.20 23:04:07 (+0100) <chromium-kiosk> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:07 (+0100) <chromium-kiosk> Fatal server error:
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:07 (+0100) <chromium-kiosk> Please consult the The X.Org Foundation support 
20.02.20 23:04:07 (+0100) <chromium-kiosk> 	 at http://wiki.x.org
20.02.20 23:04:07 (+0100) <chromium-kiosk>  for help. 
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) Please also check the log file at "/home/chromium/.local/share/xorg/Xorg.0.log" for additional information.
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:07 (+0100) <chromium-kiosk> (EE) Server terminated with error (1). Closing log file.
20.02.20 23:04:22 (+0100) <chromium-kiosk> xinit: giving up
20.02.20 23:04:22 (+0100) <chromium-kiosk> xinit: unable to connect to X server: Cannot assign requested address
20.02.20 23:04:22 (+0100) <chromium-kiosk> xinit: server error
20.02.20 23:04:22 (+0100) <chromium-kiosk> xauth: (argv):1:  bad display name "bk-rpi-531582a:0" in "remove" command
20.02.20 23:04:22 (+0100) <chromium-kiosk> useradd: user 'chromium' already exists
20.02.20 23:04:22 (+0100) <chromium-kiosk> hostname: No address associated with hostname
20.02.20 23:04:22 (+0100) <chromium-kiosk> xauth: (stdin):1:  bad display name "bk-rpi-531582a:0" in "add" command
20.02.20 23:04:22 (+0100) <chromium-kiosk> 
20.02.20 23:04:22 (+0100) <chromium-kiosk> 
20.02.20 23:04:22 (+0100) <chromium-kiosk> X.Org X Server 1.20.4
20.02.20 23:04:22 (+0100) <chromium-kiosk> X Protocol Version 11, Revision 0
20.02.20 23:04:22 (+0100) <chromium-kiosk> Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
20.02.20 23:04:22 (+0100) <chromium-kiosk> Current Operating System: Linux bk-rpi-531582a 4.19.71 #1 SMP PREEMPT Fri Jan 31 09:53:40 UTC 2020 aarch64
20.02.20 23:04:22 (+0100) <chromium-kiosk> Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=256M video=HDMI-A-1:1920x1080@60 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=PARTUUID=564dc7a5-02 rootwait
20.02.20 23:04:22 (+0100) <chromium-kiosk> Build Date: 05 June 2019  12:49:54PM
20.02.20 23:04:22 (+0100) <chromium-kiosk> xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
20.02.20 23:04:22 (+0100) <chromium-kiosk> Current version of pixman: 0.36.0
20.02.20 23:04:22 (+0100) <chromium-kiosk> 	Before reporting problems, check http://wiki.x.org
20.02.20 23:04:22 (+0100) <chromium-kiosk> 	to make sure that you have the latest version.
20.02.20 23:04:22 (+0100) <chromium-kiosk> Markers: (--) probed, (**) from config file, (==) default setting,
20.02.20 23:04:22 (+0100) <chromium-kiosk> 	(++) from command line, (!!) notice, (II) informational,
20.02.20 23:04:22 (+0100) <chromium-kiosk> 	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
20.02.20 23:04:22 (+0100) <chromium-kiosk> (==) Log file: "/home/chromium/.local/share/xorg/Xorg.0.log", Time: Thu Feb 20 22:04:22 2020
20.02.20 23:04:22 (+0100) <chromium-kiosk> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:22 (+0100) <chromium-kiosk> Fatal server error:
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:22 (+0100) <chromium-kiosk> Please consult the The X.Org Foundation support 
20.02.20 23:04:22 (+0100) <chromium-kiosk> 	 at http://wiki.x.org
20.02.20 23:04:22 (+0100) <chromium-kiosk>  for help. 
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) Please also check the log file at "/home/chromium/.local/share/xorg/Xorg.0.log" for additional information.
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:22 (+0100) <chromium-kiosk> (EE) Server terminated with error (1). Closing log file.
20.02.20 23:04:37 (+0100) <chromium-kiosk> xinit: giving up
20.02.20 23:04:37 (+0100) <chromium-kiosk> xinit: unable to connect to X server: Cannot assign requested address
20.02.20 23:04:37 (+0100) <chromium-kiosk> xinit: server error
20.02.20 23:04:37 (+0100) <chromium-kiosk> xauth: (argv):1:  bad display name "bk-rpi-531582a:0" in "remove" command
20.02.20 23:04:38 (+0100) <chromium-kiosk> useradd: user 'chromium' already exists
20.02.20 23:04:38 (+0100) <chromium-kiosk> hostname: No address associated with hostname
20.02.20 23:04:38 (+0100) <chromium-kiosk> xauth: (stdin):1:  bad display name "bk-rpi-531582a:0" in "add" command
20.02.20 23:04:38 (+0100) <chromium-kiosk> 
20.02.20 23:04:38 (+0100) <chromium-kiosk> 
20.02.20 23:04:38 (+0100) <chromium-kiosk> X.Org X Server 1.20.4
20.02.20 23:04:38 (+0100) <chromium-kiosk> X Protocol Version 11, Revision 0
20.02.20 23:04:38 (+0100) <chromium-kiosk> Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
20.02.20 23:04:38 (+0100) <chromium-kiosk> Current Operating System: Linux bk-rpi-531582a 4.19.71 #1 SMP PREEMPT Fri Jan 31 09:53:40 UTC 2020 aarch64
20.02.20 23:04:38 (+0100) <chromium-kiosk> Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=256M video=HDMI-A-1:1920x1080@60 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=PARTUUID=564dc7a5-02 rootwait
20.02.20 23:04:38 (+0100) <chromium-kiosk> Build Date: 05 June 2019  12:49:54PM
20.02.20 23:04:38 (+0100) <chromium-kiosk> xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
20.02.20 23:04:38 (+0100) <chromium-kiosk> Current version of pixman: 0.36.0
20.02.20 23:04:38 (+0100) <chromium-kiosk> 	Before reporting problems, check http://wiki.x.org
20.02.20 23:04:38 (+0100) <chromium-kiosk> 	to make sure that you have the latest version.
20.02.20 23:04:38 (+0100) <chromium-kiosk> Markers: (--) probed, (**) from config file, (==) default setting,
20.02.20 23:04:38 (+0100) <chromium-kiosk> 	(++) from command line, (!!) notice, (II) informational,
20.02.20 23:04:38 (+0100) <chromium-kiosk> 	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
20.02.20 23:04:38 (+0100) <chromium-kiosk> (==) Log file: "/home/chromium/.local/share/xorg/Xorg.0.log", Time: Thu Feb 20 22:04:38 2020
20.02.20 23:04:38 (+0100) <chromium-kiosk> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:38 (+0100) <chromium-kiosk> Fatal server error:
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:38 (+0100) <chromium-kiosk> Please consult the The X.Org Foundation support 
20.02.20 23:04:38 (+0100) <chromium-kiosk> 	 at http://wiki.x.org
20.02.20 23:04:38 (+0100) <chromium-kiosk>  for help. 
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) Please also check the log file at "/home/chromium/.local/share/xorg/Xorg.0.log" for additional information.
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) 
20.02.20 23:04:38 (+0100) <chromium-kiosk> (EE) Server terminated with error (1). Closing log file.
20.02.20 23:04:47 (+0100) Killing service 'chromium-kiosk sha256:78353f41feb6ad4c13af22cd9a2f62e78e9f4c7301762c58c75401291bb5a6b7'
20.02.20 23:04:47 (+0100) <chromium-kiosk> 
20.02.20 23:04:47 (+0100) <chromium-kiosk> Session terminated, killing shell...xinit: giving up
20.02.20 23:04:47 (+0100) <chromium-kiosk> xinit: unable to connect to X server: Cannot assign requested address
20.02.20 23:04:47 (+0100) <chromium-kiosk> xinit: unexpected signal 15
20.02.20 23:04:47 (+0100) <chromium-kiosk>  ...killed.

Regards,
Sylvain.

Hey, you can try adding

rm /tmp/.X0-lock &>/dev/null || true

to your entry script which will remove any lock files that might be left around when your container is started. Also I’ve used

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

myself when starting up an x server, along with

    labels:
      io.balena.features.dbus: '1'

in my docker-compose.yml in order to have that /host/run/dbus/system_bus_socket available, and with those combined I was able to fix errors that looked the same/very similar to that

Hi @_Page,

Thanks replying. I tried your suggestion without success.
Same error.

I’m a beginner with docker and I’m not sure where to put the label:. So I may be wrong. Your suggested changes.

As you may know:

rm /tmp/.X0-lock &>/dev/null || true is at the top of start.sh

I added it anyway in entry.sh too.
No success.

So, I’ve check the error message on search engine:

xf86OpenConsole: Cannot open virtual console 2

and found a work around from this quotation:

It worked.

I’m not at all versed in X11 config and arcane, but it seems a permission problem on tty, despite the fact chromium user have been added to tty group.

Here is my working commited changes

I think it’s a dirty fix, because some commands are for running chromium with the user chromium and it may bypass that all.

To be continued.
Regards,
Sylvain.

Hello,
There are some issues in your Dockerfile.template:

  • the purpose of a Dockerfile.template is to work on different kinds of devices, the first line should be FROM balenalib/%%BALENA_MACHINE_NAME%%. It is fine to not use this feature, if you don’t plan on using it, you could name this file Dockerfile;
  • ENV INITSYSTEM on is not supported on balenalib images and will have no effect: https://www.balena.io/docs/reference/base-images/base-images/#major-changes ;
  • because of the above, the whole systemctl commands are pointless, same thing for the .service files;
  • there is 2 CMD lines, I’m not sure which one Docker will pick up;
  • the only xorg debian packages you shoould need are xserver-xorg and xinit;

Also, some things you do in start.sh would be better done in the Dockerfile.template:

  • useradd;
  • setting env vars;
  • creating /home/chromium/xstart.sh

I’d recommend:

  • creating the chromium user in the Dockerfile;
  • setting USER chromium in the Dockerfile;
  • creating and using /home/chromium/.xserverrc and /home/chromium/.xinitrc files for starting the X server and chromium respectively. Your container CMD should be xinit with no options. Please check man xinit.

/home/chromium/.xserverrc should look like:

#!/bin/sh

rm -f /tmp/.X0-lock
exec /usr/bin/X -nolisten tcp "$@"

/home/chromium/.xinitrc should look like:

#!/bin/sh

xrandr -o $XRANDR_ROTATION
# move stuff from xstart.sh here

Also for creating .xinitrc and .xserverrc, it would be easier to create regular files in you repository and ADD them in your Dockerfile.template instead of using echo and redirections.

Hi @zvin,

Thanks a lot, its bunch of changes to test. :smile: (for my current knowledge)

As mentioned, this test is based on another work on setting up a chromium-kiosk container. Most of the changes you mention are directly from the original work. Which in turn is also based on some other work.

I will try to implement most of your suggestions. Or you may have another Kiosk code more close to the objective?

I need at the end to have a production ready kiosk.

Regards,
Sylvain.

Hi
You can also try this repo that one of my colleagues is working on here - https://github.com/balena-io-playground/chromium-ha
It has hardware acceleration tested on RPi 3, RPi3B+ and RPi 4.

Hi @anujdeshpande,

This one worked at first try.
I see that the line I added is there too.

Oh, I also see that the URL switcher Tohora is installed too. Interesting.

I need to play with to link all thing together.
I will comeback, when it’ll be ready.
Thanks.
Regards,
Sylvain.