<?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=W3tech</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=W3tech"/>
	<link rel="alternate" type="text/html" href="https://kodi.wiki/view/Special:Contributions/W3tech"/>
	<updated>2026-06-25T12:26:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=225337</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=225337"/>
		<updated>2021-04-26T14:40:00Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will generate a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
A)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo sed -i &amp;quot;1i @kodi&amp;quot; /etc/xdg/lxsession/LXDE-pi/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
B)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument. You do not have to install &#039;&#039;&#039;kodi-standalone&#039;&#039;&#039; with Apt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if I were to install &#039;&#039;&#039;kodi-standalone&#039;&#039;&#039; after installing the standard &#039;&#039;&#039;kodi&#039;&#039;&#039; package, this is the message I get.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@raspberrypi:/home/pi# apt install kodi-standalone&lt;br /&gt;
Reading package lists... Done&lt;br /&gt;
Building dependency tree       &lt;br /&gt;
Reading state information... Done&lt;br /&gt;
Note, selecting &#039;kodi&#039; instead of &#039;kodi-standalone&#039;&lt;br /&gt;
kodi is already the newest version (2:18.7-1~buster).&lt;br /&gt;
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&lt;br /&gt;
root@raspberrypi:/home/pi#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is because it used to a separate package, but since then it has been made into a command. It is really only a trivial difference, instead of using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One or the other, not both.&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +rx ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run each command in the background till the last line or your script will get stuck on the first line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=225336</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=225336"/>
		<updated>2021-04-26T14:36:37Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will generate a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
A)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo sed -i &amp;quot;1i @kodi&amp;quot; /etc/xdg/lxsession/LXDE-pi/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
B)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument. You do not have to install &#039;&#039;&#039;kodi-standalone&#039;&#039;&#039; with Apt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if I were to install &#039;&#039;&#039;kodi-standalone&#039;&#039;&#039; after installing the standard &#039;&#039;&#039;kodi&#039;&#039;&#039; package, this is the message I get.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@raspberrypi:/home/pi# apt install kodi-standalone&lt;br /&gt;
Reading package lists... Done&lt;br /&gt;
Building dependency tree       &lt;br /&gt;
Reading state information... Done&lt;br /&gt;
Note, selecting &#039;kodi&#039; instead of &#039;kodi-standalone&#039;&lt;br /&gt;
kodi is already the newest version (2:18.7-1~buster).&lt;br /&gt;
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&lt;br /&gt;
root@raspberrypi:/home/pi#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is because it used to a separate package, but since then it has been made into a command. It is really only a trivial difference, instead of using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One or the other, not both.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +rx ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run each command in the background till the last line or your script will get stuck on the first line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=177634</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=177634"/>
		<updated>2019-08-09T01:41:53Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Corrected typo.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will generate a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run each command in the background till the last line or your script will get stuck on the first line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=150901</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=150901"/>
		<updated>2018-12-19T15:25:01Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run each command in the background till the last line or your script will get stuck on the first line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=150900</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=150900"/>
		<updated>2018-12-19T15:22:06Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run each command in the background till the last line or your script will get stuck on the first line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147929</id>
		<title>User:W3tech</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147929"/>
		<updated>2018-11-16T03:10:51Z</updated>

		<summary type="html">&lt;p&gt;W3tech: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am W3Techie, developer/webmaster and sometimes programmer.&lt;br /&gt;
&lt;br /&gt;
My interest is developing Kodi-embedded Linux. Not just making an OS boot to Kodi, but actually creating metapackages with supporting software.&lt;br /&gt;
&lt;br /&gt;
I am also interested in improving documentation for Kodi both on the wiki and anywhere else online it can be improved. Like most great software there is never enough documentation. Most people have no idea all the crazy things you can do with Kodi. And today development has become easier than ever.&lt;br /&gt;
&lt;br /&gt;
You can talk to me [[User talk:w3tech|here]].&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147924</id>
		<title>User:W3tech</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147924"/>
		<updated>2018-11-14T14:37:26Z</updated>

		<summary type="html">&lt;p&gt;W3tech: ,&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am W3Techie, developer/webmaster and sometimes programmer.&lt;br /&gt;
&lt;br /&gt;
My interest is developing Kodi-embedded Linux. Not just making an OS boot to Kodi, but actually creating metapackages with supporting software.&lt;br /&gt;
&lt;br /&gt;
I am also interested in improving documentation for Kodi both on the wiki and anywhere else online it can be improved. Like most great software there is never enough documentation. Most people have no idea all the crazy things you can do with Kodi. And today development has become easier than ever.&lt;br /&gt;
&lt;br /&gt;
You can talk to me here.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147923</id>
		<title>User:W3tech</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147923"/>
		<updated>2018-11-14T14:36:50Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Corrected grammar.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am W3Techie, developer/webmaster and sometimes programmer.&lt;br /&gt;
