Phriction This Is A Wiki Documentation Kodi Standalone Kodi Kodi on Debian/Ubuntu/etc History Version 2 vs 5
Version 2 vs 5
Version 2 vs 5
Edits
Edits
- Edit by keithzg, Version 5
- Nov 30 2019 1:14 AM
- ·Add link to some Raspbian details
- Edit by keithzg, Version 2
- Nov 13 2019 7:24 PM
- ·Half-update teh instructions
Edit Older Version 2... | Edit Current Version 5... |
Content Changes
Content Changes
The official wiki page for this sort of thing is at https://kodi.wiki/view/HOW-TO:HOW-TO:Autostart_Kodi_for_Linux, which points to https://github.com/graysky2/kodi-standalone-service. Here's some modified takes on the official-ish instructions. This presumes you're running Ubuntu 19.04 on a Pi 3, or have a similar setup to that.
NOTE: You could also just use something like LibreELEC if having a full OS on the machine isn't important to you.
== Step 1, Variant A: Kodi from the main repos, using X11 ==
Install Kodi and xinit with `apt install kodi xinit xserver-xorg`.
Create `/etc/systemd/system/kodi.service` with the contents as
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (X11)
After=systemd-user-sessions.service network-online.target sound.target mysqld.service
Requires=network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
== Step 1, Variant B: Kodi customized with hardware acceleration, using GBM ==
Either [[ documentation/kodi/standalone/compile/ | compile it yourself ]] or [[ https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=246837 | grab a package ]]. If you're using the latest Raspbian [[ https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=251645 | a new-enough version should be available in the main repos ]] (as of this writing untested by @keithzg).
Make sure to set the following in `config.txt` (may be either `/boot/config.txt` or `/boot/firmware/config.txt`, depending on the distro):
```
lang=ini, name=config.txt
dtoverlay=vc4-fkms-v3d
gpu_mem=256
```
Then use the following service file (changing the path used by `ExecStart` if you've [[ documentation/kodi/standalone/compile/ | compiled it yourself ]] and installed to a different path):
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (GBM)
After=systemd-user-sessions.service network.target network-online.target sound.target upower.service mysqld.service
Requires=graphical.target
Wants=network.target network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
== Step 2 ==
```
lang=bash
# Add the group
sudo addgroup kodi
# Add the user, giving it no login shell and with /var/lib/kodi as its home directory
sudo useradd -c 'kodi user' -u 420 -g kodi -G audio,input,uucp,video -d /var/lib/kodi -s /usr/sbin/nologin kodi
# Not sure why this is necessary frankly, since the shell is set to nologin anyways
sudo passwd -l kodi > /dev/null
# Actually make the home directory we're using, and set ownership correctly
sudo mkdir /var/lib/kodi
sudo chown -R kodi:kodi /var/lib/kodi
# Now, enable and start the service
sudo systemctl enable kodi.service
sudo systemctl start kodi.service
```
The official wiki page for this sort of thing is at https://kodi.wiki/view/HOW-TO:HOW-TO:Autostart_Kodi_for_Linux, which points to https://github.com/graysky2/kodi-standalone-service. Here's some modified takes on the official-ish instructions. This presumes you're running Ubuntu 19.04 on a Pi 3, or have a similar setup to that.
NOTE: You could also just use something like LibreELEC if having a full OS on the machine isn't important to you.
== Step 1, Variant A: Kodi from the main repos, using X11 ==
Install Kodi and xinit with `apt install kodi xinit xserver-xorg`.
Create `/etc/systemd/system/kodi.service` with the contents as
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (X11)
After=systemd-user-sessions.service network-online.target sound.target mysqld.service
Requires=network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
== Step 1, Variant B: Kodi customized with hardware acceleration, using GBM ==
Either [[ documentation/kodi/standalone/compile/ | compile it yourself ]] or [[ https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=246837 | grab a package ]]. If you're using the latest Raspbian [[ https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=251645 | a new-enough and correctly compiled version is reportedly available in the main repos ]] (as of this writing untested by @keithzg).
Make sure to set the following in `config.txt` (may be either `/boot/config.txt` or `/boot/firmware/config.txt`, depending on the distro):
```
lang=ini, name=config.txt
dtoverlay=vc4-fkms-v3d
gpu_mem=256
```
Then use the following service file (changing the path used by `ExecStart` if you've [[ documentation/kodi/standalone/compile/ | compiled it yourself ]] and installed to a different path):
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (GBM)
After=systemd-user-sessions.service network.target network-online.target sound.target upower.service mysqld.service
Requires=graphical.target
Wants=network.target network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
WARNING: For some reason the environment line here causes Kodi from the Raspbian repos to fail, so comment it out if on Raspbian.
== Step 2 ==
```
lang=bash
# Add the group
sudo addgroup kodi
# Add the user, giving it no login shell and with /var/lib/kodi as its home directory
sudo useradd -c 'kodi user' -u 420 -g kodi -G audio,input,uucp,video -d /var/lib/kodi -s /usr/sbin/nologin kodi
# Not sure why this is necessary frankly, since the shell is set to nologin anyways
sudo passwd -l kodi > /dev/null
# Actually make the home directory we're using, and set ownership correctly
sudo mkdir /var/lib/kodi
sudo chown -R kodi:kodi /var/lib/kodi
# Now, enable and start the service
sudo systemctl enable kodi.service
sudo systemctl start kodi.service
```
== Further reading ==
If setting up on a Raspbian system, https://www.enricozini.org/blog/2019/himblick/cleanup-raspbian/ has some interesting notes on some of the customizations Raspbian has done compared to plain Debian.
The official wiki page for this sort of thing is at https://kodi.wiki/view/HOW-TO:HOW-TO:Autostart_Kodi_for_Linux, which points to https://github.com/graysky2/kodi-standalone-service. Here's some modified takes on the official-ish instructions. This presumes you're running Ubuntu 19.04 on a Pi 3, or have a similar setup to that.
NOTE: You could also just use something like LibreELEC if having a full OS on the machine isn't important to you.
== Step 1, Variant A: Kodi from the main repos, using X11 ==
Install Kodi and xinit with `apt install kodi xinit xserver-xorg`.
Create `/etc/systemd/system/kodi.service` with the contents as
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (X11)
After=systemd-user-sessions.service network-online.target sound.target mysqld.service
Requires=network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
== Step 1, Variant B: Kodi customized with hardware acceleration, using GBM ==
Either [[ documentation/kodi/standalone/compile/ | compile it yourself ]] or [[ https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=246837 | grab a package ]]. If you're using the latest Raspbian [[ https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=251645 | a new-enough and correctly compiled version should beis reportedly available in the main repos ]] (as of this writing untested by @keithzg).
Make sure to set the following in `config.txt` (may be either `/boot/config.txt` or `/boot/firmware/config.txt`, depending on the distro):
```
lang=ini, name=config.txt
dtoverlay=vc4-fkms-v3d
gpu_mem=256
```
Then use the following service file (changing the path used by `ExecStart` if you've [[ documentation/kodi/standalone/compile/ | compiled it yourself ]] and installed to a different path):
```
lang=ini, name=/etc/systemd/system/kodi.service
[Unit]
Description=Kodi standalone (GBM)
After=systemd-user-sessions.service network.target network-online.target sound.target upower.service mysqld.service
Requires=graphical.target
Wants=network.target network-online.target
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone
Restart=on-abort
StandardInput=tty
[Install]
WantedBy=graphical.target
```
WARNING: For some reason the environment line here causes Kodi from the Raspbian repos to fail, so comment it out if on Raspbian.
== Step 2 ==
```
lang=bash
# Add the group
sudo addgroup kodi
# Add the user, giving it no login shell and with /var/lib/kodi as its home directory
sudo useradd -c 'kodi user' -u 420 -g kodi -G audio,input,uucp,video -d /var/lib/kodi -s /usr/sbin/nologin kodi
# Not sure why this is necessary frankly, since the shell is set to nologin anyways
sudo passwd -l kodi > /dev/null
# Actually make the home directory we're using, and set ownership correctly
sudo mkdir /var/lib/kodi
sudo chown -R kodi:kodi /var/lib/kodi
# Now, enable and start the service
sudo systemctl enable kodi.service
sudo systemctl start kodi.service
```
== Further reading ==
If setting up on a Raspbian system, https://www.enricozini.org/blog/2019/himblick/cleanup-raspbian/ has some interesting notes on some of the customizations Raspbian has done compared to plain Debian.