[rpi 4 8gb] Can't start Kodi

I will test Kodi on ARMv8 RPi4 once back home to be able to check screen output.

Same error here. I did a fresh install.

  • RPI 4 (8GB)
  • ARMv7 32-bit image (bullseye)

I tried a fresh install using ARMv8 64-bit image and Kodi worked. However, CEC doesn’t work and we know 32-bit is more stable.

I have been using DietPi arm7 (buster) for a year and I have zero problems. I decided to upgrade to the bullseye, and I can’t run Kodi anymore. Feeling that regret… :cry:

It works well on RPi Zero and RPi 2, so it is definitely an issue with the two HDMI ports on RPi 4, or another difference of the RPi 4 GPU. Btw, Kodi since Bullseye has native GBM support builtin on Debian as well, so it can be started without X server then as well. Would be interesting if this works:

apt reinstall --allow-downgrade kodi
kodi --standalone

Also would be interesting if performance is fine with this Debian package. In case we can skip the own Kodi build on Bullseye for RPi 2 and up, or at least for RPi 4, depending on how well it performs.

So we need to find out how to force Kodi starting on the foreground screen.

I have a RPi4B 8GB connected with a single HDMI port connected. HDMI 2 is empty. I could test Kodi but I’m nearly sure it was working in past. What version to test? ARMv6/7/8 ?

MichaIng

I did a test using RPi4B 8GB and it dosn’t matter if I use ARMv7 or ARMv8. In both cases Kodi is started, but on a screen I’m not able to see. Unfortunately I have a single Micro HDMI cable only not being able to connect 2 screens at the same time. Therefore I couldn’t check if Kodi is running on 2nd screen. Maybe I will need to get a 2nd Micro HDMI cable :thinking: But best to my knowledge HDMI ports are not active if not connected. Still the question where Kodi is started on :roll_eyes:

root       585   576  0 11:59 tty1     00:00:00 /bin/sh /usr/local/bin/kodi --standalone
root       617   585 14 11:59 tty1     00:02:14 /usr/local/lib/kodi/kodi-gbm --standalone

Strange. But it must have something to do with the to ports, as on all other RPi models it works fine :thinking:. Does it make a difference whether you use the --standalone flag or not?

And another interesting test would be whether the Debian Kodi package works:

apt purge kodi
apt install kodi
kodi --standalone

EDIT: Ah, as you said 64-bit, means with the Debian Kodi package it’s the same?

yes correct, it’s same on our 32bit build as well as on the Debian 64bit build

I’ll have a look into the RPi build’s scripts, I remember there was some workaround to switch to a different VT, probably it is exactly for that issue.

but I’m pretty sure I had kodi working in past. Strange one.

Thanks for still looking at this.

This issue only occurs on ARMv7 32-bit image.
Kodi is working on ARMv8 64-bit.

I ran it and I got:

root@rpi:~# kodi --standalone
failed to open zone.tab
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.10.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)

Let me know if you need anything else.

igor
On the 64-bit image, when you run the following from console (outside of a desktop session):

kodi --standalone

It fails the same way, doesn’t it?

MichaIng

I haven’t tested it. I only have one card at the moment. I have been running DietPi v7.7.3 with the plex as a workaround.
When I tested it on the 64-bit image, either the startkodi command or autostart using Kodi worked.

root@rpi:~# startkodi
failed to open zone.tab
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.10.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
terminate called after throwing an instance of 'std::runtime_error'
  what():  eglSwapBuffers failed
Aborted
Crash report available at /root/kodi_crashlog-20211024_142105.log
root@rpi:~# nano kodi_crashlog-20211024_142105.log
  GNU nano 5.4                                                                                          kodi_crashlog-20211024_142105.log
