HOWTO: Install Kodi on Raspbian


117 posts   Page 1 of 5   1, 2, 3, 4, 5
by gkreidl » Thu Feb 12, 2015 1:57 pm
Edit March, 28th, 2016: This update is long overdue

If you want to have the best of both worlds (Raspbian and XBMC, now called Kodi) without having to install different operating systems or using multiple SD cards, you can install Kodi on Raspbian. Here's an easy way how to do that.

kodi 15.2 is now available from the Raspbian repository. For other versions (in some ways optimized 15.x versions or kodi-16) see here: https://www.raspberrypi.org/forums/view ... hilit=kodi

Installation from the repository:
Code: Select all
sudo apt-get install kodi


We have to create the group "input" if it doesn't exist.

Code: Select all
sudo addgroup --system input

Install kodi
Code: Select all
sudo apt-get update
sudo apt-get install kodi

Create & edit the following file:
Code: Select all
sudo nano /etc/udev/rules.d/99-input.rules


enter the following text and save it:
Code: Select all
SUBSYSTEM==input, GROUP=input, MODE=0660
KERNEL==tty[0-9]*, GROUP=tty, MODE=0660

Create & edit the following file:
Code: Select all
sudo nano /etc/udev/rules.d/10-permissions.rules


enter this text and save it:
Code: Select all
# input
KERNEL=="mouse*|mice|event*",   MODE="0660", GROUP="input"
KERNEL=="ts[0-9]*|uinput",     MODE="0660", GROUP="input"
KERNEL==js[0-9]*,             MODE=0660, GROUP=input
# tty
KERNEL==tty[0-9]*,            MODE=0666
# vchiq
SUBSYSTEM==vchiq,  GROUP=video, MODE=0660


run the following commands for user pi (if you haven't changed your user name):
Code: Select all
sudo usermod -a -G audio pi
sudo usermod -a -G video pi
sudo usermod -a -G input pi
sudo usermod -a -G dialout pi
sudo usermod -a -G plugdev pi
sudo usermod -a -G tty pi


To play full HD video in Kodi, you have to set
gpu_mem=160
in /boot/config.txt (or higher)

Start kodi from the command line with:
Code: Select all
kodi-standalone


Solving some additional possible problems
1) See the following post for patching kodi's desktop file
2) For better keyboard support:
Add to /etc/init.d/rc.local:
Code: Select all
chmod 0777 /dev/tty0

3) If you still have problems with a black screen after leaving kodi, you might try my "startkodi" script:
https://www.raspberrypi.org/forums/view ... 8&p=927086
Last edited by gkreidl on Mon Mar 28, 2016 7:01 am, edited 5 times in total.
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by piuser14 » Tue Feb 17, 2015 1:23 am
In addition to your tutorial, how about fixing up the kodi.desktop file in case the user wants to launch the program within the lxde menu > Sound and Video?

Code: Select all
sudo nano /usr/share/applications/kodi.desktop


Replace the following:

Code: Select all
[Desktop Entry]
Version=1.0
Name=Kodi Media Center
GenericName=Media Center
Comment=Manage and view your media
Exec=kodi <-- this line
Icon=kodi
Terminal=false
Type=Application
Categories=AudioVideo;Video;Player;TV;

Actions=Fullscreen;Standalone;

[Desktop Action Fullscreen]
Name=Open in fullscreen
Exec=kodi -fs <-- this line
OnlyShowIn=Unity;

[Desktop Action Standalone]
Name=Open in standalone mode
Exec=kodi --standalone
OnlyShowIn=Unity;


With:

Code: Select all
[Desktop Entry]
Version=1.0
Name=Kodi Media Center
GenericName=Media Center
Comment=Manage and view your media
Exec=kodi-standalone <-- this line
Icon=kodi
Terminal=false
Type=Application
Categories=AudioVideo;Video;Player;TV;

Actions=Fullscreen;Standalone;

[Desktop Action Fullscreen]
Name=Open in fullscreen
Exec=kodi-standalone -fs <-- this line
OnlyShowIn=Unity;

[Desktop Action Standalone]
Name=Open in standalone mode
Exec=kodi --standalone
OnlyShowIn=Unity;
Posts: 6
Joined: Thu Jan 29, 2015 10:35 pm
by expandables » Tue Feb 17, 2015 3:44 am
What about the exit problem? Every time i exit Kodi i get
Code: Select all
Exception SystemExit in ignored Exception SystemExit in ignored
Any fix for that?
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by DirkS » Tue Feb 17, 2015 11:40 am
expandables wrote:What about the exit problem? Every time i exit Kodi i get
Code: Select all
Exception SystemExit in ignored Exception SystemExit in ignored
Any fix for that?