&lt;br /&gt;
My interest is developing Kodi-embedded Linux. Not just making an OS boot to Kodi but actually creating metapackages with supporting software.&lt;br /&gt;
&lt;br /&gt;
I am also interested in improving documentation for Kodi both on the wiki and anywhere else online it can be improved. Like most great software there is never enough documentation. Most people have no idea all the crazy things you can do with Kodi. And today development has become easier than ever.&lt;br /&gt;
&lt;br /&gt;
You can talk to me here.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147922</id>
		<title>User:W3tech</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=User:W3tech&amp;diff=147922"/>
		<updated>2018-11-14T14:27:26Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Adding some basic info about me.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am W3Techie, developer/webmaster and sometimes programmer.&lt;br /&gt;
&lt;br /&gt;
My interest is developing Kodi-embedded Linux not just making an OS boot to Kodi but actually creating metapackages with supporting software.&lt;br /&gt;
&lt;br /&gt;
I am also interested in improving documentation for Kodi both on the wiki and anywhere else online it can be improved. Like most great software there is never enough documentation. Most people have no idea all the crazy things you can do with Kodi. And today development has become easier than ever.&lt;br /&gt;
&lt;br /&gt;
You can talk to me here.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=Archive:Xbmcaddon_module&amp;diff=147919</id>
		<title>Archive:Xbmcaddon module</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=Archive:Xbmcaddon_module&amp;diff=147919"/>
		<updated>2018-11-14T00:23:00Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Added link to Kodi documentation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mininav|[[Development]]|[[Add-on development]]|[[Python development]]}}&lt;br /&gt;