2021-10-24 14:21:04.778 T:21114   ERROR <general>: Couldn't load font name: font23_narrow(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.779 T:21114   ERROR <general>: Couldn't load font name: font25_narrow(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.780 T:21114   ERROR <general>: Couldn't load font name: font27(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.784 T:21114   ERROR <general>: Couldn't load font name: font27_narrow(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.785 T:21114   ERROR <general>: Couldn't load font name: font37(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.791 T:21114   ERROR <general>: Couldn't load font name: font45(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.798 T:21114   ERROR <general>: Couldn't load font name: font60(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.805 T:21114   ERROR <general>: Couldn't load font name: font_clock(roboto-thin.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.811 T:21114   ERROR <general>: Couldn't load font name: font_flag(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.814 T:21114   ERROR <general>: Couldn't load font name: font20_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.818 T:21114   ERROR <general>: Couldn't load font name: font25_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.818 T:21114   ERROR <general>: Couldn't load font name: font30_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.819 T:21114   ERROR <general>: Couldn't load font name: font32_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.824 T:21114   ERROR <general>: Couldn't load font name: font36_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.828 T:21114   ERROR <general>: Couldn't load font name: font45_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.829 T:21114   ERROR <general>: Couldn't load font name: font52_title(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.834 T:21114   ERROR <general>: Couldn't load font name: font_MainMenu(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.834 T:21114   ERROR <general>: Couldn't load font name: WeatherTemp(notosans-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.842 T:21114   ERROR <general>: Couldn't load font name: Mono26(notomono-regular.ttf), trying to substitute arial.ttf
2021-10-24 14:21:04.848 T:21114    INFO <general>:   load new skin...
2021-10-24 14:21:04.849 T:21114    INFO <general>: Loading custom window XMLs from skin path /usr/share/kodi/addons/skin.estuary/xml
2021-10-24 14:21:04.856 T:21114    INFO <general>:   initialize new skin...
2021-10-24 14:21:04.856 T:21114    INFO <general>: Loading skin file: Custom_1109_TopBarOverlay.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.871 T:21114    INFO <general>: Loading skin file: DialogVolumeBar.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.873 T:21114    INFO <general>: Loading skin file: DialogBusy.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.874 T:21114    INFO <general>: Loading skin file: Pointer.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.875 T:21114    INFO <general>: Loading skin file: DialogExtendedProgressBar.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.877 T:21114    INFO <general>: Loading skin file: DialogSeekBar.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.892 T:21114    INFO <general>: Loading skin file: DialogNotification.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.893 T:21114    INFO <general>: Loading skin file: DialogBusy.xml, load type: LOAD_ON_GUI_INIT
2021-10-24 14:21:04.896 T:21114    INFO <general>: Loading resource://resource.uisounds.kodi/sounds.xml
2021-10-24 14:21:04.927 T:21114    INFO <general>:   skin loaded...
2021-10-24 14:21:04.928 T:21114    INFO <general>: Loading skin file: Startup.xml, load type: LOAD_EVERY_TIME
2021-10-24 14:21:04.928 T:21114    INFO <general>: Loading skin file: Home.xml, load type: KEEP_IN_MEMORY
2021-10-24 14:21:05.021 T:21114 WARNING <general>: JSONRPC: Could not parse type "Setting.Details.SettingList"
2021-10-24 14:21:05.021 T:21114    INFO <general>: JSONRPC: Adding type "Setting.Details.SettingList" to list of incomplete definitions (waiting for "Setting.Details.Setting")
2021-10-24 14:21:05.022 T:21114    INFO <general>: JSONRPC: Resolving incomplete types/methods referencing Setting.Details.Setting
2021-10-24 14:21:05.047 T:21114    INFO <general>: JSONRPC v12.3.0: Successfully initialized
2021-10-24 14:21:05.135 T:21114    INFO <general>: Register - new keyboard device registered on application->keyboard: Keyboard (0000:0000)
2021-10-24 14:21:05.135 T:21114    INFO <general>: Register - new mouse device registered on application->mouse: Mouse (0000:0000)
2021-10-24 14:21:05.136 T:21114    INFO <general>: Loading player core factory settings from special://xbmc/system/playercorefactory.xml.
2021-10-24 14:21:05.137 T:21114    INFO <general>: Loaded playercorefactory configuration
2021-10-24 14:21:05.139 T:21114    INFO <general>: Loading player core factory settings from special://masterprofile/playercorefactory.xml.
2021-10-24 14:21:05.139 T:21114    INFO <general>: special://masterprofile/playercorefactory.xml does not exist. Skipping.
2021-10-24 14:21:05.139 T:21114    INFO <general>: removing tempfiles
2021-10-24 14:21:05.142 T:21114    INFO <general>: initialize done
2021-10-24 14:21:05.142 T:21134    INFO <general>: initializing python engine.
2021-10-24 14:21:05.142 T:21114    INFO <general>: Running the application...
2021-10-24 14:21:05.150 T:21114    INFO <general>: starting zeroconf publishing
2021-10-24 14:21:05.150 T:21136    INFO <general>: ES: Starting UDP Event server on port 9777
2021-10-24 14:21:05.151 T:21136    INFO <general>: UDP: Listening on port 9777 (ipv6 : false)
2021-10-24 14:21:05.154 T:21114    INFO <general>: JSONRPC Server: Successfully initialized
2021-10-24 14:21:05.620 T:21114   ERROR <general>: eglSwapBuffers failed (EGL_BAD_ALLOC)


############### END LOG FILE ################

############ END Kodi CRASH LOG #############

Jep when using startkodi on the 64-bit image, it starts Kodi via X server, where this is not an issue. I can however be started as well via GBM on Bullseye, which seems to cause the issue as well with Debian’s Kodi build.

Topic opened on Raspberry Pi forum: https://forums.raspberrypi.com/viewtopic.php?t=322517

Did we actually test whether only changing the HDMI port doesn’t work either? I remember I was asking this already and that it didn’t help, but cannot find the comment anymore.

MichaIng

Actually, I ran some updates and tested “startkodi” again and it worked. My rpi is online for 2 weeks and I haven’t touched the HDMI ports/cables. Very odd. If it stops working again I will check the HDMI.

Update command executed:

sudo apt update -y && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt clean -y && sudo apt autoclean -y

Very interesting. Could you share the following info, please:

dpkg -l | grep kodi
grep kms /boot/config.txt

And you ran startkodi from console outside of a desktop/X session or from a terminal emulator?

Btw, about the libva errors, this seems to be quite expected on RPi, generally on SBCs an non-Intel chip devices: https://forums.raspberrypi.com/viewtopic.php?t=321033

Probably there is a build flag for Kodi to skip VAAPI support in the first place to have the error muted.

Now I wonder whether enabling the RPi camera drivers (V4L2) and related kernel modules has benefits for video decoding performance on RPi. Can be done in dietpi-config Display Options + reboot. It loads the “extended” firmware then: /boot/start_x.elf + additional kernel modules.

root@rpi:~# dpkg -l | grep kodi
ii  kodi                                                        3:19.1-dietpi3                                            armhf        Open Source Home Theatre (executable binaries)
root@rpi:~# grep kms /boot/config.txt
dtoverlay=vc4-kms-v3d-pi4
root@rpi:~# startkodi
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.10.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)

I enabled the camera, but I am not quite sure how to test decoding performance.

BTW. I changed to use vc4-kms-v3d-pi4 instead of cc4-fkms-v3d. CEC only works for me on vc4-kms-v3d-pi4. I am not sure why.

root@rpi:~# cec-client -l
libCEC version: 6.0.2, compiled on Linux-4.19.0-14-armmp-lpae ... , features: P8_USB, DRM, P8_detect, randr, Exynos, Linux, AOCEC
Found devices: 1

device:              1
com port:            Linux
vendor id:           0000
product id:          0000
firmware version:    0
type:                Linux

With vc4-fkms-v3d, Kodi shows up as well on foreground screen? Not sure why CEC doesn’t work with the fake KMS driver, I’d have expected that this has no influence. I’ll do some research about that, and about other downsides and upsides of fake KMS (fkms) vs full KMS (kms). Probably we’ll simply apply the full KMS driver by default, at least on RPi 4.
EDIT: The following posts verifies what you say: https://forums.raspberrypi.com/viewtopic.php?p=1895449#p1895449
Only left question whether this is true for RPi 4 only or for all RPi models.

Does also cec-utils -l detect the device only when the full KMS driver is enabled?
**EDIT: It seems that by default it only works on HDMI0 port, but it can be adjusted via hdmi_preferred_port=1 in config.txt:

Basically hardware accelerated video decoding can be compared with and without RPi camera enabled, how smooth high resolution videos play and the CPU usage while doing so.

Both drivers work.

It looks like a combination of kernel and raspberry pi model. I was running Dietpi buster without this issue. No swapping cables or HDMI connectors. I did a clean install of Bullseye, and this issue came up.

(vc4-fkms-v3d) cec-utils -l returns autodetect: failed

(hdmi_preferred_port=1) It might help.

BTW. I manually installed cec-utils. I don’t know if it made any difference.