Notes on installing HKCam on a raspberry-pi with systemd

Reading time: about 1 minute

Installing HKCam on a raspberry pi with systemd

The documentation for manually installing HKCam on a Raspberry PI are frustratingly obscured in an Ansible playbook. This is what I did to get it up and running manually.

My System Info:

$ cat /etc/debian_version
$ cat /etc/issue
Raspbian GNU/Linux 9 \n \l

Install Process:

# Installing `raspberrypi-kernel-headers` prevents the
#   "kernel headers for this kernel does not seem to be installed."
# message from appearing when installing v4l2loopback with apt-get:
#   Module build for kernel 4.14.98-v7+ was skipped since the
#   kernel headers for this kernel does not seem to be installed.
# Also sometimes this error is shown when attempting to attach with `modprobe v4l2loopback`
# modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/4.14.98-v7+

apt install raspberrypi-kernel-headers
apt install v4l2loopback
apt install ffmpeg

echo 'options v4l2loopback video_nr=1' | sudo tee -a /etc/modprobe.d/v4l2loopback.conf
sudo modprobe v4l2loopback
echo v4l2loopback | sudo tee -a /etc/modules

sudo modprobe bcm2835-v4l2
echo bcm2835-v4l2 | sudo tee -a /etc/modules

# visit and download a tar.gz
tar xzf hkcam-v0.0.8_linux_armhf.tar.gz
cd hkcam-v0.0.8_linux_armhf/
sudo cp usr/bin/hkcam /usr/local/bin

sudo adduser --system --ingroup video hkcam

Systemd Service Configuration:


Description=HKcam HomeKit Camera



Activate the service:

sudo systemctl daemon-reload
sudo systemctl start hkcam
sudo systemctl enable hkcam

Date: 2019-Jun-09
Tags: bash systemd raspberry-pi
Previous: bash hr function
Next: Notes on setting up a raspberry-pi from a bare image