Autostart - RoninRage/RoninsPiKivyDashboard GitHub Wiki
🔁 Autostart RoninsPiKivyDashboard on Boot
This guide shows how to configure your Raspberry Pi Zero 2 W (running Raspberry Pi OS Lite) to automatically start the Kivy dashboard after booting.
🧱 Assumptions
- You already installed and tested
RoninsPiKivyDashboard
manually - It runs successfully with
python main.py
- You are using a virtual environment
.venv
.bash_profile
(simplest for testing)
⚙️ Option 1: Autostart using Edit the file:
nano ~/.bash_profile
Add the following:
cd ~/RoninsPiKivyDashboard
source .venv/bin/activate
python main.py
✅ This runs the dashboard whenever the user logs in via terminal.
🪟 Option 2: Autostart with a systemd service (recommended)
- Create a new systemd service file:
sudo nano /etc/systemd/system/roninspikivy.service
- Paste the following content:
[Unit]
Description=RoninsPiKivyDashboard
After=network.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/RoninsPiKivyDashboard
ExecStart=/home/pi/RoninsPiKivyDashboard/.venv/bin/python /home/pi/RoninsPiKivyDashboard/main.py
Restart=always
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl daemon-reexec
sudo systemctl enable roninspikivy.service
sudo systemctl start roninspikivy.service
- To check status or logs:
systemctl status roninspikivy.service
journalctl -u roninspikivy.service -b
🛑 Disable or remove the service
sudo systemctl stop roninspikivy.service
sudo systemctl disable roninspikivy.service
sudo rm /etc/systemd/system/roninspikivy.service
🧠 This method runs your dashboard in the background and survives reboots.