If you want your Raspberry Pi to automatically start an AppImage application after boot (for example, a kiosk app, a media player, or your custom tool), you don’t need to hack around with rc.local
or autostart
files. The clean and reliable way is to use systemd user services.
In this guide, I’ll show you how to set it up step by step.
1. Create a systemd user service file
Systemd looks for user-level services in this folder:
bash
~/.config/systemd/user/
Let’s create a file named auto-start-app.service
inside it:
bash
nano ~/.config/systemd/user/auto-start-app.service
Paste this content (adjust the path to your AppImage file if needed):
ini
[Unit] Description=Run AppImage with audio in user session After=graphical-session.target [Service] ExecStart=/home/pi/auto-start-app.AppImage WorkingDirectory=/home/pi Restart=on-failure Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/pi/.Xauthority Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus [Install] WantedBy=default.target
This tells systemd to start your AppImage after the graphical session is ready, restart it on failure, and run it with the right environment for audio and graphics.
2. Enable “linger” for your user
Normally, systemd user services only run when you’re logged in. If you want your app to start even without logging in, you need to enable linger for your user (pi
by default):
bash
sudo loginctl enable-linger pi
3. Enable and start the service
Reload systemd to make sure it detects your new service:
bash
systemctl --user daemon-reload
Now enable and start it:
bash
systemctl --user enable auto-start-app.service systemctl --user start auto-start-app.service
That’s it! Your AppImage will now start automatically whenever your Raspberry Pi boots.
4. Troubleshooting
If your app doesn’t start, check the logs with:
bash
journalctl --user -u auto-start-app.service -f
This will show you error messages in real time.
5. Make it reusable (optional)
For your readers, you can create a template service file like this:
ini
[Unit] Description=Auto-start AppImage After=graphical-session.target [Service] ExecStart=/home/USERNAME/path/to/your-app.AppImage WorkingDirectory=/home/USERNAME Restart=on-failure Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/USERNAME/.Xauthority Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus [Install] WantedBy=default.target
Just replace USERNAME
and the AppImage path.
✅ Done! Now your Raspberry Pi can auto-start any AppImage with proper audio and display support using systemd. Clean, reliable, and no more hacks.