Snap does not respect directory settings

I have a modified ~/.config/user-dirs.dirs to look as such:

XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME/documents/templates"
XDG_PUBLICSHARE_DIR="$HOME/documents/public"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_MUSIC_DIR="$HOME/documents/music"
XDG_PICTURES_DIR="$HOME/documents/pictures"
XDG_VIDEOS_DIR="$HOME/documents/videos"

I’ve done so because no file or directory on my system has capital letters in it, so I don’t see why files in my $HOME should either.

However, whenever running snap packages (I’ve tested with Spotify today) these settings aren’t respected, and thus create the default directories. This makes my $HOME look very cluttered:

This prevents me from happily using snap packages.

2 Likes

For clarification, my home directory is usually quite tidy:

Thanks for reporting this. I suspect this may be down to the desktop helpers. I wonder if other snaps exhibit the same issue? Can you maybe try the scummvm snap which doesn’t use the desktop launchers. If it still happens, then it’s more likely snapd then the desktop helpers.

This same error happens with localized home directory names. I’m using Ubuntu 17.10 with slovak localization and every time I try a “snap install” it will generate new english language directories in my home. It’s extremely annoying! (Did happen e.g. with Spotify, Brave…)

It doesn’t happen with scummvm.

Interestingly enough that does create the lowercase snap directory. Consistency! :smiley:

Have tried it with scummvm and no new directories appeared. What’s next?

A bug against the desktop helpers I think is the next step.

Done here.

If this is happening immediately upon issuing a snap install then the issue isn’t with the desktop helpers, as they will not run until the command within the snap itself is executed, which doesn’t happen on the install step.

Tested it and I can correct my previous post: it does indeed happen after launching the app. The install process in itself doesn’t do anything to the home directory…

I’m not sure of the exact cause, but there are likely a few things going on here:

  1. strict confined snaps have $HOME set to ~/snap/<pkgname>/<rev>, so would not generally find the host system ~/.config/user-dirs.dirs file by default:

    james@scruffy:~$ echo ~/.config/user-dirs.dirs
    /home/james/.config/user-dirs.dirs
    james@scruffy:~$ snap run --shell iagno
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.
    
    james@scruffy:/home/james$ echo ~/.config/user-dirs.dirs
    /home/james/snap/iagno/14/.config/user-dirs.dirs
    
  2. snapcraft-desktop-helpers does run xdg-user-dirs-update to generate a user-dirs.dirs file for the confined application. But the paths in that file are all $HOME relative, so shouldn’t alter anything in the user’s home directory:

    james@scruffy:~$ snap run --shell iagno
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.
    
    james@scruffy:/home/james$ /snap/iagno/current/gnome-platform/usr/bin/xdg-user-dir DOCUMENTS
    /home/james/snap/iagno/14/Documents
    

So I wonder if the application in question is resetting $HOME itself? It would still see its own user-dirs.dirs file because snapcraft-desktop-helpers sets $XDG_CONFIG_HOME, but would treat those paths as relative to the real home directory.

Another piece of information:

When I launch VLC now (after removing the english-named directories), I get the following lines in Journal:

jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Desktop was removed, reassigning DESKTOP to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Downloads was removed, reassigning DOWNLOAD to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Templates was removed, reassigning TEMPLATES to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Public was removed, reassigning PUBLICSHARE to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Documents was removed, reassigning DOCUMENTS to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Music was removed, reassigning MUSIC to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Pictures was removed, reassigning PICTURES to homedir
jan 16 19:47:50 mobileaeris vlc_vlc.desktop[26340]: /home/michalmaria/Videos was removed, reassigning VIDEOS to homedir

Hi! Are there any news about this issue? It’s very annoying for those not using English localization, is there something that can be done to help fixing this (for example system logs etc.)?

Cheers

Hi, yes I suffer the same, I really don’t know if it will fix it soon

Yes… i really hope that it will be fixed before Ubuntu 18.04 release, i think that problems like this are a big hindrance to snap adoption, it makes a good software look unpolished and unfinished.

There is also a bug report on Launchpad https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1746710, maybe clicking the “Yes, it affects me” link will make the bug more visible to the developers.

Thanks for that! :slight_smile:

Almost 6 months later it’s still happening. In my case on Ubuntu MATE 18.04, steps:

  • sudo snap install libreoffice

  • open one of the LibreOffice applications

  • check /home folder and see the new folders created

  • ls command shows this:

    Área de Trabalho Documentos Downloads Modelos Música Public snap Videos
    Desktop Documents Imagens Music Pictures Público Templates Vídeos

Multiple reports:

1 Like

User friendly != annoy the user

And if you remove the snap (sudo snap remove libreoffice), the folders are not removed.

So… several months, multiple reports, there’s probably thousands of people right now with duplicated folders thinking that snaps are garbage.

Please, I ask for more attention on fixing this issue, thank you.

1 Like

now install the new version of libreoffice as snap and update snapd and continue with the same error of the home folder, that shame, that incredible of Canonical (again)