Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved qtcreator and QT apps fail to launch in CentOS with root privilege

    Installation and Deployment
    qtcreator qxcbconnection wayand
    1
    2
    1087
    Loading More Posts
    • 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.
    • K
      kevinguo last edited by

      Hi:

      I am using CentOS 8.1. For some reason, I must run my app with root permission. I tried
      #sudo myapp
      or
      #sudo su
      #myapp

      Both failed with following output:
      QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
      No protocol specified
      qt.qpa.screen: QXcbConnection: Could not connect to display :1
      Could not connect to any X display.

      Then I tried launching qtcreator, but failed with the same error.

      Please note that I am able to launch QT apps in Ubuntu 18.04 with root permission in the same way. Ubuntu outputs the following warning but continues to run the app:
      QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0

      The failing platform is CentOS 8.1. The XWindows is wayland.

      Now, the workaround is to log in GUI with root user name. But I still prefer logging in as normal user then run app in sudo mode.

      I appreciate if anyone gives some advice.
      Kevin

      K 1 Reply Last reply Reply Quote 0
      • K
        kevinguo @kevinguo last edited by

        @kevinguo said in qtcreator and QT apps fail to launch in CentOS with root privilege:

        Hi:

        I am using CentOS 8.1. For some reason, I must run my app with root permission. I tried
        #sudo myapp
        or
        #sudo su
        #myapp

        Both failed with following output:
        QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
        No protocol specified
        qt.qpa.screen: QXcbConnection: Could not connect to display :1
        Could not connect to any X display.

        Then I tried launching qtcreator, but failed with the same error.

        Please note that I am able to launch QT apps in Ubuntu 18.04 with root permission in the same way. Ubuntu outputs the following warning but continues to run the app:
        QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0

        The failing platform is CentOS 8.1. The XWindows is wayland.

        Now, the workaround is to log in GUI with root user name. But I still prefer logging in as normal user then run app in sudo mode.

        I appreciate if anyone gives some advice.
        Kevin

        I found the solution already. Just run this:
        xhost +SI:localuser:root

        Thanks
        Kevin

        1 Reply Last reply Reply Quote 0
        • First post
          Last post