4

I just upgraded to Ubuntu 18.10 from Ubuntu 17.10.

I have my box configured to use bash as the default shell rather than the default dash. I've made this change with sudo update-alternatives --config sh which reports:

  Selection    Path            Priority   Status
------------------------------------------------------------
  0            /bin/dash        200       auto mode
* 1            /bin/bash        100       manual mode
  2            /bin/dash        200       manual mode

However, /bin/sh still points to dash rather than pointing to bash.

Actually, on previous versions of Ubuntu, I believe that used to point /bin/sh -> /etc/alternatives/sh.

It looks like the latest Ubuntu no longer allows the alternatives mechanism for sh or at least broke the alternatives during the upgrade. I see from How Can I Make /bin/sh point to /bin/bash? that it is now recommended to reconfigure dash instead.

Why doesn't alternatives work anymore? Where is this change documented? I've been using alternatives with sh for at least three years in Ubuntu and I've never had it broken during an upgrade before. There are many guides that suggest that such as: https://jwaghetti.blogspot.com/2015/09/changing-dash-to-bash.html

8
  • I don't think /bin/sh has ever been managed through alternatives. On LTS versions 14.04 through 18.04, running sudo update-alternatives --config sh outputs update-alternatives: error: no alternatives for sh.
    – wjandrea
    Nov 7, 2018 at 21:23
  • @wjandrea It was certainly managed by alternatives. I've always had alternatives for sh available, probably because I've also installed bash. See jwaghetti.blogspot.com/2015/09/changing-dash-to-bash.html Nov 7, 2018 at 22:25
  • 1
    That blog is incorrect, you shouldn't use alternatives unless the packages installing the symlinks and binaries are doing that as well. It's probably for that reason that your system is now inconsistent with respect to that symlink.
    – filbranden
    Nov 8, 2018 at 5:56
  • 1
    It might be interesting and/or helpful to explain in what contexts / for what purpose you want Bash to be used rather than Dash. Voting to leave the question open as is though. Definitely well worth having a unique answer here
    – Zanna
    Nov 8, 2018 at 15:17
  • 2
    Possible duplicate of How Can I Make /bin/sh point to /bin/bash? Nov 9, 2018 at 19:20

1 Answer 1

4

The update-alternatives system could have been used to manage /bin/sh, but it would have had to be implemented that way in the Debian packages for bash and dash.

The packagers decided against it, instead using the current scheme involving dpkg-configure to manage /bin/sh. See this excellent answer for details and rationale of that choice.

The article you linked to is recommending using update-alternatives on /bin/sh, setting that up manually. That is terrible advice. Because, in effect, you'll have two separate systems trying to manage the same symlink in different ways, and probably stepping on each other's toes. (Which is probably what caused your issue during an Ubuntu upgrade.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .