balena-io-experimental / browser

A drop-in web browser block
98 stars 75 forks source link

Not working on rpi4 with balenaOS 2.88.5+rev1 #107

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hey there,

Trying to run a browser on a rpi4 device running balenaOS (latest as of writing) 64-bit, freshly flashed onto the SD. The device is connected to a raspberry pi touchscreen via a ribbon cable. The old image from balenaplayground/balenalabs-browser was working fine with the touchscreen but I decided to upgrade since that one doesn't seem to exist anymore.

Here's the docker-compose:

version: '2.1'
services:
  browser:
    image: balenablocks/browser
    restart: unless-stopped
    privileged: true
    network_mode: host
    environment:
      - KIOSK=1
    depends_on:
      - some-other-service

And here is the output below. It seems the vcgencmd tool is not working as expected and it can't determine the GPU memory (which is set to 512MB). This happens regardless if I specify the tag of the image as being raspberrypi4-64 or not. When I ssh into the container and manually run the tool, I get

root@ecb3fa4:/usr/src/app# vcgencmd get_mem gpu
VCHI initialization failed

Logs from the dashboard:

Running balena base image entrypoint...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
balenaBlocks browser version: 2.3.1
Setting CPU Scaling Governor to 'performance'
Disabling cursor
Checking GPU memory
VCHI initialization failed
/usr/src/app/start.sh: line 41: [: : integer expression expected
chown: cannot access '/data': No such file or directory
/usr/bin/startx: 69: cannot create /dev/null: Permission denied
/usr/bin/startx: 108: cannot create /dev/null: Permission denied
/usr/bin/startx: 132: cannot create /dev/null: Permission denied
/usr/bin/startx: 156: cannot create /dev/null: Permission denied
/usr/bin/startx: 200: cannot create /dev/null: Permission denied
xauth:  file /home/chromium/.Xauthority does not exist
/usr/bin/startx: 200: cannot create /dev/null: Permission denied
xauth: (stdin):1:  bad display name "ecb3fa4:0" in "add" command

X.Org X Server 1.20.11
X Protocol Version 11, Revision 0
Build Operating System: linux Raspbian
Current Operating System: Linux ecb3fa4 5.10.78-v8 #1 SMP PREEMPT Mon Nov 8 18:19:44 UTC 2021 aarch64
Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:22:EA:9B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 rootwait  vt.global_cursor_default=0 console=null cgroup_enable=memory root=UUID=ba1eadef-24c5-4f4e-939d-83ceb9439a9b rootwait
Build Date: 04 January 2022  10:24:42AM
xorg-server 2:1.20.11-1+rpt1+deb11u1 (https://www.debian.org/support) 
Current version of pixman: 0.40.0
    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, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue Feb 22 08:19:07 2022
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE) 
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
xauth: (argv):1:  bad display name "ecb3fa4:0" in "remove" command
/usr/bin/startx: 235: cannot create /dev/null: Permission denied
Idling...
ghost commented 2 years ago

In the lines below, why are the permissions of the folder changed before the folder even gets created? Where would the /data folder be created otherwise (I do not use a mount for storing settings since I don't care about persistent mode)?

https://github.com/balenablocks/browser/blob/6661efb07eada815796b1d2983d6b70954c23156/src/start.sh#L48-L49

Any reason why this setup is not done in the dockerfile? Is it because some people mount a volume at that location? (EDIT: I oculd remove the "no such file or directory" error by creating the volume and biding it to /data but the other issues remain.

phil-d-wilson commented 2 years ago

Hi there @vbersier

I've just run up a new fleet with the browser block, on a Pi4 running OS 2.88.5+rev1 and everything works as expected:

image

As you can see, I can also run the GPU memory command fine. I don't think this is an issue with the block itself. You could ask for some more support on our forums, though, to see why your device isn't working as expected:

https://forums.balena.io/

ghost commented 2 years ago

Why does it say this when i got to add a new device to my fleet?

image

Seems like something is not right with that version. Also, could it be that we do not use the same revision of the rpi4 board? I have an older 1.2 revision board.

Will create a new fleet now and test with only that browser container.

ghost commented 2 years ago

Confirmed working with a minimal setup and a new fleet. Will need to investigate

ghost commented 2 years ago

Turns out my problem is due to a conflict with another container that needs udev rules to enable access to USB storage devices. I guess the fact that both containers are privileged means they can't access the same resources at the same time. It wasn't a problem with balenaplayground/balenalabs-browser so I'm curious what changed.