Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Sat Sep 21, 2019 3:52 am

weebsnore wrote:
Fri Sep 20, 2019 3:00 pm
Works fantastically on my RPi 4 after applying the udev fix - thank you very much!

A couple of questions for everyone -

1. This setting doesn't seem to work:
Player -> Videos -> Adjust display refresh rate -> Always

Is this fixable?
This setting works until a certain degree, as I explained above, there is no Vsync currently on the interface for the RPi4. This only affects when some video is playing and it depends on your TV/monitor capabilities.
weebsnore wrote:
Fri Sep 20, 2019 3:00 pm

2. Is it possible to make Alt+Tab between Kodi and the Rasbian desktop work?

And thanks again!

I feel I'm now very close to the web browser + Kodi RPi box I want. The improvement from a couple of months ago is night and day.
Not with this packages. As I explained above, if you want that, you will loose HW video decoding unfortunatly. There is nothing I can do about that.
Well, you can use stock Raspbian Kodi version...

User avatar
secded
Posts: 6
Joined: Fri Sep 13, 2019 10:40 am

Re: [Guide] Kodi on Raspbian Buster

Sat Sep 21, 2019 8:43 pm

Hey,
unfortunately Kodi doesn't launch from the menu shortcut and when I run it from shell it requests the (sudo-)password of user pi. With the password entered Kodi starts. User pi is already in the video and render group and I also did create the udev rule for drm access. In the Kodi crashlog file I can find the entry "failed to authorize drm magic: permission denied". So what am I missing?

Edit: For security reasons I changed the default behavior of "sudo ..." to ask for a password. Maybe this is the reason that I do see the password prompt while others don't.

Edit 2: Apparently adding user pi to the render group shouldn't be needed with the udev rule. I could verify that /dev/dri/renderD128's group changes from render to video during boot. So why does it give me the password prompt?

Thanks.
Last edited by secded on Sun Sep 22, 2019 7:07 am, edited 1 time in total.

satella
Posts: 1
Joined: Sat Sep 21, 2019 8:43 pm

Re: [Guide] Kodi on Raspbian Buster

Sat Sep 21, 2019 8:45 pm

Thanks for your great job.
Finally it perfectly works on my rpi4 2GB through dietpi buster.

gkreidl
Posts: 6126
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 7:44 am

secded wrote:
Sat Sep 21, 2019 8:43 pm
Hey,
unfortunately Kodi doesn't launch from the menu shortcut and when I run it from shell it requests the (sudo-)password of user pi. With the password entered Kodi starts. User pi is already in the video and render group and I also did create the udev rule for drm access. In the Kodi crashlog file I can find the entry "failed to authorize drm magic: permission denied". So what am I missing?

Edit: For security reasons I changed the default behavior of "sudo ..." to ask for a password. Maybe this is the reason that I do see the password prompt while others don't.

Edit 2: Apparently adding user pi to the render group shouldn't be needed with the udev rule. I could verify that /dev/dri/renderD128's group changes from render to video during boot. So why does it give me the password prompt?

Thanks.
The start script for kodi (on the RPi) requires some commands, which have to be executed as root (e. g. for restoring the screen after kodi closes).
Therefore it cannot work, if you call it from the application menu and sudo is set to require a password. (Obviously very few people protect their system against exploits).

@Rascas: Perhaps it would be a better solution, to force kodi to be started from a terminal. Inside the kodi.desktop file, set

Code: Select all

Exec=lxterminal -e "kodi [email protected]"
Then it should work for everyone. It should also be explained to users, why it may require a password.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
secded
Posts: 6
Joined: Fri Sep 13, 2019 10:40 am

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 8:35 am

@gkreidl: Thank you for your explanation.

I had a look into the script and essentially sudo is needed to change the virtual terminal for Kodi. The pipplware fixes (fbi and cec-client) also in the script do not seem to apply for me. Why can't Kodi be run in the current virtual terminal, where raspbian desktop is running?

Edit: For the time being I did setuid for "/bin/chvt" and "/bin/fgconsole". Not sure if this is worse than making sudo request the password but it works ok for me.

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 9:47 am

Unfortunetly, sudo is needed to change virtual terminal before launching Kodi because, on the Raspberry Pi 4 only, it does not start if X (a desktop environment like LXDE) is running in the same virtual terminal Kodi is started. That is due to the GBM/DRM window rendering that Kodi needs to be compiled with for it to work on the Pi4. You can check the fixes in /usr/bin/kodi script. @gkreidl that is a different thing from the fixes needed in the past, launching from a virtual console won't work.

I think the best solution to avoid asking for sudo password if you set it, is to add a sudoers.d option for it, something like creating a file, for example /etc/sudoers.d/020_kodi with:

Code: Select all

Cmnd_Alias KODI_VT = /bin/fgconsole, /bin/chvt *

