Home > database >  Raspberry Pi Qt app won't run on boot: qt.qpa.plugin could not load the qt platform plugin xcb
Raspberry Pi Qt app won't run on boot: qt.qpa.plugin could not load the qt platform plugin xcb

Time:08-04

My program does work on its own when run with terminal or by double clicking on it.

However I am trying to run this program when the pi boots and I receive this error:

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application mayh fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

I am using this systemd service to run on startup:

[Unit]
Description=TOLED display test
After=graphical.target
After=multi-user.target
[Service]
Type=idle
User=pi
ExecStart=/home/pi/DisplayTest
[Install]
WantedBy=multi-user.target

Any advice on how I can get this to run on startup?

CodePudding user response:

You can always run QT_DEBUG_PLUGINS=1 to get more information.

The issue here is that the GUI is still not running yet properly. You will need to defer the running of your application until the GUI is up running and functioning properly.

CodePudding user response:

What I ended up doing was disabling the X server at boot (can't remember how exactly) so you just login to the terminal interface, then in my systemd service I changed the execution line from

ExecStart=/home/pi/DisplayTest

to

ExecStart=startx /home/pi/DisplayTest

This tells X server (graphical window program) to make my program the only graphical window shown on startup.

  • Related