Qt from crontab errors
-
Hello
I’m use Ubuntu 18.04 and try to run a script from crontab when rebooting that run my python app that used pyqt5.
When I do that the app is not up, and I got this errors:Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0 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 may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb. ./test.sh: line 5: 2218 Aborted (core dumped) python3 myenv/app.py
I would appreciate your help, thanks.
-
Hello
I’m use Ubuntu 18.04 and try to run a script from crontab when rebooting that run my python app that used pyqt5.
When I do that the app is not up, and I got this errors:Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0 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 may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb. ./test.sh: line 5: 2218 Aborted (core dumped) python3 myenv/app.py
I would appreciate your help, thanks.
@barashken
Your script apparently wants xcb, i.e. a UI interface. This does not make sense from a crontab job, as they are non-interactive/do not have a desktop. If your application is non-UI it should only create aQCoreApplication
and that should not require a desktop. -
@barashken
Your script apparently wants xcb, i.e. a UI interface. This does not make sense from a crontab job, as they are non-interactive/do not have a desktop. If your application is non-UI it should only create aQCoreApplication
and that should not require a desktop. -
@barashken said in Qt from crontab errors:
I need UI in my app.
Then how does this work "when rebooting" and from crontab?
It’s happening also when I run the script from terminal
Then why does your title say "from crontab"? What error does it give when run from terminal inside a desktop? Even though it says "xcb is available" so long as you get message
keyqt.qpa.xcb: could not connect to display :0
you do not have a correct display server. You can also Google forInvalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb
. -
I am going to guess that you are trying to create some sort of kiosk machine that automatically launches a UI at system start. If that is what you are after then you should consider:
- Enable Autologin
- Use a custom
.xsession
file to launch your application when X starts.
Other ways to address this involve using
/etc/inittab
(not crontab) to launch a script that starts X and then your kiosk application. This approach can ensure the UI is restarted if it crashes. How this interacts with a systemd-ified environment I cannot say.