[2022] system tray icon missing when running as root
-
Re: system tray icon missing when running as root
Hi All,
I have an application which needs to be run as root on linux and i am still facing this issue. Is there any fix identified ?
PS : Its the issue only with SystemTray icon , and other GUI components are working fine. I am getting following warning as well in the console
QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000 QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
I am using Qt 6.3.
thanks,
-Nagendra N.R. -
Re: system tray icon missing when running as root
Hi All,
I have an application which needs to be run as root on linux and i am still facing this issue. Is there any fix identified ?
PS : Its the issue only with SystemTray icon , and other GUI components are working fine. I am getting following warning as well in the console
QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000 QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
I am using Qt 6.3.
thanks,
-Nagendra N.R.@Nagendra-NR
You are UID 1000. Root is UID 0. The error comes from https://code.woboq.org/qt6/qtbase/src/corelib/io/qstandardpaths_unix.cpp.html#186. It is complaining that your "XdgRuntimeDir" is owned by you, but running a UI program as root means it tries to access/write to it as root, which it does not allow.In order to get past this, if you run a UI program as root while logged into the windowing system as you/a non-root user you will need to: look at your environment variables. You will see
XDG_RUNTIME_DIR=/run/user/1000
. You need to change that toXDG_RUNTIME_DIR=/run/user/0
to run your program. That should get you past that error message. Whether it will work elsewhere/for other checks I cannot say.As I commented in the thread you reference: why do you need to run a UI program as root? It is a bad idea, and you may face other problems.
-
@JonB said in [2022] system tray icon missing when running as root:
Thanks @JonB for the reply. I was running "sudo -E ./my_application " as a normal user to start the application. That warning is not coming when i directly run as root. But the original issue still remains, which is, SystemTray not getting displayed when run as root where other GUI components are fine.
-
@JonB said in [2022] system tray icon missing when running as root:
Thanks @JonB for the reply. I was running "sudo -E ./my_application " as a normal user to start the application. That warning is not coming when i directly run as root. But the original issue still remains, which is, SystemTray not getting displayed when run as root where other GUI components are fine.
@Nagendra-NR said in [2022] system tray icon missing when running as root:
I was running "sudo -E ./my_application " as a normal user to start the application. That warning is not coming when i directly run as root
That would make sense then. If you want to do
-E
you would need to change that environment variable, or don't use-E
.SystemTray not getting displayed when run as root where other GUI components are fine.
So maybe the system tray cannot "mix" existing icons for desktop user with new icons for a different user (root) who is not the desktop user. No idea.
As I commented in the thread you reference: why do you need to run a UI program as root? It is a bad idea, and you may face other problems.
You did not respond to this. X-org etc. do not like root running UIs, or not when the desktop is under another user. Nearly every time we have asked this question it transpires that running the Qt UI application as root is not a good idea and there is an alternative.