5

On Ubuntu 18.04 I've changed my shell to fish via

chsh -s `which fish`

I've installed Maillspring and Visual Studio Code snap apps, they installed fine and could be launched from the dash initially, but after logging in and logging back out none of them showed up in the dash anymore.

Searching for them in software store shows that are installed and I can launch them from there.

Why will the default shell matter for this?

Calin
  • 705

5 Answers5

3

The command you had originally in your question chsh -s which bash was as you say a typo which caused a great deal of confusion around your question. Even if it had been properly formed with the ` symbols around which bash as shown below.

enter image description here it would change the shell to bash (the default). To change the shell to fish use

enter image description here or simply use the command chsh and enter the path to the shell you want to use. See below:

me@zippy-64bit:~$ chsh
Password: 
Changing the login shell for me
Enter the new value, or press ENTER for the default
    Login Shell [/bin/bash]: 

For more information on the fish shell see this.

EDIT: Regarding snap packages: Will the default shell matter? the answer is possibly, as it depends on the assumptions made by and the approach taken by the programmer. Refer to the differences in how bash and how fish handle things in the previous link. For example fish has no implicit subshell which can cause surprising side effects in variable assignment for the programmer that is expecting behavior similar to bash. There's a good example of an expectation of an implicit subshell in the question here.

Why? In an attempt to clarify it appears that the concept of inheritance is handled differently between fish and other more common shells like bash. My understanding is that this can result in unexpected behavior from pipes, loops, and functions (All of which are commonly used programming strategies).

The programmer may also be relying on shell builtins which either may not exist in fish or may be implemented in an unexpected fashion.

Sources:

Elder Geek
  • 36,752
1

It seems that Ubuntu calls snap apps using the default shell, and it seems to assume that the shell is bash (or compatible with bash, like zsh).

I had the same problem (on Ubuntu 18.10): after chsh -s `which fish` , Gnome Shell was not finding snap apps anymore, even after adding /snap/bin to the $PATH.

I solved it by letting the default shell to Bash, and instead changing the invoked by my terminal application (since I mostly use my shell through my terminal emulator anyway):

  • open terminal
  • go to Preferences, click on your profile then command tab, tick "run a custom command instead of my shell" then in custom command put fish.
  • do this for every profile

enter image description here

After that, starting Gnome-Terminal (either from Gnome Shell or with Ctrl+Alt+T) will launch the Fish shell, but the system shell will still be Bash so nothing breaks.

However this means that other applications spawning a user-facing shell (Visual Studio Code for instance) may require customization as well to use Fish instead of Bash.

0

There is a TL;DR at the bottom.

For gnome-shell to be able to start Snaps it needs two things (values in brackets are on my Fedora 29 desktop which has the same problem):

  • PATH to include Snap (/var/lib/snapd/snap/bin)
  • XDG_DATA_DIRS to the Snap Desktop files (/var/lib/snapd/desktop)

These variables are configured in /etc/profile.d/snapd.sh via /etc/profile conventional bash start-up.

When you switch to fish to whole /etc/profile start-up is skipped.

Since most distros assume the usage of bash and install configuration scripts into /etc/profile.d, simply chsh -s /bin/fish will not use them. Snaps not being found by gnome-shell is one such symptom.

The best solution I have so far is to use fish only an interactive shell and leave bash in place to do the other housekeeping.

TL;DR

Leave the user default shell as bash:

chsh -s /bin/bash

Within ~/.bashrc have the following:

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

if [ -z "$BASH_EXECUTION_STRING" ]; then exec /bin/fish fi

For the bash --login case (as invoked via X11/Wayland) remove ~/.profile and add .bash_profile (make it bash specific):

# we want to run fish most of the time, but this is invoked by bash --login
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

0

add this to your ~/.config/fish/config.fish file

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

install bass using fisher:

fisher add edc/bass

or install bass using omf:

omf install bass

reload your session, and all should be working now :)

-1

The snaps that you have installed, can be found in /snap/bin/ You need to have that directory in your $PATH.

Ubuntu automatically adds /snap/bin to your $PATH. It happens in /etc/profile.d/apps-bin-path.sh which runs when you get a login shell.

I checked, and fish also adds /snap/bin into $PATH so normally it should be fine.

Can you show us the output of the command

echo $PATH

If the output has /snap/bin, then congratulations you have found a bug in Ubuntu and you can file a report on Launchpad for it.

addition: Ubuntu internally probably uses $SHELL for some of the scripting. The fish shell is not 100% compatible with bash and it looks like this is the cause of the problem. It is a common issue when you change your login shell to something other than bash. See, for example, this report https://youtrack.jetbrains.com/issue/CPP-2919 with users changing their shell to /bin/tcsh.

You need to file a bug report to Ubuntu so that someone investigates and fixes the internal scripting to work with fish. If you really love fish, that's what you need to do. ;-)

Simos
  • 904