When running sudo commands such as sudo dolphin I'm getting this strange error:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

What does it mean and how can I fix it?

I think I got this error since install and I did not change any standard paths or something alike: I'm still new to GNU/Linux.

I'm running Debian 9.1 with KDE.

Edit: you should never run Dolphin with sudo! This allows vulnerabilities in the file-explorer to be exploited. You shouldn't run most other GUIs as root either (these should only prompt you for your sudo password).

1 Answer 1


The XDG_RUNTIME_DIR is one of the standard directories, defined by the XDG Base Directory Specification (freedesktop.org)

$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.

Basically, that's a per-user temporary file directory, to use by the XDG (Freedesktop.Org) compatible apps.

In Debian, this variable is normally set by the pam_systemd PAM module, on an interactive login.


Path to a user-private user-writable directory that is bound to the user login time on the machine. It is automatically created the first time a user logs in and removed on the user's final logout. If a user logs in once, then logs out again, and logs in again, the directory contents will have been lost in between, but applications should not rely on this behavior and must be able to deal with stale files. ...

$XDG_RUNTIME_DIR is not set if the current user is not the original user of the session.

but it is not applied when you launch an application with sudo, which is why your application (dolphin) can not see it.

It will then correctly detect this:

 QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR"));
 if (xdgRuntimeDir.isEmpty()) {
     const QString userName = QFileSystemEngine::resolveUserName(myUid);
     xdgRuntimeDir = QDir::tempPath() + QLatin1String("/runtime-") + userName;
     qWarning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", qPrintable(xdgRuntimeDir));

choose a reasonable default value, and issue a Warning (not an Error) regarding it.

Note that reusing an existing XDG_RUNTIME_DIR would not be correct to do, as it is a per-user temporary directory and having an app, running as a different user, access it, would most probably result in a broken file permissions and could ruin your existing session.

So that is not something you should try to "fix".

Also note, that you should normally use gksudo or kdesudo, to run graphical apps, for the reasons explained here.

  • 2
    afaik gksudo is no longer there in Debian. I am guessing the same is the case with kdesudo ( at least in Debian 10 and above) .so guess people have to live with that warning.
    – shirish
    Jul 12, 2019 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .