Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt from crontab errors

Qt from crontab errors

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 531 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    barashken
    wrote on last edited by barashken
    #1

    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.

    JonBJ 1 Reply Last reply
    0
    • B barashken

      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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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 a QCoreApplication and that should not require a desktop.

      B 1 Reply Last reply
      1
      • JonBJ JonB

        @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 a QCoreApplication and that should not require a desktop.

        B Offline
        B Offline
        barashken
        wrote on last edited by
        #3

        @JonB
        I need UI in my app.
        It’s happening also when I run the script from terminal

        JonBJ 1 Reply Last reply
        0
        • B barashken

          @JonB
          I need UI in my app.
          It’s happening also when I run the script from terminal

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @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 for Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved