<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrebrait</id>
	<title>Official Kodi Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrebrait"/>
	<link rel="alternate" type="text/html" href="https://kodi.wiki/view/Special:Contributions/Andrebrait"/>
	<updated>2026-06-04T04:29:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122661</id>
		<title>HOW-TO:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122661"/>
		<updated>2016-04-24T18:51:59Z</updated>

		<summary type="html">&lt;p&gt;Andrebrait: /* Add a new systemd script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mininav| [[Linux]] }}&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;How to automatically start up in Kodi using various Linux distributions. &lt;br /&gt;
&lt;br /&gt;
The main goal of &#039;&#039;&#039;most&#039;&#039;&#039; of these methods is to start an Xserver only for Kodi. Most of these methods will &#039;&#039;&#039;not work&#039;&#039;&#039; if you have a window manager installed (however, it should not be hard to modify the scripts to suit your needs). The lightdm method might work if you need to use a window manager.&lt;br /&gt;
&lt;br /&gt;
Choose &#039;&#039;&#039;only one&#039;&#039;&#039; method from sections 2 and on based on which distribution and init system you&#039;re using.&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
== Create a user to run Kodi ==&lt;br /&gt;
For security reasons, it is recommended (but optional) to use a dedicated user to run Kodi. The user needs access to audio and video devices as well as access the internet if you&#039;re going to use any features that require internet access. Most methods present here allow to specify which user will start / own the Kodi process.&lt;br /&gt;
&lt;br /&gt;
Notice the groups might vary from one distro to another. The groups used below are for Debian-based distributions. To create the user (named &#039;&#039;&#039;kodi&#039;&#039;&#039; here) and give it the necessary permissions, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another option is to add a loginless and passwordless user. You can do so by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser --disabled-password --disabled-login --gecos &amp;quot;&amp;quot; kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, assign it to the following groups in order to give it the permissions it needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give it access to the internet, add the group &#039;&#039;&#039;netdev&#039;&#039;&#039; as well.&lt;br /&gt;
&lt;br /&gt;
== Upstart init script ==&lt;br /&gt;
Works on Ubuntu up to version 14.10 (Utopic Unicorn). Stating with version 15.04 (Vivid Vervet), Ubuntu has switched to systemd and adding a systemd script might be prefereable. Create a &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/init/kodi.conf&amp;lt;/code&amp;gt;&#039;&#039;&#039; with following contents.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
# kodi-upstart&lt;br /&gt;
# starts Kodi on startup by using xinit.&lt;br /&gt;
# by default runs as kodi, to change edit below.&lt;br /&gt;
env USER=kodi&lt;br /&gt;
&lt;br /&gt;
description     &amp;quot;Kodi-barebones-upstart-script&amp;quot;&lt;br /&gt;
author          &amp;quot;Matt Filetto&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start on (filesystem and stopped udevtrigger)&lt;br /&gt;
stop on runlevel [016]&lt;br /&gt;
&lt;br /&gt;
# tell upstart to respawn the process if abnormal exit&lt;br /&gt;
respawn&lt;br /&gt;
&lt;br /&gt;
script&lt;br /&gt;
  exec su -c &amp;quot;xinit /usr/bin/kodi-standalone -- -nocursor :0&amp;quot; $USER&lt;br /&gt;
end script&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt; -- -nocursor&amp;lt;/code&amp;gt; option &#039;&#039;&#039;kills all X cursor&#039;&#039;&#039; on Kodi startup and does not interfere with mouse use/operation}}&lt;br /&gt;
&lt;br /&gt;
You may have to edit &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and replace the last line that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=console&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=anybody&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kodi will now auto-start on boot and restart/respawn if killed or crashed.&lt;br /&gt;
&lt;br /&gt;
== Modify the inittab ==&lt;br /&gt;
&lt;br /&gt;
This was tested on Arch Linux.&lt;br /&gt;
&lt;br /&gt;
To automatically start xbmc on your system, do the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you need to make some changes to &amp;lt;code&amp;gt;/etc/inittab&amp;lt;/code&amp;gt;. Comment out (add a #) to this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and uncomment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:5:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then add this line to the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x:5:wait:login -f &amp;lt;YOUR_XBMC_USERNAME&amp;gt; &amp;lt;/dev/tty7 &amp;amp;&amp;gt;/dev/tty7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using wait instead of respawn means that you can exit out of xbmc into the console.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* NOTE*: This is a security hole as it autologins a dedicated xbmc user without asking for a password!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have the user logged in we need it to auto start XBMC.&lt;br /&gt;
In &amp;lt;code&amp;gt;~/.xinitrc&amp;lt;/code&amp;gt; add the following to the end of the file&lt;br /&gt;
(after removing/commenting any other exec lines that start a windowmanager):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec ck-launch-session xbmc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add this line to your &amp;lt;code&amp;gt;~/.bash_profile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[[ $(tty) = &amp;quot;/dev/tty7&amp;quot; ]] &amp;amp;&amp;amp; exec startx &amp;lt;/dev/null &amp;amp;&amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And create a hushlogin file to suppress login messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch ~/.hushlogin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, for the magic sauce that makes this work, add dbus to your daemons in &amp;lt;code&amp;gt;/etc/rc.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DAEMONS=(... dbus ...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You&#039;re finished. Next time you reboot you should be greeted with XBMC.&lt;br /&gt;
&lt;br /&gt;
== Add a new init script ==&lt;br /&gt;
&lt;br /&gt;
This method works well under Debian up to version 7 (Wheezy). As of version 8 (Jessie), Debian has switched to systemd and adding a systemd init script might be preferable. The current configuration is a HTPC running Debian Squeeze, with no window manager installed. &lt;br /&gt;
&lt;br /&gt;
* Create a new script under &#039;&#039;&#039;/etc/init.d/&#039;&#039;&#039;. Call it &#039;&#039;&#039;kodi&#039;&#039;&#039;&lt;br /&gt;
* Change the rights, in order to allow it to be executable.&lt;br /&gt;
&amp;lt;pre&amp;gt;# chmod a+x /etc/init.d/kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* copy the code under in the file. Modify the variables to suit your configuration:&lt;br /&gt;
&amp;lt;pre&amp;gt;#! /bin/sh&lt;br /&gt;
&lt;br /&gt;
### BEGIN INIT INFO&lt;br /&gt;
# Provides:          kodi&lt;br /&gt;
# Required-Start:    $all&lt;br /&gt;
# Required-Stop:     $all&lt;br /&gt;
# Default-Start:     2 3 4 5&lt;br /&gt;
# Default-Stop:      0 1 6&lt;br /&gt;
# Short-Description: starts instance of Kodi&lt;br /&gt;
# Description:       starts instance of Kodi using start-stop-daemon and xinit&lt;br /&gt;
### END INIT INFO&lt;br /&gt;
&lt;br /&gt;
############### EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
# path to xinit exec&lt;br /&gt;
DAEMON=/usr/bin/xinit&lt;br /&gt;
&lt;br /&gt;
# startup args&lt;br /&gt;
DAEMON_OPTS=&amp;quot; /usr/local/bin/kodi-standalone -- :0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# script name&lt;br /&gt;
NAME=kodi&lt;br /&gt;
&lt;br /&gt;
# app name&lt;br /&gt;
DESC=Kodi&lt;br /&gt;
&lt;br /&gt;
# user&lt;br /&gt;
RUN_AS=kodi&lt;br /&gt;
&lt;br /&gt;
# Path of the PID file&lt;br /&gt;
PID_FILE=/var/run/kodi.pid&lt;br /&gt;
&lt;br /&gt;
############### END EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
test -x $DAEMON || exit 0&lt;br /&gt;
&lt;br /&gt;
set -e&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
  start)&lt;br /&gt;
        echo &amp;quot;Starting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  stop)&lt;br /&gt;
        echo &amp;quot;Stopping $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        ;;&lt;br /&gt;
&lt;br /&gt;
  restart|force-reload)&lt;br /&gt;
        echo &amp;quot;Restarting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        sleep 5&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  *)&lt;br /&gt;
        N=/etc/init.d/$NAME&lt;br /&gt;
        echo &amp;quot;Usage: $N {start|stop|restart|force-reload}&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the script by trying to start / stop Kodi with it.&lt;br /&gt;
&amp;lt;pre&amp;gt;# /etc/init.d/kodi start&lt;br /&gt;
........&lt;br /&gt;
# /etc/init.d/kodi stop&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If all is ok, you can add the script to your configuration, by issuing a &amp;quot;update-rc.d&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;# update-rc.d kodi defaults&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* You can now reboot the server, Kodi should be started just after the boot sequence.&lt;br /&gt;
&lt;br /&gt;
== Add a new systemd script ==&lt;br /&gt;
&lt;br /&gt;
This method is for systems that use systemd as init system such as current versions of Debian (since version 8, Jessie) and Ubuntu (since version 15.04, Vivid Vervet).&lt;br /&gt;
&lt;br /&gt;
* create a new service file under &#039;&#039;&#039;/etc/systemd/system&#039;&#039;&#039;, call it &#039;&#039;&#039;kodi.service&#039;&#039;&#039; and copy the following code into the file: &lt;br /&gt;
&amp;lt;pre&amp;gt;[Unit]&lt;br /&gt;
Description = Kodi Media Center&lt;br /&gt;
&lt;br /&gt;
# if you don&#039;t need the MySQL DB backend, this should be sufficient&lt;br /&gt;
After = systemd-user-sessions.service network.target sound.target&lt;br /&gt;
&lt;br /&gt;
# if you need the MySQL DB backend, use this block instead of the previous&lt;br /&gt;
# After = systemd-user-sessions.service network.target sound.target mysql.service&lt;br /&gt;
# Wants = mysql.service&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
User = kodi&lt;br /&gt;
Group = kodi&lt;br /&gt;
Type = simple&lt;br /&gt;
#PAMName = login # you might want to try this one, did not work on all systems&lt;br /&gt;
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-standalone -- :0 -nolisten tcp vt7&lt;br /&gt;
Restart = on-abort&lt;br /&gt;
RestartSec = 5&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy = multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* modify the variables (user, group, paths...) to match your configuration. Save the file.&lt;br /&gt;
* try to start (and stop) Kodi to make sure the script is working properly&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl start kodi&lt;br /&gt;
........&lt;br /&gt;
# systemctl stop kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* As of Ubuntu 16.04 (Xenial Xerus), you need to install and reconfigure the package &#039;&#039;&#039;xserver-xorg-legacy&#039;&#039;&#039; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;# apt-get install xserver-xorg-legacy&lt;br /&gt;
........&lt;br /&gt;
# dpkg-reconfigure xserver-xorg-legacy&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;. You&#039;ll also need edit the file &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and add the following to a new line at the end of the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
needs_root_rights=yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* if you do not experience any issues, make Kodi start automatically&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl enable kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
== Use autologin feature of lightdm ==&lt;br /&gt;
&lt;br /&gt;
This works if you have a window manager as well.&lt;br /&gt;
&lt;br /&gt;
* Install lightdm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039;/etc/lightdm/lightdm.conf&#039;&#039;&#039; and set the following settings under section &#039;&#039;&#039;[Seat:*]&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Seat:*]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
autologin-session=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:How-to]]&lt;br /&gt;
[[Category:Manual]]&lt;/div&gt;</summary>
		<author><name>Andrebrait</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122660</id>
		<title>HOW-TO:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122660"/>
		<updated>2016-04-24T18:50:19Z</updated>

		<summary type="html">&lt;p&gt;Andrebrait: /* Upstart init script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mininav| [[Linux]] }}&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;How to automatically start up in Kodi using various Linux distributions. &lt;br /&gt;
&lt;br /&gt;
The main goal of &#039;&#039;&#039;most&#039;&#039;&#039; of these methods is to start an Xserver only for Kodi. Most of these methods will &#039;&#039;&#039;not work&#039;&#039;&#039; if you have a window manager installed (however, it should not be hard to modify the scripts to suit your needs). The lightdm method might work if you need to use a window manager.&lt;br /&gt;
&lt;br /&gt;
Choose &#039;&#039;&#039;only one&#039;&#039;&#039; method from sections 2 and on based on which distribution and init system you&#039;re using.&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
== Create a user to run Kodi ==&lt;br /&gt;
For security reasons, it is recommended (but optional) to use a dedicated user to run Kodi. The user needs access to audio and video devices as well as access the internet if you&#039;re going to use any features that require internet access. Most methods present here allow to specify which user will start / own the Kodi process.&lt;br /&gt;
&lt;br /&gt;
Notice the groups might vary from one distro to another. The groups used below are for Debian-based distributions. To create the user (named &#039;&#039;&#039;kodi&#039;&#039;&#039; here) and give it the necessary permissions, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another option is to add a loginless and passwordless user. You can do so by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser --disabled-password --disabled-login --gecos &amp;quot;&amp;quot; kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, assign it to the following groups in order to give it the permissions it needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give it access to the internet, add the group &#039;&#039;&#039;netdev&#039;&#039;&#039; as well.&lt;br /&gt;
&lt;br /&gt;
== Upstart init script ==&lt;br /&gt;
Works on Ubuntu up to version 14.10 (Utopic Unicorn). Stating with version 15.04 (Vivid Vervet), Ubuntu has switched to systemd and adding a systemd script might be prefereable. Create a &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/init/kodi.conf&amp;lt;/code&amp;gt;&#039;&#039;&#039; with following contents.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
# kodi-upstart&lt;br /&gt;
# starts Kodi on startup by using xinit.&lt;br /&gt;
# by default runs as kodi, to change edit below.&lt;br /&gt;
env USER=kodi&lt;br /&gt;
&lt;br /&gt;
description     &amp;quot;Kodi-barebones-upstart-script&amp;quot;&lt;br /&gt;
author          &amp;quot;Matt Filetto&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start on (filesystem and stopped udevtrigger)&lt;br /&gt;
stop on runlevel [016]&lt;br /&gt;
&lt;br /&gt;
# tell upstart to respawn the process if abnormal exit&lt;br /&gt;
respawn&lt;br /&gt;
&lt;br /&gt;
script&lt;br /&gt;
  exec su -c &amp;quot;xinit /usr/bin/kodi-standalone -- -nocursor :0&amp;quot; $USER&lt;br /&gt;
end script&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt; -- -nocursor&amp;lt;/code&amp;gt; option &#039;&#039;&#039;kills all X cursor&#039;&#039;&#039; on Kodi startup and does not interfere with mouse use/operation}}&lt;br /&gt;
&lt;br /&gt;
You may have to edit &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and replace the last line that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=console&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=anybody&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kodi will now auto-start on boot and restart/respawn if killed or crashed.&lt;br /&gt;
&lt;br /&gt;
== Modify the inittab ==&lt;br /&gt;
&lt;br /&gt;
This was tested on Arch Linux.&lt;br /&gt;
&lt;br /&gt;
To automatically start xbmc on your system, do the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you need to make some changes to &amp;lt;code&amp;gt;/etc/inittab&amp;lt;/code&amp;gt;. Comment out (add a #) to this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and uncomment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:5:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then add this line to the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x:5:wait:login -f &amp;lt;YOUR_XBMC_USERNAME&amp;gt; &amp;lt;/dev/tty7 &amp;amp;&amp;gt;/dev/tty7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using wait instead of respawn means that you can exit out of xbmc into the console.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* NOTE*: This is a security hole as it autologins a dedicated xbmc user without asking for a password!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have the user logged in we need it to auto start XBMC.&lt;br /&gt;
In &amp;lt;code&amp;gt;~/.xinitrc&amp;lt;/code&amp;gt; add the following to the end of the file&lt;br /&gt;
(after removing/commenting any other exec lines that start a windowmanager):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec ck-launch-session xbmc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add this line to your &amp;lt;code&amp;gt;~/.bash_profile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[[ $(tty) = &amp;quot;/dev/tty7&amp;quot; ]] &amp;amp;&amp;amp; exec startx &amp;lt;/dev/null &amp;amp;&amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And create a hushlogin file to suppress login messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch ~/.hushlogin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, for the magic sauce that makes this work, add dbus to your daemons in &amp;lt;code&amp;gt;/etc/rc.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DAEMONS=(... dbus ...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You&#039;re finished. Next time you reboot you should be greeted with XBMC.&lt;br /&gt;
&lt;br /&gt;
== Add a new init script ==&lt;br /&gt;
&lt;br /&gt;
This method works well under Debian up to version 7 (Wheezy). As of version 8 (Jessie), Debian has switched to systemd and adding a systemd init script might be preferable. The current configuration is a HTPC running Debian Squeeze, with no window manager installed. &lt;br /&gt;
&lt;br /&gt;
* Create a new script under &#039;&#039;&#039;/etc/init.d/&#039;&#039;&#039;. Call it &#039;&#039;&#039;kodi&#039;&#039;&#039;&lt;br /&gt;
* Change the rights, in order to allow it to be executable.&lt;br /&gt;
&amp;lt;pre&amp;gt;# chmod a+x /etc/init.d/kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* copy the code under in the file. Modify the variables to suit your configuration:&lt;br /&gt;
&amp;lt;pre&amp;gt;#! /bin/sh&lt;br /&gt;
&lt;br /&gt;
### BEGIN INIT INFO&lt;br /&gt;
# Provides:          kodi&lt;br /&gt;
# Required-Start:    $all&lt;br /&gt;
# Required-Stop:     $all&lt;br /&gt;
# Default-Start:     2 3 4 5&lt;br /&gt;
# Default-Stop:      0 1 6&lt;br /&gt;
# Short-Description: starts instance of Kodi&lt;br /&gt;
# Description:       starts instance of Kodi using start-stop-daemon and xinit&lt;br /&gt;
### END INIT INFO&lt;br /&gt;
&lt;br /&gt;
############### EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
# path to xinit exec&lt;br /&gt;
DAEMON=/usr/bin/xinit&lt;br /&gt;
&lt;br /&gt;
# startup args&lt;br /&gt;
DAEMON_OPTS=&amp;quot; /usr/local/bin/kodi-standalone -- :0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# script name&lt;br /&gt;
NAME=kodi&lt;br /&gt;
&lt;br /&gt;
# app name&lt;br /&gt;
DESC=Kodi&lt;br /&gt;
&lt;br /&gt;
# user&lt;br /&gt;
RUN_AS=kodi&lt;br /&gt;
&lt;br /&gt;
# Path of the PID file&lt;br /&gt;
PID_FILE=/var/run/kodi.pid&lt;br /&gt;
&lt;br /&gt;
############### END EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
test -x $DAEMON || exit 0&lt;br /&gt;
&lt;br /&gt;
set -e&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
  start)&lt;br /&gt;
        echo &amp;quot;Starting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  stop)&lt;br /&gt;
        echo &amp;quot;Stopping $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        ;;&lt;br /&gt;
&lt;br /&gt;
  restart|force-reload)&lt;br /&gt;
        echo &amp;quot;Restarting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        sleep 5&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  *)&lt;br /&gt;
        N=/etc/init.d/$NAME&lt;br /&gt;
        echo &amp;quot;Usage: $N {start|stop|restart|force-reload}&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the script by trying to start / stop Kodi with it.&lt;br /&gt;
&amp;lt;pre&amp;gt;# /etc/init.d/kodi start&lt;br /&gt;
........&lt;br /&gt;
# /etc/init.d/kodi stop&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If all is ok, you can add the script to your configuration, by issuing a &amp;quot;update-rc.d&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;# update-rc.d kodi defaults&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* You can now reboot the server, Kodi should be started just after the boot sequence.&lt;br /&gt;
&lt;br /&gt;
== Add a new systemd script ==&lt;br /&gt;
&lt;br /&gt;
This method is for systems that use systemd as init system such as current versions of Debian (since version 8, Jessie) and Ubuntu (since version 15.04, Vivid Vervet).&lt;br /&gt;
&lt;br /&gt;
* create a new service file under &#039;&#039;&#039;/etc/systemd/system&#039;&#039;&#039;, call it &#039;&#039;&#039;kodi.service&#039;&#039;&#039; and copy the following code into the file: &lt;br /&gt;
&amp;lt;pre&amp;gt;[Unit]&lt;br /&gt;
Description = Kodi Media Center&lt;br /&gt;
&lt;br /&gt;
# if you don&#039;t need the MySQL DB backend, this should be sufficient&lt;br /&gt;
After = systemd-user-sessions.service network.target sound.target&lt;br /&gt;
&lt;br /&gt;
# if you need the MySQL DB backend, use this block instead of the previous&lt;br /&gt;
# After = systemd-user-sessions.service network.target sound.target mysql.service&lt;br /&gt;
# Wants = mysql.service&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
User = kodi&lt;br /&gt;
Group = kodi&lt;br /&gt;
Type = simple&lt;br /&gt;
#PAMName = login # you might want to try this one, did not work on all systems&lt;br /&gt;
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-standalone -- :0 -nolisten tcp vt7&lt;br /&gt;
Restart = on-abort&lt;br /&gt;
RestartSec = 5&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy = multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* modify the variables (user, group, paths...) to match your configuration. Save the file.&lt;br /&gt;
* try to start (and stop) Kodi to make sure the script is working properly&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl start kodi&lt;br /&gt;
........&lt;br /&gt;
# systemctl stop kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* As of Ubuntu 16.04 (Xenial Xerus), you need to install and reconfigure the package &#039;&#039;&#039;xserver-xorg-legacy&#039;&#039;&#039; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;# apt-get install xserver-xorg-legacy&lt;br /&gt;
# dpkg-reconfigure xserver-xorg-legacy&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;. You&#039;ll also need edit the file &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and add the following to a new line at the end of the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
needs_root_rights=yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* if you do not experience any issues, make Kodi start automatically&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl enable kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
== Use autologin feature of lightdm ==&lt;br /&gt;
&lt;br /&gt;
This works if you have a window manager as well.&lt;br /&gt;
&lt;br /&gt;
* Install lightdm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039;/etc/lightdm/lightdm.conf&#039;&#039;&#039; and set the following settings under section &#039;&#039;&#039;[Seat:*]&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Seat:*]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
autologin-session=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:How-to]]&lt;br /&gt;
[[Category:Manual]]&lt;/div&gt;</summary>
		<author><name>Andrebrait</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122659</id>
		<title>HOW-TO:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=122659"/>
		<updated>2016-04-24T18:48:33Z</updated>

		<summary type="html">&lt;p&gt;Andrebrait: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mininav| [[Linux]] }}&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;How to automatically start up in Kodi using various Linux distributions. &lt;br /&gt;
&lt;br /&gt;
The main goal of &#039;&#039;&#039;most&#039;&#039;&#039; of these methods is to start an Xserver only for Kodi. Most of these methods will &#039;&#039;&#039;not work&#039;&#039;&#039; if you have a window manager installed (however, it should not be hard to modify the scripts to suit your needs). The lightdm method might work if you need to use a window manager.&lt;br /&gt;
&lt;br /&gt;
Choose &#039;&#039;&#039;only one&#039;&#039;&#039; method from sections 2 and on based on which distribution and init system you&#039;re using.&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
== Create a user to run Kodi ==&lt;br /&gt;
For security reasons, it is recommended (but optional) to use a dedicated user to run Kodi. The user needs access to audio and video devices as well as access the internet if you&#039;re going to use any features that require internet access. Most methods present here allow to specify which user will start / own the Kodi process.&lt;br /&gt;
&lt;br /&gt;
Notice the groups might vary from one distro to another. The groups used below are for Debian-based distributions. To create the user (named &#039;&#039;&#039;kodi&#039;&#039;&#039; here) and give it the necessary permissions, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another option is to add a loginless and passwordless user. You can do so by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# adduser --disabled-password --disabled-login --gecos &amp;quot;&amp;quot; kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, assign it to the following groups in order to give it the permissions it needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give it access to the internet, add the group &#039;&#039;&#039;netdev&#039;&#039;&#039; as well.&lt;br /&gt;
&lt;br /&gt;
== Upstart init script ==&lt;br /&gt;
Works on Ubuntu up to version 14.10 (Utopic Unicorn). As of version 15.04 (Vivid Vervet), Ubuntu switched to systemd and adding a systemd script might be prefereable. Create a &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/init/kodi.conf&amp;lt;/code&amp;gt;&#039;&#039;&#039; with following contents.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
# kodi-upstart&lt;br /&gt;
# starts Kodi on startup by using xinit.&lt;br /&gt;
# by default runs as kodi, to change edit below.&lt;br /&gt;
env USER=kodi&lt;br /&gt;
&lt;br /&gt;
description     &amp;quot;Kodi-barebones-upstart-script&amp;quot;&lt;br /&gt;
author          &amp;quot;Matt Filetto&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start on (filesystem and stopped udevtrigger)&lt;br /&gt;
stop on runlevel [016]&lt;br /&gt;
&lt;br /&gt;
# tell upstart to respawn the process if abnormal exit&lt;br /&gt;
respawn&lt;br /&gt;
&lt;br /&gt;
script&lt;br /&gt;
  exec su -c &amp;quot;xinit /usr/bin/kodi-standalone -- -nocursor :0&amp;quot; $USER&lt;br /&gt;
end script&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt; -- -nocursor&amp;lt;/code&amp;gt; option &#039;&#039;&#039;kills all X cursor&#039;&#039;&#039; on Kodi startup and does not interfere with mouse use/operation}}&lt;br /&gt;
&lt;br /&gt;
You may have to edit &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and replace the last line that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=console&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
allowed_users=anybody&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kodi will now auto-start on boot and restart/respawn if killed or crashed.&lt;br /&gt;
&lt;br /&gt;
== Modify the inittab ==&lt;br /&gt;
&lt;br /&gt;
This was tested on Arch Linux.&lt;br /&gt;
&lt;br /&gt;
To automatically start xbmc on your system, do the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you need to make some changes to &amp;lt;code&amp;gt;/etc/inittab&amp;lt;/code&amp;gt;. Comment out (add a #) to this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#id:3:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and uncomment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
id:5:initdefault&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then add this line to the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x:5:wait:login -f &amp;lt;YOUR_XBMC_USERNAME&amp;gt; &amp;lt;/dev/tty7 &amp;amp;&amp;gt;/dev/tty7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using wait instead of respawn means that you can exit out of xbmc into the console.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* NOTE*: This is a security hole as it autologins a dedicated xbmc user without asking for a password!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have the user logged in we need it to auto start XBMC.&lt;br /&gt;
In &amp;lt;code&amp;gt;~/.xinitrc&amp;lt;/code&amp;gt; add the following to the end of the file&lt;br /&gt;
(after removing/commenting any other exec lines that start a windowmanager):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec ck-launch-session xbmc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add this line to your &amp;lt;code&amp;gt;~/.bash_profile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[[ $(tty) = &amp;quot;/dev/tty7&amp;quot; ]] &amp;amp;&amp;amp; exec startx &amp;lt;/dev/null &amp;amp;&amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And create a hushlogin file to suppress login messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch ~/.hushlogin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, for the magic sauce that makes this work, add dbus to your daemons in &amp;lt;code&amp;gt;/etc/rc.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DAEMONS=(... dbus ...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You&#039;re finished. Next time you reboot you should be greeted with XBMC.&lt;br /&gt;
&lt;br /&gt;
== Add a new init script ==&lt;br /&gt;
&lt;br /&gt;
This method works well under Debian up to version 7 (Wheezy). As of version 8 (Jessie), Debian has switched to systemd and adding a systemd init script might be preferable. The current configuration is a HTPC running Debian Squeeze, with no window manager installed. &lt;br /&gt;
&lt;br /&gt;
* Create a new script under &#039;&#039;&#039;/etc/init.d/&#039;&#039;&#039;. Call it &#039;&#039;&#039;kodi&#039;&#039;&#039;&lt;br /&gt;
* Change the rights, in order to allow it to be executable.&lt;br /&gt;
&amp;lt;pre&amp;gt;# chmod a+x /etc/init.d/kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* copy the code under in the file. Modify the variables to suit your configuration:&lt;br /&gt;
&amp;lt;pre&amp;gt;#! /bin/sh&lt;br /&gt;
&lt;br /&gt;
### BEGIN INIT INFO&lt;br /&gt;
# Provides:          kodi&lt;br /&gt;
# Required-Start:    $all&lt;br /&gt;
# Required-Stop:     $all&lt;br /&gt;
# Default-Start:     2 3 4 5&lt;br /&gt;
# Default-Stop:      0 1 6&lt;br /&gt;
# Short-Description: starts instance of Kodi&lt;br /&gt;
# Description:       starts instance of Kodi using start-stop-daemon and xinit&lt;br /&gt;
### END INIT INFO&lt;br /&gt;
&lt;br /&gt;
############### EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
# path to xinit exec&lt;br /&gt;
DAEMON=/usr/bin/xinit&lt;br /&gt;
&lt;br /&gt;
# startup args&lt;br /&gt;
DAEMON_OPTS=&amp;quot; /usr/local/bin/kodi-standalone -- :0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# script name&lt;br /&gt;
NAME=kodi&lt;br /&gt;
&lt;br /&gt;
# app name&lt;br /&gt;
DESC=Kodi&lt;br /&gt;
&lt;br /&gt;
# user&lt;br /&gt;
RUN_AS=kodi&lt;br /&gt;
&lt;br /&gt;
# Path of the PID file&lt;br /&gt;
PID_FILE=/var/run/kodi.pid&lt;br /&gt;
&lt;br /&gt;
############### END EDIT ME ##################&lt;br /&gt;
&lt;br /&gt;
test -x $DAEMON || exit 0&lt;br /&gt;
&lt;br /&gt;
set -e&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
  start)&lt;br /&gt;
        echo &amp;quot;Starting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  stop)&lt;br /&gt;
        echo &amp;quot;Stopping $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        ;;&lt;br /&gt;
&lt;br /&gt;
  restart|force-reload)&lt;br /&gt;
        echo &amp;quot;Restarting $DESC&amp;quot;&lt;br /&gt;
        start-stop-daemon --stop --pidfile $PID_FILE&lt;br /&gt;
        sleep 5&lt;br /&gt;
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS&lt;br /&gt;
        ;;&lt;br /&gt;
  *)&lt;br /&gt;
        N=/etc/init.d/$NAME&lt;br /&gt;
        echo &amp;quot;Usage: $N {start|stop|restart|force-reload}&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the script by trying to start / stop Kodi with it.&lt;br /&gt;
&amp;lt;pre&amp;gt;# /etc/init.d/kodi start&lt;br /&gt;
........&lt;br /&gt;
# /etc/init.d/kodi stop&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If all is ok, you can add the script to your configuration, by issuing a &amp;quot;update-rc.d&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;# update-rc.d kodi defaults&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* You can now reboot the server, Kodi should be started just after the boot sequence.&lt;br /&gt;
&lt;br /&gt;
== Add a new systemd script ==&lt;br /&gt;
&lt;br /&gt;
This method is for systems that use systemd as init system such as current versions of Debian (since version 8, Jessie) and Ubuntu (since version 15.04, Vivid Vervet).&lt;br /&gt;
&lt;br /&gt;
* create a new service file under &#039;&#039;&#039;/etc/systemd/system&#039;&#039;&#039;, call it &#039;&#039;&#039;kodi.service&#039;&#039;&#039; and copy the following code into the file: &lt;br /&gt;
&amp;lt;pre&amp;gt;[Unit]&lt;br /&gt;
Description = Kodi Media Center&lt;br /&gt;
&lt;br /&gt;
# if you don&#039;t need the MySQL DB backend, this should be sufficient&lt;br /&gt;
After = systemd-user-sessions.service network.target sound.target&lt;br /&gt;
&lt;br /&gt;
# if you need the MySQL DB backend, use this block instead of the previous&lt;br /&gt;
# After = systemd-user-sessions.service network.target sound.target mysql.service&lt;br /&gt;
# Wants = mysql.service&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
User = kodi&lt;br /&gt;
Group = kodi&lt;br /&gt;
Type = simple&lt;br /&gt;
#PAMName = login # you might want to try this one, did not work on all systems&lt;br /&gt;
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-standalone -- :0 -nolisten tcp vt7&lt;br /&gt;
Restart = on-abort&lt;br /&gt;
RestartSec = 5&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy = multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* modify the variables (user, group, paths...) to match your configuration. Save the file.&lt;br /&gt;
* try to start (and stop) Kodi to make sure the script is working properly&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl start kodi&lt;br /&gt;
........&lt;br /&gt;
# systemctl stop kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If Kodi does not start, you may need to allow X to start from non-consoles. Under Debian/Ubuntu, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;# dpkg-reconfigure x11-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;.&lt;br /&gt;
* As of Ubuntu 16.04 (Xenial Xerus), you need to install and reconfigure the package &#039;&#039;&#039;xserver-xorg-legacy&#039;&#039;&#039; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;# apt-get install xserver-xorg-legacy&lt;br /&gt;
# dpkg-reconfigure xserver-xorg-legacy&amp;lt;/pre&amp;gt;&lt;br /&gt;
and choose &amp;quot;Anyone&amp;quot;. You&#039;ll also need edit the file &#039;&#039;&#039;&amp;lt;code&amp;gt;/etc/X11/Xwrapper.config&amp;lt;/code&amp;gt;&#039;&#039;&#039; and add the following to a new line at the end of the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
needs_root_rights=yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* if you do not experience any issues, make Kodi start automatically&lt;br /&gt;
&amp;lt;pre&amp;gt;# systemctl enable kodi&amp;lt;/pre&amp;gt;&lt;br /&gt;
* reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
== Use autologin feature of lightdm ==&lt;br /&gt;
&lt;br /&gt;
This works if you have a window manager as well.&lt;br /&gt;
&lt;br /&gt;
* Install lightdm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039;/etc/lightdm/lightdm.conf&#039;&#039;&#039; and set the following settings under section &#039;&#039;&#039;[Seat:*]&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Seat:*]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
autologin-session=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Reboot and you&#039;re done&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:How-to]]&lt;br /&gt;
[[Category:Manual]]&lt;/div&gt;</summary>
		<author><name>Andrebrait</name></author>
	</entry>
</feed>