Not too long ago, when the USB key I’d built a set-top media machine died from overuse I decided to rebuild it using Arch Linux with Kodi as the media player. The trick, I keep finding every time, lies in getting Kodi to start up whenever the machine starts up. I think I’ve re-figured that out six or seven times by now, and each time after it works I forget all about it. So, I guess I’d better write it down for once so that I’ve got a snapshot of what I did in case I need to do it again later.
The instructions in the Arch Linux wiki work, but you need to pick the right ones to follow. The short-and-sweet ones with the automagickal AUR package don’t work. Forget it.
Install LightDM from the Arch package repository (sudo pacman -S lightdm). Then install the instructions I linked to above to the letter. That means carrying out the following tasks:
Create the file /etc/X11/Xwrapper.config. The file should contain only the following text in bold (no double quotes): “needs_root_rights = yes”
Follow the LightDM “Enabling autologin” and “Enabling interactive passwordless login” instructions. Create a user named “kodiuser” (you don’t need to set a password” and give it access to system groups necessary to access resouces in the system. I used the following command to do this: sudo useradd -c “Kodi Service Account” -G dbus,network,video,audio,optical,storage,users -m kodiuser
Create two additional groups which LightDM needs to enable autologin:
- sudo groupadd -r autologin
- sudo groupadd -r nopasswdlogin
Add kodiuser to those groups:
- sudo gpasswd -a kodiuser autologin
- sudo gpasswd -a kodiuser nopasswdlogin
Edit the file /etc/lightdm/lightdm.conf, find the following configuration directives, and set them to the values I specify. If you don’t find one or more of them, you’ll have to create it in the appropriate place:
Edit the file /etc/pam.d/lightdm and copy-and-paste the following directly under the “#%PAM-1.0” line at the very top (again, no double-quotes): “auth sufficient pam_succeed_if.so user ingroup nopasswdlogin”
Enable LightDM: sudo systemctl enable lightdm
Reboot: sudo shutdown -r now
Enjoy your Kodi media box. Just don’t forget to adjust the volume first!
I should probably write a shell script for that. Or put it in a Github repository, or something.