Electron-based snaps fail if symlinks in $HOME

On Ubuntu 20.04, I noticed that electron-based snaps fail, without any error message, if certain default directories in $HOME are replaced with symlinks to other locations. To me this seems rather unexpected and unnecessary, especially as it isn’t obvious at all that these snaps depend on the default directories in $HOME.

As a particular example, I refer to https://forum.snapcraft.io/t/todoist-snap-silently-fails-to-start/20015?u=asparc. Here, I replaced $HOME/Downloads with /mnt/data/Downloads. All of a sudden, none of my electron-based snaps would work anymore (e.g. todoist, electronplayer).

Is there a way to allow users to make symlinks to the default directories in $HOME, without breaking electron-based snaps?

You can probably solve this with bind mounts, The reason is that the snap is confined, perhaps some GUI love could be placed on failing to launch applications, but this goes beyond the realm of snaps and more related to desktop workspace.

1 Like

well, the app should not refuse to start quietly, IIRC older versions of the desktop launchers created links from the XDG dirs (~/Downloads, ~/Music, ~/Video, etc) into the application home dir (not sure the recent versions or the launchers from the various extensions used nowadays still do that) …

perhaps the code gets confused if the target of such a link is a symlink itself … (just guessing here)

it would be interesting to know if the failing apps all use the same desktop launcher code…

see also Electron Apps and user-dirs.dirs

It is the same logic when using the extension.

Hi, PR submitted: https://github.com/develar/snap-armhf-electron-template/pull/1