Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. qtcreator and QT apps fail to launch in CentOS with root privilege

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

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
qtcreatorqxcbconnectionwayand
2 Posts 1 Posters 2.0k 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.
  • K Offline
    K Offline
    kevinguo
    wrote on last edited by
    #1

    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
    0
    • K kevinguo

      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 Offline
      K Offline
      kevinguo
      wrote on last edited by
      #2

      @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
      0

      • Login

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