HOW-TO:Autostart Kodi for Linux: Difference between revisions
No edit summary |
(Making it tidy. For some reason it does not show me the human verification box to insert external links.) |
||
Line 104: | Line 104: | ||
Remember you can modify use and reuse the '''.xinitrc''' file to configure '''.xsession''' 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. | Remember you can modify use and reuse the '''.xinitrc''' file to configure '''.xsession''' 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. | ||
== | == Xsession for Kodi standalone service == | ||
Kodi full-screen is not the same Kodi standalone service, which runs in Xserver in the default window manager. | Kodi full-screen is not the same Kodi standalone service, which runs in Xserver in the default window manager. |
Revision as of 04:25, 2 February 2018
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.
Switch to root
su
or
sudo su
Create a Kodi user
To use Kodi full-screen, you only have to create a standard user.
adduser kodi
Customize LightDM to autologin
You can utilize the ability to customize LightDM data manager by changing the builtin custom configuration file 50-myconfig.conf using nano or another text editor.
mkdir /etc/lightdm/lightdm.conf.d nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf
Inside this new file add the following text.
[SeatDefaults] autologin-user=kodi
Configure Kodi to autostart
Configure Kodi to autostart.
ln -s /usr/bin/kodi ~/.config/autostart
If Kodi is not installed at the standard path, find it using the which command.
which kodi
Disable / enable the login prompt
You can disable the graphical login prompt.
systemctl set-default multi-user.target
To enable it again use.
systemctl set-default graphical.target
Create custom Xsession script
Create a custom Xsession script with a text editor.
nano ~/.xinitrc
To run Kodi full-screen make sure the text reads:
#!/usr/bin/env bash exec /usr/bin/x-window-manager & /usr/bin/kodi -fs &
If you are not sure of the path of X Window Manager, use the which command.
which x-window-manager
Use sudo and the .xinitrc file to configure .xsession.
sudo -H -u kodi bash -c "ln -s ~/.xinitrc ~/.xsession"
You need to use sudo to run this command. If you do not have sudo, install it.
apt install sudo
Remember you can modify use and reuse the .xinitrc file to configure .xsession 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.
Xsession for Kodi standalone service
Kodi full-screen is not the same Kodi standalone service, which runs in Xserver in the default window manager.
In order to use Kodi standalone service, create a Kodi user with no login and no password.
useradd -c 'kodi user' -u 420 -g kodi -G audio,video,network,optical \ -d /var/lib/kodi -s /usr/bin/nologin kodi passwd -l kodi > /dev/null mkdir /var/lib/kodi/.kodi chown -R kodi:kodi /var/lib/kodi/.kodi
You can download the zip file for Kodi standalone service from GitHub.
[...//github.com/graysky2/kodi-standalone-service Kodi standalone service on GitHub] won't let me link it!
Most systems utilize the client version of the software Kodi standalone service requires.
Upgrade to the server versions of the X Window System.
apt install xauth apt install xorg apt install xinit apt install xserver-xorg-core apt install xserver-xorg apt install xserver-common
You can install Kodi standalone service with one easy command.
unzip -p kodi-standalone-service-master/kodi-standalone-service-master/init/kodi.service>/usr/lib/systemd/system/kodi.service
You can now run Kodi standalone service by running one simple command.
systemctl start kodi
To run Kodi standalone service at boot, open .xinitrc with a text editor.
nano ~/.xinitrc
Create a custom Xsession script. Make sure it contains the following text.
#!/usr/bin/env bash systemctl start /usr/bin/kodi &
Use the .xinitrc file to configure .xsession for Kodi standalone service..
sudo -H -u kodi bash -c "ln -s ~/.xinitrc ~/.xsession"
Xsession to boot to app / WM / DE
You can use any window manager or desktop enviroment with a custom Xsession script as long as it is intalled.
You do this by creating .xinitrc script that contains the command to start the WM or DE.
For instance, if you are using FluxBox?
#!/usr/bin/env bash exec fluxbox & /usr/bin/kodi -fs &
The -fs option is full-screen.
To start Gnome with Kodi full-screen:
#!/usr/bin/env bash exec gnome-session & /usr/bin/kodi -fs &
Use the .xinitrc file to configure .xsession to create a custom login for any user, not just Kodi.
sudo -H -u [username] bash -c "ln -s ~/.xinitrc ~/.xsession"
Add a custom Grub entry
If you want to boot to the CLI and manually launch an app, WM or DE, add a custom grub entry.
The right way to add a custom grub entry is to copy the menu entry you want to change or duplicate.
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.
cp /boot/grub/grub.cfg grub.cfg gedit grub.cfg
Copy the menu entry and paste it into 40_custom with a text editor in the CLI.
nano /etc/grub.d/40_custom
Where the menu entry contains quiet splash change it to text instead.
You should also change the name of the entry!
I just appended mine with “CLI” for command line interface.
You can the boot to the CLI of your operating system.
You can launch Kodi standalone service.
systemctl start kodi
To launch a WM.
fluxbox
To launch a DE.
gnome-session
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.