Linux: QStandardPaths: XDG_RUNTIME_DIR points to non-existing path



  • I am getting an error/warning

    QStandardPaths: XDG_RUNTIME_DIR points to non-existing path
    

    I would like some Linux expert to spare me a few minutes to explain what this is all about, please! (It will need a Linux bod.)

    My question might look scary, but it shouldn't be really. I just need an explanation of what's going on here.

    I had a working system without this problem in my old Ubuntu 17.04 installation. I have moved to a fresh Ubuntu 18.04, with a change in the way a component has been installed, and this has reared its head.

    I use Qt (5.9.5, as per apt-get for the distro). I use Python/PyQt. I use PyCharm for the IDE/debugger, and that is where the warning occurs. However I don't expect you to have to know about those details, and I would presume the issue/question would occur in principle if I were using C++/gdb. Please read on...

    PyCharm is not installable via apt-get (sigh). You have to do it manually. Previously I did it by un-tarring etc., and put the result into the system area. It worked, but there were issues about taking upgrades. This time, hoping to avoid update issues, I followed a post on the net advising to use Linux

    sudo snap install pycharm-community --classic
    

    When I launch my app from within PyCharm debugger I now get 2 occurrences of:

    QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.pycharm-community', please create it with 0700 permissions.
    

    /run/user/1000 does exist, but not the sub-directory. I created that appropriately yesterday, and the error went away. However, today it is back. I believe the sub-directory does not persist/gets removed across either login session or reboot? It is not convenient to have to re-create it all the time.

    My shell has environment variable

    XDG_RUNTIME_DIR=/run/user/1000
    

    and that works without complaint if I run my app from there. I can force the same error outside of PyCharm by running

    env XDG_RUNTIME_DIR=/run/user/1000/rubbish my-Qt-application
    

    So my questions, at least for my edification, are:

    • What exactly is this "XDG" stuff all about (because I'm interested)?

    • Why does QStandardPaths care about it?

    • It looks like PyCharm, as a result of my installing it via "snap" (which I know nothing about), is choosing to export the variable changed to require a snap.pycharm-community sub-directory, which does not exist. Is that a "normal" thing to do?

    • Is it right that creating the sub-directory seems to get deleted at that location?

    Before anyone answers "go ask PyCharm", I have previous experience that questions there simply don't get answered :( So although it may their issue, I'd appreciate any insights here from my kind expert-friends (e.g. I might be looking at you, friend @kshegunov) as to what is going on and how it affects Qt, please?

    Otherwise I'm wondering about uninstalling the whole of "snap PyCharm" and starting again down some manual route....


  • Lifetime Qt Champion

    Hi,

    1. Since you're on Ubuntu, this thread on askubuntu should bring some lights.

    2. Because it's a standard

    3. That's a question for the snap people

    4. Sorry, don't know, see number 3



  • @SGaist
    Thank you for answering. @Christian-Ehrlicher also helped me out on this.

    I now understand this variable names a per-user temporary directory. With a strange name of XDG_RUNTIME_DIR it did not occur to me that's what it might be! I also have not come across path /run/user/... before. It wasn't like that in Unix 25 years ago!

    Christian did show me what it is Qt uses the for --- some kind of "writeable location" call --- by I cannot locate it. Can you remind me what it is Qt uses this for?

    So the problem is: I start out with an XDG_RUNTIME_DIR set to /run/user/1000 and that does exist, all is well. But when I launch my app inside PyCharm it must be altering that variable to /run/user/1000/snap.pycharm-community, which does not exist. Presumably, either it should not do that, or it should be creating that directory first.

    I also now understand that since it is supposed to be a temporary directory, that's must be why /run/user/1000 gets cleared out across each login/reboot, so if I create it it later disappears.

    This did not happen prior to upgrade/new install. I think I might uninstall PyCharm and revert to my old, manual install process (not using snap), and hope this behaviour disappears....


  • Lifetime Qt Champion

    It is used by QStandardPaths to provide a writable location for different purpose that your application may need.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.