Score:1

Default position of Documents, Music and Pictures under Firefox in Ubuntu WSL

yt flag

I installed Windows Subsystem for Linux (WSL) and through it, Ubuntu:

wsl --install Ubuntu

sudo apt-get update && sudo apt-get upgrade -y

There is one automatic configurations of the files for documents and images that strikes me as odd, and different from what I think I recall seeing on a Linux machine.

The issue is that instead of being in the main user directory they are under ~/snap/firefox/common as in here:

enter image description here

Is this the expected placement of these folders? If it isn't how can I correct it?

user535733 avatar
cn flag
Unable to reproduce in a test environment. A stock install of Firefox on Ubuntu Desktop 23.04 (non-WSL) does not have `~/snap/firefox/common`
Marco avatar
br flag
Maybe ask Microsoft Support?
NotTheDr01ds avatar
vn flag
@Marco This is *likely* much more an Ubuntu question than it is about WSL. The Ubuntu distribution for WSL is based off Ubuntu Server, which doesn't create these directories by default (to my knowledge) even when not running under WSL.
NotTheDr01ds avatar
vn flag
Antoni - I'm assuming that you've installed WSL/Ubuntu, enabled Systemd, and installed Firefox using Snap. Is there anything else you can think about that you might have configured? I'm working on trying this out myself to see if I can find a way to reproduce, but any additional details might be helpful - Thanks!
Antoni Parellada avatar
yt flag
@NotTheDr01ds My apologies for not being fluent in some of these aspects. I did install Firefox with `sudo apt install firefox`. The rest of the packages either came with Ubuntu, or got downloaded and compiled with `sudo apt-get update && sudo apt-get upgrade -y`. At this point I have just moved the Documents, Movies, Pictures and such from under Firefox to the home directory, and nothing was disrupted.
Score:1
vn flag

I can reproduce this behavior on WSL, and yes, it's "expected" to some degree. As I mentioned in the comments, this is probably the same behavior we'd see in Ubuntu Server, where there's no desktop environment by default.

The XDG directories such as Downloads, Documents, Music, etc. are typically created by the Desktop Manager (or perhaps, more technically, the Session Manager) during the user's initial login to that desktop. As far as I can tell, this is done by running xdg-user-dirs-update during the session setup.

Since in WSL, we're running Firefox in a GUI without a desktop environment, that step never gets done. This would be similar, under Ubuntu Server, to running Firefox through XRDP or even X forwarding to another system.

While I understand from the comments that you've already solved the issue by simply moving the directories, for future readers, you should probably do a one-time run of:

xdg-user-dirs-update

... before running Firefox or other apps which adhere to the XDG standard for the first time.

Because Firefox isn't finding the directories in the expected location, it seems to have created them in its "user" directory as a Snap.

If you delete those directories, run xdg-user-dirs-update, and run Firefox again, it will not recreate the directories under ~/snap/firefox/common. That directory itself will exist, but it will be empty, and the "normal" locations for Documents, etc. will be used.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.