%video ALL = (root) NOPASSWD: KODI_VT
I think I am going to add it to the Kodi packages to do it automatically when it is installed. Also the drm udev rule needed.
If you find a better alternative to do this please tell me and I will add it.

User avatar
secded
Posts: 6
Joined: Fri Sep 13, 2019 10:40 am

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 9:52 am

@rascas: This seems like a better approach than my hack. I will try it out.

gkreidl
Posts: 6126
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 10:11 am

@Rascas: This looks like a good solution for the RPi 4.
But isn't more required for RPi 0/1/2/3 using the legacy video driver? Or is restauration of the screen resolution not needed any more on older RPis?
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

bat0nas
Posts: 18
Joined: Wed Jul 17, 2019 8:28 am

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 10:47 am

Rascas wrote:
Fri Sep 20, 2019 7:40 pm
bat0nas wrote:
Fri Sep 20, 2019 5:30 pm
Hi,

I did everything according the instructions. Did all the tweaks as suggested in OP (GPU memory increase, udev rule etc.).

All work great except little stutters every 3-5 seconds.

TOP shows that kodi loads only 15% of the CPU
Temperature stays constant at 72C. So I guess CPU is not thermal throttling.

I'm running it on Pi 4 4GB.

Playing 1080p mkv file. It happens with all mkv files in my collection.

Do you have 100% smooth playthrough?
Works fine here, no stuttering playing videos. But that may depend on the video codec of your files. A Kodi debug log would be helpfull to see your problem with more detail. To get it follow this: http://kodi.wiki/view/Log_file Don't forget to play some of those videos before uploading the log.
I will check the log.

Before that: where are you playing your video files from?
Me - from the sata external disk attached to usb3. Disk fs - ntfs. I guess I need to try linux filesystem or play from the network to see if ntfs has anything to do woth this.

greeny
Posts: 2
Joined: Sun Sep 22, 2019 1:41 pm

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 2:15 pm

