cubsfan-budman
Posts: 1
Joined: Thu Jan 07, 2016 3:21 am

Autostart Kodi in Raspbian Jessie

Thu Jan 07, 2016 3:28 am

Apologies if this has been answered, I searched! I promise. The only guides i can find are for Wheezy...

Anyhow, I got Raspbian Jessie up and running and installed Kodi (and the addon for Google Music).

I've made the adjustment to prevent booting into the WM GUI.

What I'd like is to get my Pi to boot straight into Kodi, as this *should* end up being a headless media streamer (controlled via Yatse).

So far, I have created kodi.conf in /etc/init/ with the following script:

Code: Select all

# kodi-upstart
# starts Kodi on startup by using xinit.
# by default runs as kodi, to change edit below.
env USER=kodi
 
description     "Kodi-barebones-upstart-script"
author          "Matt Filetto"
 
start on (filesystem and stopped udevtrigger)
stop on runlevel [016]
 
# tell upstart to respawn the process if abnormal exit
respawn
 
script
  exec su -c "xinit /usr/bin/kodi-standalone -- -nocursor :0" $USER
end script
This does nothing. Any tips? I'd also prefer to leverage "startkodi" script, as i dont get black screens when i use it...

Thanks in advance for any assistance.

lucamanu
Posts: 1
Joined: Fri Jan 15, 2016 5:09 pm

Re: Autostart Kodi in Raspbian Jessie

Fri Jan 15, 2016 5:49 pm

Hi,
I solved the issue super-smoothly by editing /etc/default/kodi and change ENABLED to 1
as indicated on http://forum.kodi.tv/showthread.php?tid=230035

Hope this helps.

treii28
Posts: 76
Joined: Fri May 10, 2013 4:52 pm

Re: Autostart Kodi in Raspbian Jessie

Fri May 19, 2017 1:04 pm

I see no file /etc/default/kodi

alexkusuma
Posts: 1
Joined: Thu May 25, 2017 4:01 am
Location: Auckland

Re: Autostart Kodi in Raspbian Jessie

Thu May 25, 2017 4:10 am

treii28 wrote:I see no file /etc/default/kodi
Look for: /home/pi/.config/lxsession/LXDE-pi/autostart

Then edit it - I use nano - and add:

@kodi -fs

To the end of the file.

and when you reboot your raspberry pi, Kodi will automatically starts. I personally add a 2 seconds delay: @kodi -fs -d 2

I hope this helps.

Cyberek
Posts: 1
Joined: Tue Oct 03, 2017 9:21 pm

Re: Autostart Kodi in Raspbian Jessie

Tue Oct 03, 2017 9:24 pm

You can find the solution that I figured out in this gist article:
https://gist.github.com/Cyberek/33af1b9 ... ccf87b8a3a

Looks like its the only way to do it correctly.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Autostart Kodi in Raspbian Jessie

Wed Oct 04, 2017 4:10 am

@Cyberek
thanks for sharing this,
can you be more specific about
the only way to do it correctly
because i just did it UNCORRECTLY ( on a fairly new setup RASPBIAN STRETCH image / using RPI3 headless (VNC))

Code: Select all

sudo apt-get install kodi
# find [menu][sound & video][kodi]
# [alt]drag/copy/ kodi icon from menu to desktop ( check with edit and start with double click )  
mkdir /home/pi/.config/autostart
cp /home/pi/Desktop/kodi.desktop /home/pi/.config/autostart/kodi.desktop
sudo reboot
as it starts i must ask you, what to expect will not work?

Niccolo
Posts: 14
Joined: Mon Dec 14, 2015 8:45 am

Re: Autostart Kodi in Raspbian Jessie

Mon Dec 25, 2017 9:43 am

As far as I can understand, Debian Jessie and Debian Stretch (and the derivated Raspbian ones) use the new init system systemd, not the old one sysvInit. So the use of the start/stop script /etc/init.d/kodi and relative /etc/default/kodi configuration file, should be discouraged.
We should instead create a systemd unit file. I ended with this functional solution, running on 2017-11-29-raspbian-stretch-lite. I did not install the xerver.xorg system, the kodi-standalone program is run by the kodi user, which I created.
This is the /etc/systemd/system/kodi.service unit file:

Code: Select all

[Unit]
Description = Kodi Media Center

# if you don't need the MySQL DB backend, this should be sufficient
After = systemd-user-sessions.service network.target sound.target

# if you need the MySQL DB backend, use this block instead of the previous
# After = systemd-user-sessions.service network.target sound.target mysql.service
# Wants = mysql.service

[Service]
User = kodi
Group = kodi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = always
RestartSec = 15

[Install]
WantedBy = multi-user.target
To install, enable and run the service:

Code: Select all

systemctl daemon-reload
systemctl enable kodi.service
systemctl start kodi.service
The kodi user was created witht the following commands:

Code: Select all

adduser --disabled-password --gecos "User to run Kodi Media Center" kodi
adduser kodi audio
adduser kodi video
adduser kodi plugdev
adduser kodi input

CapitanCatarro
Posts: 1
Joined: Mon Jan 08, 2018 10:57 pm

Re: Autostart Kodi in Raspbian Jessie

Mon Jan 08, 2018 11:01 pm

Hello there,
thanks to your instructions, I've managed to start Kodi on boot.
Just a question, when you write:

# if you need the MySQL DB backend, use this block instead of the previous
# After = systemd-user-sessions.service network.target sound.target mysql.service
# Wants = mysql.service
what do you mean with
# Wants = mysql.service
Can you please tell me how to install and enable mysql server too?

Thanks again!

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 37 guests