Kodi not working on RPi5

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | 9.7.1
  • Distro version | bookworm 0
  • Kernel version | Linux DietPi 6.6.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.47-1+rpt1 (2024-09-02) aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | RPi 5 Model B (aarch64)
  • Power supply used | Official 27W
  • SD card used | HP mx330 A1 U3 V30

Additional Information (if applicable)

  • Software title | Kodi v20.5
  • Was the software title installed freshly or updated/migrated? Freshly installed
  • Can this issue be replicated on a fresh installation of DietPi? Yes

Steps to reproduce

  1. Install Kodi via dietpi-software
  2. Try to play a video

Expected behaviour

  • Video plays without an issue

Actual behaviour

  • Video playback freezes after a few seconds
  • Kodi remains operational, after seeking into the video the playback resumes but the picture freezes again after a few seconds
  • According to htop, the /usr/lib/aarch64-linux-gnu/kodi/kodi.bin --standalone is putting a constant 100% load on one and only one CPU core right when the video playback starts. The rest of the cores are loaded <1-2%. The same issue happens with H264 and H265 videos as well.
  • Stopping the video playback immediately reduces this load.

Extra details

  • New RPi5 which I’m trying to set up as a small home server / media center
  • Tried running Kodi with both root and dietpi user launched from terminal as well as configured with autostart but the issue is the same. Also tried with latest Raspberry Pi OS 64-bit and Kodi installed there is working without issues so doesn’t seem to be a HW issue. After that I also gave a try on DietPi installing a desktop env (XFCE) and launching Kodi there, but the issue remains. Also did a fresh clean install with only Kodi installed on top, but the issue remains.
  • When executing startkodi I can see the following:
[W][01432.485311] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][01432.485384] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
error: XDG_RUNTIME_DIR is invalid or not set in the environment.

I’ve spent several hours googling for similar issues and ideas what the root cause could be but haven’t found anything. I’m out of ideas. Any suggestions?

Did you already tried changing desktop resolution within dietpi-config?

No, haven’t changed the resolution yet. Now that I did and changed it to 1080p or 720p I can no longer even start Kodi because of getting:

[W][00048.667705] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][00048.667897] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
ERROR: Unable to create GUI. Exiting

This is happening both with startkodi and configuring it to autostart. Setting it to either vc4-kms-v3d or vc4-fkms-v3d I’m back to the original issue. Kodi is running but video playback freezes after a few seconds and 1 cpu core is loaded to 100%. Also, with vc4-fkms-v3d there are some rendering artifacts on the Kodi UI.

maybe @MichaIng has an idea

IIRC, the RPi 5 has no hardware H264 video decoding, but H265/HEVC at least, and they say software decoding for H264 is fast enough. Which resolution does the video source have? Did you try with lower resolution videos?

Assure to select vc4-kms-v3d in resolution menu. It is misleading and requires rework, but it basically just enables needed KMS. It should have been actually done automatically on Kodi install via dietpi-software. I guess switching to other resolutions disabled KMS which broke Kodi startup.

Can you check whether this Kodi build is from the RPi Ltd repository?

apt policy kodi

Can you check for kernel errors?

dmesg -l 0,1,2,3

Also check temperature, when the video stucks:

G_OBTAIN_CPU_TEMP

Yes, that is the case. But I’m facing the issue with every single video I tried. H265 4K, H264 1080p and 720p. All these play perfectly on Kodi installed onto Raspberry Pi OS. There CPU load is near zero with H265 videos and below 20% (and nicely distributed among cores) with H264.

The vc4-kms-v3d has been the default setting. I only started meddling with it after Joulinar brought it up.

root@DietPi:~# apt policy kodi
kodi:
  Installed: 3:20.5-4~bookworm
  Candidate: 3:20.5-4~bookworm
  Version table:
 *** 3:20.5-4~bookworm 500
        500 https://archive.raspberrypi.com/debian bookworm/main arm64 Packages
        100 /var/lib/dpkg/status
     2:20.1+dfsg-1 500
        500 https://deb.debian.org/debian bookworm/main arm64 Packages

There is nothing no matter how long I wait after the picture stuck.

The video gets stuck within 6-8 seconds after starting to play. Similarly, it gets stuck within 6-8 seconds when I try to seek into the file. The CPU load on a single core shoots up the moment the video starts to play and returns to <1% the moment I stop the video playback.

root@DietPi:~# dmesg -l 0,1,2,3
root@DietPi:~# date
Mon Sep  9 05:58:33 BST 2024
root@DietPi:~# G_OBTAIN_CPU_TEMP
41
root@DietPi:~# date
Mon Sep  9 05:59:02 BST 2024
root@DietPi:~# G_OBTAIN_CPU_TEMP
43
root@DietPi:~# date
Mon Sep  9 06:00:27 BST 2024
root@DietPi:~# G_OBTAIN_CPU_TEMP
45
Mon Sep  9 06:04:46 BST 2024
root@DietPi:~# G_OBTAIN_CPU_TEMP
47
root@DietPi:~# date
Mon Sep  9 06:08:20 BST 2024
root@DietPi:~# G_OBTAIN_CPU_TEMP
48