Thank You for great job! All works fine for me, but I have one little problem - there are no Power Off and Restart button in exit menu.
I've tried to edit configuration file of skin /usr/share/kodi/addons/skin.estuary/xml/DialogButtonMenu.xml:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>System.CanPowerDown</visible>     
</item>
Change to:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>yes[</visible>
</item>
Now I see Power Off in exit menu, but it doesn't switch off computer - only quit from Kodi and start Kodi again.

Please explain me how to make this buttons works normally (like it works in Kodi for Raspbian Stretch).

Board: Raspbery Pi 4 (4GB), OS: Raspbian Buster.

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 3:12 pm

gkreidl wrote:
Sun Sep 22, 2019 10:11 am
@Rascas: This looks like a good solution for the RPi 4.
But isn't more required for RPi 0/1/2/3 using the legacy video driver? Or is restauration of the screen resolution not needed any more on older RPis?
Not required for RPi 0/1/2/3 for some time now.
I always tried to avoid making system changes in the Kodi packages but in RPi 4 there is now some changes needed to make it work nice that may be a bit overwhelming for inexperience users so I think that is best to include this fixes in the packages.

User avatar
secded
Posts: 6
Joined: Fri Sep 13, 2019 10:40 am

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 4:32 pm

Is there a fix for the tearing/graphic corruption during menu transitions? I don't think that this happened on the Pi3.

derders
Posts: 21
Joined: Sun Apr 02, 2017 5:26 pm

Re: [Guide] Kodi on Raspbian Buster

Sun Sep 22, 2019 6:14 pm

greeny wrote:
Sun Sep 22, 2019 2:15 pm
Thank You for great job! All works fine for me, but I have one little problem - there are no Power Off and Restart button in exit menu.
I've tried to edit configuration file of skin /usr/share/kodi/addons/skin.estuary/xml/DialogButtonMenu.xml:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>System.CanPowerDown</visible>     
</item>
Change to:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>yes[</visible>
</item>
Now I see Power Off in exit menu, but it doesn't switch off computer - only quit from Kodi and start Kodi again.

Please explain me how to make this buttons works normally (like it works in Kodi for Raspbian Stretch).

Board: Raspbery Pi 4 (4GB), OS: Raspbian Buster.
if I remember right you have to add to /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla

Code: Select all

[Allow all users to shutdown and reboot]
Identity=unix-user:*
Action=org.freedesktop.login1.*;org.freedesktop.upower.*;org.freedesktop.consolekit.system.*
ResultActive=yes
ResultAny=yes
ResultInactive=yes

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 12:02 am

secded wrote:
Sun Sep 22, 2019 4:32 pm
Is there a fix for the tearing/graphic corruption during menu transitions? I don't think that this happened on the Pi3.
Nope, not yet. See: https://www.raspberrypi.org/forums/view ... 5#p1538459

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 12:40 am

greeny wrote:
Sun Sep 22, 2019 2:15 pm
Thank You for great job! All works fine for me, but I have one little problem - there are no Power Off and Restart button in exit menu.
I've tried to edit configuration file of skin /usr/share/kodi/addons/skin.estuary/xml/DialogButtonMenu.xml:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>System.CanPowerDown</visible>     
</item>
Change to:

Code: Select all

<item>
     <label>$LOCALIZE[13016]</label>
     <onclick>Powerdown()</onclick>
     <visible>yes[</visible>
</item>
Now I see Power Off in exit menu, but it doesn't switch off computer - only quit from Kodi and start Kodi again.

Please explain me how to make this buttons works normally (like it works in Kodi for Raspbian Stretch).

Board: Raspbery Pi 4 (4GB), OS: Raspbian Buster.
The derders solution above should work for you, don't change Kodi files, that won't work because the problem is again about user permissions.
I already had this covered in Raspbian Stretch guide but the link in the first post doesn't work, so I will tell what I find the best solution for your problem. Create a polkit rule, for example, /etc/polkit-1/localauthority/50-local.d/kodi.pkla with the following content:

Code: Select all

[Allow users in the plugdev group to reboot and shutdown]
Identity=unix-group:plugdev
Action=org.freedesktop.consolekit*;org.freedesktop.upower*;org.freedesktop.login1*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

[Allow users in the plugdev group to mount/unmount devices]
Identity=unix-group:plugdev
Action=org.freedesktop.udisks*
ResultAny=yes
ResultInactive=yes
ResultActive=yes
The description should be self explanatory but if you any question just ask. I also included a rule to allow mount/unmount devices in Kodi.

greeny
Posts: 2
Joined: Sun Sep 22, 2019 1:41 pm

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 6:19 pm

derders, Rascas thank you! It works:

/etc/polkit-1/localauthority/50-local.d/kodi.pkla :

Code: Select all

[Allow users in the plugdev group to reboot and shutdown]
Identity=unix-group:plugdev
Action=org.freedesktop.consolekit*;org.freedesktop.upower*;org.freedesktop.login1*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

[Allow users in the plugdev group to mount/unmount devices]
Identity=unix-group:plugdev
Action=org.freedesktop.udisks*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 6:26 pm

Unfortunately, after applying all commands, I still have green glitches during playing mkv files (720p).
I have rpi4 4GB version. I set 320 Mb for video configuration, and all video files situated on HDD.
Maybe I missed something?

Feriman
Posts: 4
Joined: Mon Feb 05, 2018 10:32 am

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 6:37 pm

Solved by run

Code: Select all

apt remove kodi*
before try to update it.

I tried to install/update it on RPi4 (Raspbian Buster), but getting this below error:

Code: Select all

dpkg: error processing archive /var/cache/apt/archives/kodi_2%3a18.4-4~buster_all.deb (--unpack):
 trying to overwrite '/usr/share/icons/hicolor/128x128/apps/kodi.png', which is also in package kodi-data 2:17.6+dfsg1-4
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/kodi_2%3a18.4-4~buster_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Same error when I try to update or fresh install it.

Any solution?

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Mon Sep 23, 2019 7:35 pm

Feriman wrote:
Mon Sep 23, 2019 6:37 pm
Solved by run

Code: Select all

apt remove kodi*
before try to update it.

I tried to install/update it on RPi4 (Raspbian Buster), but getting this below error:

Code: Select all

dpkg: error processing archive /var/cache/apt/archives/kodi_2%3a18.4-4~buster_all.deb (--unpack):
 trying to overwrite '/usr/share/icons/hicolor/128x128/apps/kodi.png', which is also in package kodi-data 2:17.6+dfsg1-4
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/kodi_2%3a18.4-4~buster_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Same error when I try to update or fresh install it.

Any solution?
Yep, removing old versions before installing this one should do it. That is because Debian Kodi packaging is a bit weird, it defers from the oficial Kodi PPA and upstream github. See: https://trac.kodi.tv/ticket/17488
I will see if I can do something about that.

bjtheone
Posts: 376
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 2:36 am

Pi 4 running Buster Raspbian Lite + Mate, Kodi installed as per your instructions. I am launching Kodi from a terminal. Works great, no issues with playback. Have the udev rule and added my non-pi user to the appropriate groups. However, when I exit, it hangs at the switching back to X sometimes (black screen, blinking cursor).

Can ssh in and reboot but other than that it just hangs. Did a bit of poking about but I know very little about Kodi. Any suggestions or specific info I can supply?

EDIT: If it exits normally I get

Code: Select all

[E] Invalid arguments ' '
displayed before I get a shell prompt back in the terminal I invoked it from. I an just invoking it as "kodi", with no command line arguments.

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 10:20 am

TomoeMikage wrote:
Mon Sep 23, 2019 6:26 pm
Unfortunately, after applying all commands, I still have green glitches during playing mkv files (720p).
I have rpi4 4GB version. I set 320 Mb for video configuration, and all video files situated on HDD.
Maybe I missed something?
Please post a Kodi debug log after playing one of those files: https://kodi.wiki/view/Log_file
Does it work if play one of the same files from the sdcard?
bjtheone wrote:
Tue Sep 24, 2019 2:36 am
Pi 4 running Buster Raspbian Lite + Mate, Kodi installed as per your instructions. I am launching Kodi from a terminal. Works great, no issues with playback. Have the udev rule and added my non-pi user to the appropriate groups. However, when I exit, it hangs at the switching back to X sometimes (black screen, blinking cursor).

Can ssh in and reboot but other than that it just hangs. Did a bit of poking about but I know very little about Kodi. Any suggestions or specific info I can supply?

EDIT: If it exits normally I get

Code: Select all

[E] Invalid arguments ' '
displayed before I get a shell prompt back in the terminal I invoked it from. I an just invoking it as "kodi", with no command line arguments.
Probably lack of permissions of your non-pi user or some missing package.
What is the output of:

Code: Select all

groups $USER
Did you set sudo for asking password ?
Also, do you have xserver-xorg-video-fbdev package installed ?

bjtheone
Posts: 376
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 11:34 am

Thanks for the speedy response. Will test tonight and report back.

Pretty sure the my non-pi user is in the required groups. However I definitely have sudo prompting for a password. Will add the sudoers.d option and see if that resolves it. I do not have the problem if I just launch Kodi and muck about with the settings. It only hangs when I actually play a movie, so it is likely the X cleanup on exit. Sorry I missed the sudoers.d suggestion that was already in the comments.

mmamljn
Posts: 1
Joined: Tue Sep 24, 2019 5:00 pm

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 5:25 pm

bjtheone wrote:
Tue Sep 24, 2019 2:36 am

EDIT: If it exits normally I get

Code: Select all

[E] Invalid arguments ' '
displayed before I get a shell prompt back in the terminal I invoked it from. I an just invoking it as "kodi", with no command line arguments.
For me it was related to adding <algorithmdirtyregions> setting in advancedsettings.xml

Code: Select all

<advancedsettings>
<!--
  <gui>
    <algorithmdirtyregions>1</algorithmdirtyregions>
    <nofliptimeout>200</nofliptimeout>
  </gui>
-->
</advancedsettings>
This config worked fine on Pi 3B+ on stretch, however on Pi4 on buster I get the same error as you did. algorithm 2 also produced invalid argument error, had to remove the <algorithmdirtyregions> setting completely (and apparently nofliptimeuot was removed in Kodi v17).

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 8:17 pm

Rascas wrote:
Tue Sep 24, 2019 10:20 am
TomoeMikage wrote:
Mon Sep 23, 2019 6:26 pm
Unfortunately, after applying all commands, I still have green glitches during playing mkv files (720p).
I have rpi4 4GB version. I set 320 Mb for video configuration, and all video files situated on HDD.
Maybe I missed something?
Please post a Kodi debug log after playing one of those files: https://kodi.wiki/view/Log_file
Does it work if play one of the same files from the sdcard?
Hello, thank you for your reply.
I tried to copy video into SD card and external USB flash drive. I have the same green artifacts. If it can help you, VLC player has this issue as well.

Also, please, take a look at the attached log file.
kodi.zip
(7.23 KiB) Downloaded 12 times

Rascas
Posts: 554
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: [Guide] Kodi on Raspbian Buster

Tue Sep 24, 2019 8:50 pm

TomoeMikage wrote:
Tue Sep 24, 2019 8:17 pm
Rascas wrote:
Tue Sep 24, 2019 10:20 am
TomoeMikage wrote:
Mon Sep 23, 2019 6:26 pm
Unfortunately, after applying all commands, I still have green glitches during playing mkv files (720p).
I have rpi4 4GB version. I set 320 Mb for video configuration, and all video files situated on HDD.
Maybe I missed something?
Please post a Kodi debug log after playing one of those files: https://kodi.wiki/view/Log_file
Does it work if play one of the same files from the sdcard?
Hello, thank you for your reply.
I tried to copy video into SD card and external USB flash drive. I have the same green artifacts. If it can help you, VLC player has this issue as well.

Also, please, take a look at the attached log file.
kodi.zip
Well, I do see alot of audio sync errors, but that can be caused by alot of things. Do you have PI:HDMI selected in Kodi audio settings ? What you are getting does not seem normal, the codec is h264, nothing special for the Pi, it is hardware decoded, it looks like the PI cannot read the file fast enough. And the log you posted is just a normal log, not a debug log wihich provides more info. Please post a debug log, check first post.

Return to “Raspbian”