'The' exit problem? I've never seen it...

This is something that should be reported to the Kodi developers, for example on their forum at http://kodi.tv/
Posts: 6382
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by tgraudo » Wed Feb 18, 2015 1:11 pm
Yesterday I followed this steps with a "Black Screen" when Kodi exits.

I had no time to see the logs. I will investigate deeper this weekend.
Grettings
Posts: 2
Joined: Wed Feb 18, 2015 1:06 pm
by DirkS » Wed Feb 18, 2015 1:33 pm
tgraudo wrote:Yesterday I followed this steps with a "Black Screen" when Kodi exits.

I had no time to see the logs. I will investigate deeper this weekend.
Grettings

What happens when you press a key?
Posts: 6382
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by DirkS » Wed Feb 18, 2015 1:38 pm
DirkS wrote:
tgraudo wrote:Yesterday I followed this steps with a "Black Screen" when Kodi exits.

I had no time to see the logs. I will investigate deeper this weekend.
Grettings

What happens when you press a key?

Or try
Code: Select all
fbset -depth 8 && fbset -depth 16
Posts: 6382
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by expandables » Wed Feb 18, 2015 1:55 pm
Code: Select all
fbset -depth 8 && fbset -depth 16
Is already in kodi-standalone. That person is getting the exit problem i was talking about. :mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by gkreidl » Wed Feb 18, 2015 2:10 pm
If I start kodi once and exit, I get back to the command line. If I start it a second time, I return to a black screen (but kodi isn't running any more).

I've tried to post a comment at Michaels website, but was blocked by the spam filter.

Otherwise it's really working well for me.
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by expandables » Wed Feb 18, 2015 2:25 pm
gkreidl wrote:If I start kodi once and exit, I get back to the command line. If I start it a second time, I return to a black screen (but kodi isn't running any more).

I've tried to post a comment at Michaels website, but was blocked by the spam filter.

Otherwise it's really working well for me.

That's exactly what i am experiencing .
:mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by expandables » Wed Feb 18, 2015 2:58 pm
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by Methanoid » Fri Feb 20, 2015 3:21 pm
Nice guide!

Will this also work on a Pi2? On Ubuntu/Linaro image?
Posts: 45
Joined: Thu Feb 28, 2013 12:02 pm
by gkreidl » Fri Feb 20, 2015 3:37 pm
Methanoid wrote:Nice guide!

Will this also work on a Pi2? On Ubuntu/Linaro image?


Works on Pi1 and Pi2 (Raspbian); I cannot test it on Ubuntu myself.
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by eriktheitalian » Fri Feb 20, 2015 5:10 pm
gkreidl wrote:If I start kodi once and exit, I get back to the command line. If I start it a second time, I return to a black screen (but kodi isn't running any more).

I've tried to post a comment at Michaels website, but was blocked by the spam filter.

Otherwise it's really working well for me.


Confirmed. Archlinux arm official repos including kodi. When i'm trying quit kodi then system freezing with black screen.
I cant using enough English language. My writings can be wrong grammer.$
"in micro$oft we not trust"
User avatar
Posts: 358
Joined: Thu Feb 19, 2015 1:03 pm
by expandables » Fri Feb 20, 2015 5:52 pm
The system does not freeze Kodi appears to close the windows manager but does not so i create a script to search for a specific string in in the kodi log file
Code: Select all
WARNING: Attempted to remove window 10013 from the window manager when it didn't exist
and if it finds that string it will exit kodi and bring you out of the blackscreen.
http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=100811
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.
User avatar
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson
by eriktheitalian » Fri Feb 20, 2015 7:32 pm
expandables wrote:The system does not freeze Kodi appears to close the windows manager but does not so i create a script to search for a specific string in in the kodi log file
Code: Select all
WARNING: Attempted to remove window 10013 from the window manager when it didn't exist
and if it finds that string it will exit kodi and bring you out of the blackscreen.
http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=100811


im tried your fix. when im tried exit, system is not freeze. my tv lcd tv unoparete with hdmi cec. im operating tv and selecting hdmi connection there is no xfce destkop.
I cant using enough English language. My writings can be wrong grammer.$
"in micro$oft we not trust"
User avatar
Posts: 358
Joined: Thu Feb 19, 2015 1:03 pm
by SeriyGrey » Sun Feb 22, 2015 11:54 pm
I've installed Kodi but it only works with my remote, not with my keyboard. What's wrong?
Posts: 2
Joined: Sun Feb 22, 2015 11:54 pm
by gkreidl » Mon Feb 23, 2015 7:46 am
SeriyGrey wrote:I've installed Kodi but it only works with my remote, not with my keyboard. What's wrong?


run
cat /etc/group

Check if the group "input" exists and if it looks like that:
input:x:999:pi,kodi

(if you didn't create a new user are using it instead of "pi")
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by SeriyGrey » Mon Feb 23, 2015 11:35 am
gkreidl wrote:
SeriyGrey wrote:I've installed Kodi but it only works with my remote, not with my keyboard. What's wrong?


run
cat /etc/group

Check if the group "input" exists and if it looks like that:
input:x:999:pi,kodi

(if you didn't create a new user are using it instead of "pi")


Apparently my user wasn't a member of the input group. So that fixed it, but I have stumbled upon a different problem. Everything worked fine till I rebooted the Pi.

Picture:
http://u.cubeupload.com/riick/photo20150223122949.jpg

What is going on?
Posts: 2
Joined: Sun Feb 22, 2015 11:54 pm
by Seyaro » Sat Feb 28, 2015 10:37 am
Hey.
Thanks for the guide. However, it seems like commenting out the last three lines in the config is actually what causes the blank screen on exit. At least for me, if I don't comment it out Kodi exits correctly. But if I do as you suggest i need to ssh to the pi and run sudo killall kodi.
Posts: 2
Joined: Sat Feb 28, 2015 10:27 am
by gkreidl » Sat Feb 28, 2015 1:24 pm
Seyaro wrote:Hey.
Thanks for the guide. However, it seems like commenting out the last three lines in the config is actually what causes the blank screen on exit. At least for me, if I don't comment it out Kodi exits correctly. But if I do as you suggest i need to ssh to the pi and run sudo killall kodi.


For me it didn't; by commenting out these last three lines I got it to return to a normal screen when started for the first time, but not when starting it a second time.

The real problem is that kodi doesn't exit cleanly, but often crashes, when you exit. Killing kodi.bin from a SSH terminal restarts it and when I exit it again I can return to a normal screen.

The problem has been reported to the package maintainer, but there hasn't been any reaction ASAIK.
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Seyaro » Sat Feb 28, 2015 1:49 pm
gkreidl wrote:For me it didn't; by commenting out these last three lines I got it to return to a normal screen when started for the first time, but not when starting it a second time.

The real problem is that kodi doesn't exit cleanly, but often crashes, when you exit. Killing kodi.bin from a SSH terminal restarts it and when I exit it again I can return to a normal screen.

The problem has been reported to the package maintainer, but there hasn't been any reaction ASAIK.

Ah, too bad :/
For me it seems to be working flawlessly now anyway, maybe I'm just lucky.
Others might want to try too.
I'm on RPI2 if that matters.
Posts: 2
Joined: Sat Feb 28, 2015 10:27 am
by cesqt » Sun Mar 01, 2015 3:59 pm
If you hold down the Ctrl-Alt-F1 keys on your keyboard, you will return to the shell that is active on tty1.
Posts: 2
Joined: Sun Mar 01, 2015 3:42 pm
by cesqt » Sun Mar 01, 2015 6:28 pm
Here are the two links and code corrections that seemed to solve my problems (so far anyway) with the Raspbian and Kodi implementation above.

http://raspberrypi.stackexchange.com/qu ... d-or-mouse
http://forum.freetronics.com/viewtopic.php?f=37&t=5943
Posts: 2
Joined: Sun Mar 01, 2015 3:42 pm
by gkreidl » Sun Mar 01, 2015 11:12 pm
cesqt wrote:Here are the two links and code corrections that seemed to solve my problems (so far anyway) with the Raspbian and Kodi implementation above.

http://raspberrypi.stackexchange.com/qu ... d-or-mouse
http://forum.freetronics.com/viewtopic.php?f=37&t=5943


This is a different implementation and the problem described in the linked post (no mouse, no keyboard) doesn't exist, if you follow the tutorial in the OP.
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
Posts: 4282
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany