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
#myappBoth 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 0The 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 -
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
#myappBoth 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 0The 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@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
#myappBoth 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 0The 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.
KevinI found the solution already. Just run this:
xhost +SI:localuser:rootThanks
Kevin