&lt;br /&gt;
The documentation for the xbmcaddon module may be found here https://codedocs.xyz/AlwinEsch/kodi/group__python__xbmcaddon.html. The &#039;&#039;&#039;getSetting&#039;&#039;&#039; and &#039;&#039;&#039;setSetting&#039;&#039;&#039; commands may be used to store state information between calls, in addition to accessing configuration information. &#039;&#039;&#039;openSettings&#039;&#039;&#039; pops up the configuration dialog allowing the user to change the configuration of your plugin source. &#039;&#039;&#039;getLocalizedString&#039;&#039;&#039; retrieves translated strings, and &#039;&#039;&#039;getAddonInfo&#039;&#039;&#039; returns pertinent information about your pluginsource should you want to display this via some other means.&lt;br /&gt;
&lt;br /&gt;
  import xbmcaddon&lt;br /&gt;
  __settings__ = xbmcaddon.Addon(id=&#039;&amp;lt;your addons ID&amp;gt;&#039;)&lt;br /&gt;
  __language__ = __settings__.getLocalizedString&lt;br /&gt;
  __language__(30204)              # this will return localized string from resources/language/&amp;lt;name_of_language&amp;gt;/strings.xml&lt;br /&gt;
  __settings__.getSetting( &amp;quot;foo&amp;quot; ) # this will return &amp;quot;foo&amp;quot; setting value &lt;br /&gt;
  __settings__.setSetting( &amp;quot;foo&amp;quot; ) # this will set &amp;quot;foo&amp;quot; setting value&lt;br /&gt;
  __settings__.openSettings()      # this will open settings window&lt;br /&gt;
&lt;br /&gt;
please note that &amp;lt;your addons ID&amp;gt; mentioned above must be the same as addon id=&amp;quot;&amp;lt;your addons ID&amp;gt; in addons.xml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&#039;&#039;&#039;Development:&#039;&#039;&#039;&lt;br /&gt;
* [[Add-on development]]&lt;br /&gt;
* [[Python development]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Add-on development]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139292</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=139292"/>
		<updated>2018-06-16T23:01:42Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
# pi ALL=NOPASSWD: /usr/bin/chvt #(if you do not add user kodi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139291</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=139291"/>
		<updated>2018-06-16T22:53:21Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. &lt;br /&gt;
&lt;br /&gt;
You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use &#039;&#039;&#039;visudo&#039;&#039;&#039; simply run the command in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in /etc/sudoers with &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/sudoers&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an entry on any line that is comfortable to you like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139289</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=139289"/>
		<updated>2018-06-16T18:33:23Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139288</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=139288"/>
		<updated>2018-06-16T18:32:11Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 3 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For two monitors add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -le 2 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a single monitor use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139287</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=139287"/>
		<updated>2018-06-16T18:28:42Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To enable multiple displays edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139284</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=139284"/>
		<updated>2018-06-16T18:11:55Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone #(this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone #(this is the syntax that works on Raspbian, not other Pi operating systems)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Raspbian has a repository package for everything, so kodi-standalone can be run as a package rather than a command argument.&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=139220</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=139220"/>
		<updated>2018-06-14T16:40:36Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install cron&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi --standalone (this is proper syntax for most Kodi installs)&lt;br /&gt;
#kodi-standalone (this is the syntax that works on Pi)&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136929</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=136929"/>
		<updated>2018-05-02T23:35:12Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Customize LightDM to autologin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure LightDM for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTRL +O +Enter +X to save and exit from &#039;&#039;&#039;nano&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136928</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=136928"/>
		<updated>2018-05-02T23:25:06Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136907</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=136907"/>
		<updated>2018-04-29T18:08:10Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Customize LightDM to autologin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then you can create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136906</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=136906"/>
		<updated>2018-04-29T14:18:43Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a startup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136905</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=136905"/>
		<updated>2018-04-29T14:17:29Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://yingtongli.me/blog/2016/12/21/splash.html Raspbian splash screen guide - Clean up the boot process]&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136904</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=136904"/>
		<updated>2018-04-29T13:52:00Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Installing the X11 Window System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires.&lt;br /&gt;
&lt;br /&gt;
For more X11 features and functionality, you may optionally upgrade to the server software packages for the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136903</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=136903"/>
		<updated>2018-04-29T13:45:07Z</updated>

		<summary type="html">&lt;p&gt;W3tech: More cleaning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is installed.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136902</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=136902"/>
		<updated>2018-04-29T13:10:04Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
And this link shows how to autostart an app in LXDE on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136901</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=136901"/>
		<updated>2018-04-29T13:07:42Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */ Cleaning up.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
Autostarting apps on Raspbian is possible using the DE, as well.&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
Other things to tweak on Raspbian.&lt;br /&gt;
&lt;br /&gt;
[https://scribles.net/lightning-bolt-under-voltage-warning-on-raspberry-pi/ Under voltage warning and disabling splash screen on Raspbian]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136900</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=136900"/>
		<updated>2018-04-29T12:44:37Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Taking out the unnecessary Grub entry section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System. &lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy &lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reconfigure X11 with these commands, choose to allow non-root users (anybody) to start an Xsession. You should see your changes take effect after rebooting.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136899</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=136899"/>
		<updated>2018-04-29T12:33:27Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Making it more tidy and presentable.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or a combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Installing the X11 Window System ==&lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
Custom user sessions can be created with the X11 Window System to run scripts, autostart apps, and launch a WM or DE.&lt;br /&gt;
&lt;br /&gt;
LightDM is used for autologin.&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System. &lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136898</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=136898"/>
		<updated>2018-04-29T11:52:48Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And create an &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable by running.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136897</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=136897"/>
		<updated>2018-04-29T11:45:58Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */ More how-to clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also consider using Crontab to run a script, much like described on this page in the section entitled &amp;quot;Run kodi in a window manager&amp;quot; if you scroll down the page.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Kodi Kodi - Run kodi in a window manager]&lt;br /&gt;
&lt;br /&gt;
Instead your Crontab could look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot startx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your &#039;&#039;&#039;.xinitrc&#039;&#039;&#039; should look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
kodi-standalone&lt;br /&gt;
sudo chvt 2 &lt;br /&gt;
sleep 1&lt;br /&gt;
sudo chvt 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure no password is required by &#039;&#039;&#039;sudo&#039;&#039;&#039; for any user logging in when this script runs, you must edit /etc/sudoers or run the &#039;&#039;&#039;visudo&#039;&#039;&#039; command if it is installed to edit /etc/sudoers. You can install &#039;&#039;&#039;visudo&#039;&#039;&#039; from your Linux distributions default repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install visudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any non-root users, create an entry in this file like shown here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kodi ALL=NOPASSWD: /usr/bin/chvt&lt;br /&gt;
pi ALL=NOPASSWD: /usr/bin/chvt &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example is for users &#039;&#039;&#039;pi&#039;&#039;&#039; and &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136896</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=136896"/>
		<updated>2018-04-29T10:54:29Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
In the above link, the author describes using Crontab (short for &amp;quot;Cron table&amp;quot;) to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cron will ask you to choose a text editor from available options. I choose option 2 for &#039;&#039;&#039;nano&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In the new Crontab, enter the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@reboot kodi --standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should also consider adding a shutdown script, much like described on this page.&lt;br /&gt;
&lt;br /&gt;
[https://www.vdr-portal.de/forum/index.php?thread/128602-kodi-vdr-shutdown-handling/&amp;amp;pageNo=1 Kodi VDR shutdown handling]&lt;br /&gt;
&lt;br /&gt;
If you decide not use a Cron table, you can always remove it again.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crontab -r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136895</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=136895"/>
		<updated>2018-04-29T09:45:22Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */  More clarification. X11 Guide linked.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a custom Xsession script with a text editor we start with an &#039;&#039;&#039;xinitrc&#039;&#039;&#039; script. For more detail on how to create and use &#039;&#039;&#039;xinit&#039;&#039;&#039;, there is a great guide available here.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions Guide to X11 - Starting Sessions - WikiBooks]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136842</id>
		<title>HOW-TO talk:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136842"/>
		<updated>2018-04-28T19:04:29Z</updated>

		<summary type="html">&lt;p&gt;W3tech: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think it&#039;s worth adding an edit here to the effect that - to my knowledge - there&#039;s no way of enabling an ubuntu account to auto-login, and so to autostart Kodi, if the installation uses encrypted home directories. I had this issue and have posted [http://askubuntu.com/questions/209650/autostart-xbmc-at-boot/715976#715976 on the Ask Ubuntu site] to this effect.&lt;br /&gt;
&lt;br /&gt;
May I add a subsection outlining how to remove encrypted home directories per the linked answer above?&lt;br /&gt;
&lt;br /&gt;
[[User:Nmg20|Nmg20]] ([[User talk:Nmg20|talk]]) 17:28, 3 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
:Go for it. -- [[User:Ned Scott|Ned Scott]] ([[User talk:Ned Scott|talk]]) 02:02, 4 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
I updated this old page. I think it could be a lot better. It needs instructions for RPM-based commands and commands on systems like Manjaro which use a different command set. I could do this in time. Anyone who knows how to easily convert the commands can as well. It is very basic stuff. I am surprised no one has written about writing an Xsession script before. Kodi standalone service is new software. It was in the Arch Linux repo, but it got moved. This page could use some screenshots, and I think could be a How-To for any Linux. I cannot seem to get the human verification box for external links, but it prompts me to enter two words. Only there is nowhere to see these words or put them into a box. I am not sure if external links are disabled on this page. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 05:27, 2 February 2018 (EST) w3tech&lt;br /&gt;
&lt;br /&gt;
So the code is much tighter after testing on more Ubuntu derivatives. It also needed put into better order. I am not finished with it yet. Working on screenshots and multimedia and expanding command sets for using other Linux distros. It is really more appropriately a guide for configuring an X Window System with autologin and autostart options. It can be used with any app or media player, not exclusively Kodi. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 14:01, 19 February 2018 (EST)&lt;br /&gt;
&lt;br /&gt;
I am testing various Kodi-embedded and other Linux-embedded Linux, and will be updating this page periodically and accordingly. I plan to provide screenshots and commands for other distros like Manjaro and Fedora in a classic tutorial-style manner. Fedora or OpenSUSE have proved to me the best distros for running Kodi and other media software. Now the wiki lets me insert links after the upgrade. A much nicer theme and layout too! [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 13:20, 27 April 2018 (UTC)w3tech&lt;br /&gt;
&lt;br /&gt;
Cleaned up some errors in syntax and added some information for running Xsession scripts. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 09:07, 28 April 2018 (UTC)w3tech&lt;br /&gt;
&lt;br /&gt;
More clarification may be necessary. It is more important to state how to do it than exactly what to do on this page.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136841</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=136841"/>
		<updated>2018-04-28T19:01:42Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc /home/kodi/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the path goes to user&#039;s home directory. In this example, the user is &#039;&#039;&#039;kodi&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create. &lt;br /&gt;
&lt;br /&gt;
You can also create the &#039;&#039;&#039;.xsession&#039;&#039;&#039; script directly in the home directory, rather than link it from &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039;. This is necessary if you create multiple custom Xsession scripts for multiple users, and you do not in that case link &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; to &#039;&#039;&#039;.xsession&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136840</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=136840"/>
		<updated>2018-04-28T16:59:31Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi, and utilizes a &#039;&#039;&#039;crontab&#039;&#039;&#039;. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. &lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
This is a quick reference for Crontab.&lt;br /&gt;
&lt;br /&gt;
[http://www.adminschoice.com/crontab-quick-reference Crontab Quick Reference]&lt;br /&gt;
&lt;br /&gt;
These linked pages facilitate more tweaks and settings relevant to other uses of the X Window System on Pi.&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136839</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=136839"/>
		<updated>2018-04-28T15:27:11Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Customize LightDM to autologin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you can configure LightDM differently for autologin to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can alternately create /etc/lightdm/lightdm.conf.d/50-myconfig.conf, but should still ensure the settings in /etc/lightdm/lightdm.conf agree.&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136838</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=136838"/>
		<updated>2018-04-28T15:25:13Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136837</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=136837"/>
		<updated>2018-04-28T14:53:06Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi by placing a statup script in the /etc/X11/Xsession.d/ directory.&lt;br /&gt;
&lt;br /&gt;
[https://debian-administration.org/article/50/Running_applications_automatically_when_X_starts Running applications automatically when X starts]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136834</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=136834"/>
		<updated>2018-04-28T09:40:49Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136833</id>
		<title>HOW-TO talk:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136833"/>
		<updated>2018-04-28T09:07:30Z</updated>

		<summary type="html">&lt;p&gt;W3tech: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think it&#039;s worth adding an edit here to the effect that - to my knowledge - there&#039;s no way of enabling an ubuntu account to auto-login, and so to autostart Kodi, if the installation uses encrypted home directories. I had this issue and have posted [http://askubuntu.com/questions/209650/autostart-xbmc-at-boot/715976#715976 on the Ask Ubuntu site] to this effect.&lt;br /&gt;
&lt;br /&gt;
May I add a subsection outlining how to remove encrypted home directories per the linked answer above?&lt;br /&gt;
&lt;br /&gt;
[[User:Nmg20|Nmg20]] ([[User talk:Nmg20|talk]]) 17:28, 3 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
:Go for it. -- [[User:Ned Scott|Ned Scott]] ([[User talk:Ned Scott|talk]]) 02:02, 4 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
I updated this old page. I think it could be a lot better. It needs instructions for RPM-based commands and commands on systems like Manjaro which use a different command set. I could do this in time. Anyone who knows how to easily convert the commands can as well. It is very basic stuff. I am surprised no one has written about writing an Xsession script before. Kodi standalone service is new software. It was in the Arch Linux repo, but it got moved. This page could use some screenshots, and I think could be a How-To for any Linux. I cannot seem to get the human verification box for external links, but it prompts me to enter two words. Only there is nowhere to see these words or put them into a box. I am not sure if external links are disabled on this page. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 05:27, 2 February 2018 (EST) w3tech&lt;br /&gt;
&lt;br /&gt;
So the code is much tighter after testing on more Ubuntu derivatives. It also needed put into better order. I am not finished with it yet. Working on screenshots and multimedia and expanding command sets for using other Linux distros. It is really more appropriately a guide for configuring an X Window System with autologin and autostart options. It can be used with any app or media player, not exclusively Kodi. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 14:01, 19 February 2018 (EST)&lt;br /&gt;
&lt;br /&gt;
I am testing various Kodi-embedded and other Linux-embedded Linux, and will be updating this page periodically and accordingly. I plan to provide screenshots and commands for other distros like Manjaro and Fedora in a classic tutorial-style manner. Fedora or OpenSUSE have proved to me the best distros for running Kodi and other media software. Now the wiki lets me insert links after the upgrade. A much nicer theme and layout too! [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 13:20, 27 April 2018 (UTC)w3tech&lt;br /&gt;
&lt;br /&gt;
Cleaned up some errors in syntax and added some information for running Xsession scripts. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 09:07, 28 April 2018 (UTC)w3tech&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136832</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=136832"/>
		<updated>2018-04-28T09:05:21Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Xsession to boot to app / WM / DE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136831</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=136831"/>
		<updated>2018-04-28T09:01:07Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software an Xsession requires requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System, if you want to utilize all the greatness of the X Window System.&lt;br /&gt;
&lt;br /&gt;
Because of the lack of documentation, it is probably better to find tweaks and hacks on wikis and support pages rather than forums. For instance, the Ubuntu wiki is usually a good source of information.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.ubuntu.com/CustomXSession CustomXSession - Ubuntu Wiki]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
If you are using LightDM and you just want to create a new login entry for user &#039;&#039;&#039;kodi&#039;&#039;&#039;, you must create a new file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /usr/share/xsessions/custom.desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And insert the following text.&lt;br /&gt;
&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Xsession&lt;br /&gt;
Exec=/etc/X11/Xsession&lt;br /&gt;
&lt;br /&gt;
This will create a new login option for the custom Xsession. Only this one entry is necessary for LightDM and X11 to find the &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; script in each user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136830</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=136830"/>
		<updated>2018-04-28T08:41:12Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Xsession to boot to app / WM / DE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Gnome in the background, but launch Kodi in the foreground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136829</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=136829"/>
		<updated>2018-04-28T08:39:49Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Xsession to boot to app / WM / DE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
/usr/bin/kodi -fs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136828</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=136828"/>
		<updated>2018-04-28T08:38:25Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Create custom Xsession script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
exec gnome-session&lt;br /&gt;
/usr/bin/kodi -fs &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136827</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=136827"/>
		<updated>2018-04-28T08:37:19Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
/usr/bin/kodi &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable. Use the ampersand to run an application in the background, such as a WM you only need to for the purpose of launching Kodi but not if you don&#039;t want to use the WM itself. Kodi will not launch without a DE or WM, but placing the ampersand &amp;quot;&amp;amp;&amp;quot; at the end of the command makes it run in the background where it can do its job out of sight. Also, make sure to start a WM or DE before running an application in the foreground. This is not necessary for apps running in the background.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136815</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=136815"/>
		<updated>2018-04-27T14:10:55Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Add a custom Grub entry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app or boot directly to Kodi without a DE or WM, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136814</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=136814"/>
		<updated>2018-04-27T13:36:07Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Xsession to boot to app / WM / DE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And / or...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both packages are installed, you must reconfigure both. Not all systems will use or require the legacy package to allow non-root users to start X.&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app, WM or DE, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:Autostart_Kodi_for_Linux&amp;diff=136813</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=136813"/>
		<updated>2018-04-27T13:32:28Z</updated>

		<summary type="html">&lt;p&gt;W3tech: /* Configure Kodi to autostart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;section begin=&amp;quot;intro&amp;quot; /&amp;gt;&amp;lt;big&amp;gt;Any or all or any combination of these methods can be used to configure a Debian-based X Window System to boot directly to Kodi. This should work on any Linux using the X Window System, but these instructions are particular to Debian derivatives, such as Ubuntu. A server edition is best for running only Kodi, but this page assumes booting into a desktop OS, not a server distro. However, the instructions here can be used for a server distro with even less configuration than for a desktop. Experiment inside VirtualBox before you apply any of these to your system and make a backup.&amp;lt;/big&amp;gt;&amp;lt;section end=&amp;quot;intro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Switch to root ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo su&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a Kodi user ==&lt;br /&gt;
&lt;br /&gt;
To use Kodi full-screen, you only have to create a standard user.&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;
To remove the password use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd -d kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Customize LightDM to autologin ==&lt;br /&gt;
&lt;br /&gt;
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or another text editor. If you have no DE or WM you can install &#039;&#039;&#039;lightdm&#039;&#039;&#039;, but should make sure to do a bit of research before you do. Most versions of Linux use LightDM, but many server versions do not. For Ubuntu Server with no DE, for example, installing &#039;&#039;&#039;lightdm&#039;&#039;&#039; is okay and necessary. Changing the behavior of LightDM is done using a custom &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; configuration file.&lt;br /&gt;
&lt;br /&gt;
To see if you have &#039;&#039;&#039;lightdm&#039;&#039;&#039; use &#039;&#039;&#039;which&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, install it with &#039;&#039;&#039;apt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install lightdm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom configuration file called &#039;&#039;&#039;50-myconfig.conf&#039;&#039;&#039; using &#039;&#039;&#039;nano&#039;&#039;&#039; or other CLI text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /etc/lightdm/lightdm.conf.d/&lt;br /&gt;
nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside this new file add the following text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[SeatDefaults]&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configure Kodi to autostart ==&lt;br /&gt;
&lt;br /&gt;
Configure Kodi to autostart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.config/autostart&lt;br /&gt;
ln -s /usr/bin/kodi ~/.config/autostart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method of autostart requires a desktop environment or DE. This is done a bit differently by each DE. Some helpful links can easily be found in today&#039;s Web search using any search engine.&lt;br /&gt;
&lt;br /&gt;
[http://edoceo.com/gui/xfce-autostart-apps Autostart Apps in XFCE]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi is a bit more of a tweak, but these are excellent links that will tell you how. The first link is the most helpful to making sure Kodi autostarts in Pi. There are many settings on the Pi that control boot, and the first link gives the best most trouble-free way to boot directly to Kodi. The others facilitate more tweaks and settings relevant to other uses of the X Window System.&lt;br /&gt;
&lt;br /&gt;
[https://www.leowkahman.com/2016/03/05/lamp-stack-on-raspberry-pi-with-kodi-running-at-startup/ LAMP stack on Raspberry Pi with Kodi running at startup]&lt;br /&gt;
&lt;br /&gt;
[http://ozzmaker.com/enable-x-windows-on-piscreen/ Enable X Window System on PiScreen]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie Remove boot messages all text in Raspbian - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/47823/how-to-prevent-autologin-of-gui How to prevent or allow autologin of GUI - Raspberry Pi Stack Exchange]&lt;br /&gt;
&lt;br /&gt;
[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui Auto running programs LXDE - Raspberry Pi Projects]&lt;br /&gt;
&lt;br /&gt;
And, if you would rather, it is easier to follow the process provided by this link to modify the Raspbian image before installing it onto the microSD card.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.debian.org/RaspberryPi/qemu-user-static Modifying Raspbian with qemu-user-static]&lt;br /&gt;
&lt;br /&gt;
The above link describes removing the DE from a Raspbian image, though Raspbian Lite is a much better starting point for using Qemu for this purpose.&lt;br /&gt;
&lt;br /&gt;
On Raspbian, you configure LightDM differently for autologin, which is necessary to boot directly to Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/lightdm/lightdm.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment the following line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#autologin-user=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And add the user you want to autologin and autostart Kodi. The user is named &#039;&#039;&#039;kodi&#039;&#039;&#039; in this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
autologin-user=kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Kodi is not installed at the standard path, find it using the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use the X11 Window System to autostart Kodi.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Insert this text into the new file. Use CTRL + O + Enter + X to save the file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have a WM, such as Blackbox you can add it here as well. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/kodi &amp;amp;&lt;br /&gt;
blackbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set permissions to make it executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 755 /etc/X11/Xsession.d/startup-local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This feature is available on X Window System operating systems without upgrading to Xserver. Most Linux distributions use the X Window System.&lt;br /&gt;
&lt;br /&gt;
== Disable / enable the login prompt ==&lt;br /&gt;
&lt;br /&gt;
You can disable the graphical login prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable it again use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
systemctl set-default graphical.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using an autologin method associated with your DE or WM, you &#039;&#039;&#039;do not&#039;&#039;&#039; want to disable the graphical login. &lt;br /&gt;
&lt;br /&gt;
Even if you are using something like [https://github.com/graysky2/kodi-standalone-service Kodi Standalone Service], you still need use a WM or a DE that installs the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; software package. &lt;br /&gt;
&lt;br /&gt;
To ensure you have this installed use the &#039;&#039;&#039;which&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no such package, you can use &#039;&#039;&#039;apt&#039;&#039;&#039; to search your Linux distributions repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-cache search x-window-manager&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will general a list of packages containing &#039;&#039;&#039;x-window-manager&#039;&#039;&#039;, which cannot be installed alone. If you are not using a DE, you need to use a WM. And, you can also use a compositing WM like Compiz, for fast 3D effects.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Compiz Compiz - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
A note on using Kodi Standalone Service, this package runs Kodi as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service and disables the login for user &#039;&#039;&#039;kodi&#039;&#039;&#039; and will not work when autologin is enabled. In fact, it will break the login process if you autologin user &#039;&#039;&#039;kodi&#039;&#039;&#039; and run Kodi Standalone Service at the same time. This package is installed automatically with the standard Kodi package when you install Kodi on Raspbian, but must be configured manually for all other Linux distributions. You can run the &#039;&#039;&#039;which&#039;&#039;&#039; command to find this package as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which kodi-standalone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be advised, Kodi Standalone Service still launches the Kodi GUI and still requires a WM even though it is running as a &#039;&#039;&#039;systemd&#039;&#039;&#039; service. When you install a WM such as &#039;&#039;&#039;xfwm4&#039;&#039;&#039; (the WM for XFCE4), the CLI will tell you if it provides the &#039;&#039;&#039;x-window-manager&#039;&#039;&#039; package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Setting up xfwm4 (4.12.4-1) ...&lt;br /&gt;
update-alternatives: using /usr/bin/xfwm4 to provide /usr/bin/x-window-manager (x-window-manager) in auto mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not see this message at the end of the installation, the WM you selected does not provide this software package and may not actually be a complete WM itself but only part of a package containing a WM.&lt;br /&gt;
&lt;br /&gt;
For a great example on exactly how you would do this with &#039;&#039;&#039;xfwm4&#039;&#039;&#039;, see this ArchWiki entry.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xfwm XFWM - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
== Create custom Xsession script ==&lt;br /&gt;
&lt;br /&gt;
Most systems utilize the client version of the X11 software Kodi standalone service requires.&lt;br /&gt;
&lt;br /&gt;
Upgrade to the server versions of the X Window System.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install xauth xorg xinit xserver-xorg-core xserver-xorg xserver-common&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a custom Xsession script with a text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run Kodi full-screen make sure the text reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &#039;&#039;&#039;gnome-session&#039;&#039;&#039; with the DE or WM command you are using. See the last section for examples.&lt;br /&gt;
&lt;br /&gt;
To make &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; executable use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod +x ~/.xinitrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;sudo&#039;&#039;&#039; and the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u kodi bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to use &#039;&#039;&#039;sudo&#039;&#039;&#039; to run this command. If you do not have &#039;&#039;&#039;sudo&#039;&#039;&#039;, install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt install sudo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you create a symbolic link and want to remove it, simply remove the existing &#039;&#039;&#039;.xsession&#039;&#039;&#039; file you created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /home/kodi/.xsession&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember you can modify use and reuse the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; as often as you want. That is the purpose of the file. It does nothing on its own until you associate it with a user. On some systems using a DE such as Gnome, not all systems using Gnome, it may be necessary for &#039;&#039;&#039;.xsession&#039;&#039;&#039; to be &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039;. Though this is more likely the case for organization network computers than a personal one, where configurations may vary on a diversity of machines. Most of the time, it will be &#039;&#039;&#039;.xsession&#039;&#039;&#039; rather than &#039;&#039;&#039;.xsessionrc&#039;&#039;&#039; that you want to create.&lt;br /&gt;
&lt;br /&gt;
You must also autostart the X Window system, which differs somewhat from scenario to scenario. For most setups, all that is necessary is to edit the &#039;&#039;&#039;.bashrc&#039;&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano ~/.bashrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following as shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [[ ! $DISPLAY &amp;amp;&amp;amp; $XDG_VTNR -eq 1 ]]; then&lt;br /&gt;
  exec startx&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you wish to remain logged in after quitting X, remove the &#039;&#039;&#039;exec&#039;&#039;&#039; from the above. Other configurations can be applied, but are irrelevant to autostarting Kodi.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login Xinit Autostart X at login]&lt;br /&gt;
&lt;br /&gt;
== Xsession to boot to app / WM / DE ==&lt;br /&gt;
&lt;br /&gt;
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.&lt;br /&gt;
&lt;br /&gt;
You do this by creating &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; script that contains the command to start the WM or DE.&lt;br /&gt;
&lt;br /&gt;
For instance, if you are using FluxBox?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec fluxbox &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-fs&amp;lt;/code&amp;gt; option is full-screen.&lt;br /&gt;
&lt;br /&gt;
To start Gnome with Kodi full-screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
/usr/bin/kodi -fs &amp;amp;&lt;br /&gt;
exec gnome-session &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;~/.xinitrc&#039;&#039;&#039; file to configure &#039;&#039;&#039;~/.xsession&#039;&#039;&#039; to create a custom login for any user, not just Kodi. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo -H -u [username] bash -c &amp;quot;ln -s ~/.xinitrc ~/.xsession&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must reconfigure Xserver for any user that is not a privileged user to be able to start a custom Xsession.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg-legacy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure xserver-xorg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add a custom Grub entry ==&lt;br /&gt;
&lt;br /&gt;
If you want to boot to the CLI and manually launch an app, WM or DE, add a custom grub entry.&lt;br /&gt;
&lt;br /&gt;
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.&lt;br /&gt;
&lt;br /&gt;
Copy the default Grub configuration file and open it with a text editor on your desktop. If you use a text editor on the CLI, the text will be cut off by the window when copying and pasting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /boot/grub/grub.cfg grub.cfg&lt;br /&gt;
gedit grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the menu entry and paste it into &#039;&#039;&#039;40_custom&#039;&#039;&#039; with a text editor in the CLI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nano /etc/grub.d/40_custom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the menu entry contains &#039;&#039;&#039;quiet splash&#039;&#039;&#039; change it to &#039;&#039;&#039;text&#039;&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
You should also change the name of the entry!&lt;br /&gt;
&lt;br /&gt;
I just appended mine with “CLI” for command line interface.&lt;br /&gt;
&lt;br /&gt;
To update Grub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update-grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To launch a WM you can type its name. I use Enlightment 17 or Fluxbox. It must be installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fluxbox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have FluxBox installed. There are countless other window managers.&lt;br /&gt;
&lt;br /&gt;
To launch a DE you enter the appropriate command. For Gnome desktop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gnome-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For KDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startkde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
plasma-desktop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For XFCE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startxfce4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mate-session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For LXDE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
startlxde&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can either manually launch your apps, boot right into them, or create an Xsession for each user. This is great when you want to create a Kodi user for running Kodi only, and for making sure you can still login to your DE with your regular user account. You can boot to any app full-screen this way, not just Kodi. You can create a custom Xsession script for any user, configured with any startup applications running in full-screen mode or normally. &lt;br /&gt;
&lt;br /&gt;
By optionally creating a Grub menu entry, you can create a different Grub menu selection to boot only to the CLI and start an Xsession with a script or run commands manually.&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136812</id>
		<title>HOW-TO talk:Autostart Kodi for Linux</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO_talk:Autostart_Kodi_for_Linux&amp;diff=136812"/>
		<updated>2018-04-27T13:20:38Z</updated>

		<summary type="html">&lt;p&gt;W3tech: Changes update and planned changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think it&#039;s worth adding an edit here to the effect that - to my knowledge - there&#039;s no way of enabling an ubuntu account to auto-login, and so to autostart Kodi, if the installation uses encrypted home directories. I had this issue and have posted [http://askubuntu.com/questions/209650/autostart-xbmc-at-boot/715976#715976 on the Ask Ubuntu site] to this effect.&lt;br /&gt;
&lt;br /&gt;
May I add a subsection outlining how to remove encrypted home directories per the linked answer above?&lt;br /&gt;
&lt;br /&gt;
[[User:Nmg20|Nmg20]] ([[User talk:Nmg20|talk]]) 17:28, 3 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
:Go for it. -- [[User:Ned Scott|Ned Scott]] ([[User talk:Ned Scott|talk]]) 02:02, 4 January 2016 (EST)&lt;br /&gt;
&lt;br /&gt;
I updated this old page. I think it could be a lot better. It needs instructions for RPM-based commands and commands on systems like Manjaro which use a different command set. I could do this in time. Anyone who knows how to easily convert the commands can as well. It is very basic stuff. I am surprised no one has written about writing an Xsession script before. Kodi standalone service is new software. It was in the Arch Linux repo, but it got moved. This page could use some screenshots, and I think could be a How-To for any Linux. I cannot seem to get the human verification box for external links, but it prompts me to enter two words. Only there is nowhere to see these words or put them into a box. I am not sure if external links are disabled on this page. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 05:27, 2 February 2018 (EST) w3tech&lt;br /&gt;
&lt;br /&gt;
So the code is much tighter after testing on more Ubuntu derivatives. It also needed put into better order. I am not finished with it yet. Working on screenshots and multimedia and expanding command sets for using other Linux distros. It is really more appropriately a guide for configuring an X Window System with autologin and autostart options. It can be used with any app or media player, not exclusively Kodi. [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 14:01, 19 February 2018 (EST)&lt;br /&gt;
&lt;br /&gt;
I am testing various Kodi-embedded and other Linux-embedded Linux, and will be updating this page periodically and accordingly. I plan to provide screenshots and commands for other distros like Manjaro and Fedora in a classic tutorial-style manner. Fedora or OpenSUSE have proved to me the best distros for running Kodi and other media software. Now the wiki lets me insert links after the upgrade. A much nicer theme and layout too! [[User:W3tech|W3tech]] ([[User talk:W3tech|talk]]) 13:20, 27 April 2018 (UTC)w3tech&lt;/div&gt;</summary>
		<author><name>W3tech</name></author>
	</entry>
</feed>