No protocol specified

  • Hi.all
    I will ask you a question again.

    An application created with Qt WidgetApplication can be executed with user privileges, but an error will occur if executed as root.

    No protocol specified
    qt.qpa.screen: QXcbConnection: Could not connect to display: 0
    Could not connect to any X display

    This state becomes a problem when starting an application from rc.local.

    Is there a solution?

  • Lifetime Qt Champion

    Hi @taku-s,

    Does your program needs to be run as root? (which would be a very bad idea).

    Otherwise start it with su -c yourprog <user>.


  • @taku-s
    I may not know what I am talking about here. So take with a pinch of salt. But (a) I thought there are sometimes problems with running X Windows programs as root instead of logged in user, and (b) if you start an app from rc.local what is it doing looking for an X display anything, you cannot access/assume any X connection anything from there, it's not supposed to be for programs requiring UI interaction?

  • Thank you, everyone.
    As you said, it may not be a Qt issue.
    The Debian 10 I use seems to have changed from Xorg to Wayland, so this is the problem?
    I will try the startup method from the user.

Log in to reply