If I take a clean install of Ubuntu 17.10, install a package via snap, and change my shell to fish, after logging in again the package is missing from gnome-shell's menu and from my favorites list.

Weirdly, this also only happens when using Wayland.

What could cause this issue? I can confirm my shell works normally and the path is normal. I can also confirm these applications run fine via snap run or their command line versions, but it's as if the *.desktop files are missing.


Create ~/.config/fish/config.fish if it doesn't exist, and add the following two lines

set PATH /var/lib/snapd/snap/bin $PATH
set XDG_DATA_DIRS /var/lib/snapd/desktop/:$XDG_DATA_DIRS

This will put snap applications on your path and make your shortcut icons available.


The problem: The issue is linked to your login shell.

The variable XDG_DATA_DIRS is set when /etc/profile.d is sourced (/etc/profile.d/apps-bin-path.sh)

But if you use fish-shell, as is your case, or zsh, you are not sourcing /etc/profile.d/ and therefore XDG_DATA_DIRS is never set and the .desktop files in /var/lib/snapd/desktop won't be found. That's not a bug but it's due to fish not being POSIX 1003.1 compatible. That meaning that these shells doesn't understand the bash syntax.

The workaround:

I can think of at least two workarounds.

  1. The simple one is to reverse the default shell to bash with

    chsh -s /bin/bash

    And then add the line


    At the end of the ~/.bashrc. By doing this your login shell would be bash and your /etc/profile.d would be sourced, but you would be using fish every time you open your terminal. And writing 'exit' on your terminal would jump back to bash.

  2. A trickiest one is to keep fish as your login shell but force the /etc/profile.d to be sourced. To do this you need to follow these steps:

    1. from you fish shell install fisher and bass (make Bash utilities usable in Fish shell).

      curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher 
      # instruct fisher to download the bass package   
      fisher add edc/bass 
    2. edit your ~/.config/fish/config.fish (create It if it doesn't exist) and source every file under /etc/profile.d using bass.

      nano ~/.config/fish/config.fish

      (In another terminal ls the /etc/profile.d directory to get the list of files. Copy them)

      Paste the list in your nano terminal like this:

      bass source /etc/profile.d/apps-bin-path.sh 
      bass source /etc/profile.d/cedilla-portuguese.sh 
      bass source /etc/profile.d/vte-2.91.sh 
      bass source /etc/profile.d/bash_completion.sh 
      bass source /etc/profile.d/input-method-config.sh 
      bass source /etc/profile.d/xdg_dirs_desktop_session.sh 

      Save, close, close session or restart and 'ta-da'.

    With this option you keep fish as your login shell but you have to check the /etc/profile.d directory every now and then to make sure there isn't a new file your not sourcing.


In addition to what is suggested in Esteban Vergara's answer, I added these lines to my ~/.config/fish/config.fish file:

for file in /etc/profile.d/*.sh
        bass source $file

This will prevent the issue of having to check your profile.d folder regularly as he suggested, as it will recursively load all sh files in that folder on session start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.