Autostart Kodi on Raspbian

This is the /etc/systemd/system/kodi.service unit file:

Description = Kodi Media Center

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

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

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

WantedBy =

To install, enable and run the service:

systemctl daemon-reload
systemctl enable kodi.service
systemctl start kodi.service

The kodi user was created witht the following commands:

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