Goals
- On startup, launch
/usr/bin/chromium-browser
in--kiosk
mode - Ensure that the Raspberry Pi never puts the display to sleep
- Relaunch the service if it was aborted
- Only launch the service once the GUI is ready
Installing
- Ensure that
$DISPLAY
is set even when connecting over SSHecho "export DISPLAY=:0.0 >> ~/.bashrc
- Create a new systemd service at
/lib/systemd/system/rctv.service
- Copy the file below
- Reload the
systemctl
daemon usingsudo systemctl daemon-reload
- Enable our
rctv.service
to be run on boot usingsudo systemctl enable rctv.service
- Reboot the Raspberry Pi using
sudo reboot
- Testing Locally Without Rebooting
sudo systemctl start rctv.service
sudo systemctl stop rctv.service
sudo systemctl restart rctv.service
journalctl -u rctv -b --no-pager
to show therctv.service
logs since the last boot-b
and now use a pager to view the output--no-pager
Debugging
- Use
systemd-analyze verify rctv.service
to see any issues with the service file - To see logs from systemd immediately after boot, view the file
sudo tail -f /var/log/boot.log
and search forrctv.service
- If
systemd-analyze
shows a cyclic dependency (e.g.multi-user.target
requiresgraphical.target
which requiresmulti-user.target
), this may be solved by removing symlinks torctv.service
in/etc/systemd/system/multi-user.target.wants
or/etc/systemd/system/graphical.target.wants
- Lots of googling
# rctv.service
[Unit]
Description=RC TV Startup
Wants=graphical.target
After=graphical.target
[Service]
Type=simple
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/rctv/.Xauthority
ExecStartPre=/home/rctv/rctv-kiosk/kiosk.sh
ExecStart=/usr/bin/chromium-browser --no-sandbox --noerrdialogs --disable-infobars --kiosk https://rctv.recurse.com
Restart=on-abort
User=rctv
Group=rctv
[Install]
WantedBy=graphical.target