I'm trying to run a python GUI application as a service. The application is using PyQt5 and python-vlc packages. I have the following service file:
[Unit] Description="Python VLC Service Test" After=multi-user.target [Service] Type=simple User=pi Environment="DISPLAY=:0" Environment="XAUTHORITY=/home/pi/.Xauthority" ExecStart=/usr/bin/python3 /opt/experimental/vlc_pyqt.py Restart=on-failure [Install] WantedBy=graphical.target
However, when playing video in the vlc window, only white screen shows up. After looking in
journalctl I found these two errors:
Aug 18 16:26:27 raspberrypi python3: [83ab02c8] dbus_screensaver inhibit error: cannot connect to session bus: Failed to connect to socket /tmp/dbus-ZeiFpFnTZO: Connection refused Aug 18 16:26:33 raspberrypi python3: [84f28b10] mmal_codec filter error: Failed to alloc CMA buf: fmt=Z420, size=3133440
I think the CMA buffer error is a result of the first one. Any ideas how to fix it? The application is running just fine when run directly (not as a service).
I would like to run it as a service in order to be able to monitor the status of the application via
systemctl status vlc_pyqt.service as the application should run all the time on the machine and to be able to gracefully restart it by
systemctl restart vlc_pyqt.service if needed.