Log in

No account? Create an account
fragglet [userpic]

/bin/sh broken in Ubuntu Edgy

November 28th, 2006 (10:08 pm)

One of the great new features in Ubuntu's latest "Edgy Eft" release is that they've completely broken /bin/sh. The reason for this is that the bourne shell implementation has been switched over to dash. As a result, lots and lots of shell scripts that rely on bash features no longer work. One example is that the installer for Borland Starteam doesn't work.

The solution for this is:

sudo apt-get remove dash

This does not break your system; you will be switched over to bash automatically.

Please encourage the Ubuntu developers to fix this broken behaviour by adding a comment to Bug 61463.

(Disclaimer: Yes, shell scripts that rely on bash features shouldn't use #!/bin/sh. I don't care. Scripts that run on every other Linux system don't work on Ubuntu Edgy, therefore it is broken.)


(Deleted comment)
Posted by: fragglet (fragglet)
Posted at: November 29th, 2006 09:14 am (UTC)
Re: simple fix

In most cases, yes. However, there may also be places where scripts are run indirectly (eg. invoked from another script), and this won't be possible. Best thing to do is just remove dash and fix it everywhere.

(Deleted comment)
Posted by: LionsPhil (lionsphil)
Posted at: November 29th, 2006 12:04 am (UTC)

Methinks you're ignoring the “Just Work™”-ness Ubuntu appears to generally aim for. This breaks a variety of amusing things in amusing ways that would seriously confuse a user who didn't even know, or want to know, what a shell was; possibly when they're just dumbly typing in commands from a wiki or forum somewhere to try to get some other part of the system to do something useful. (It is a sad fact of Linux® that people try to make usable systems by building a layer of textual crap then slapping graphics on top of them; inevitably, this fails in a way that means you have to deal with the text again. No, this is not interface abstraction, and anyone who claims that it is is to have their programming priviledges removed. With pliers, if necessary.)

(Deleted comment)
Posted by: LionsPhil (lionsphil)
Posted at: November 29th, 2006 11:48 pm (UTC)

But of course, the average user isn't really bothered about who to blame, but avoiding the breakage in the first place.

This is exactly my point. And the best way to avoid the breakage is to suck it down and accept that there are a disappointing amount of bad scripts out there which make Edgy appear broken in comparison to Dapper, or most other distributions.

I only know that dash was the problem because someone pointed it out to me when I was having Makefile troubles (dash's built-in echo isn't compatable with either GNU /bin/echo or the bash built-in). The problems that this causes are subtle even to people who know what shell scripts are, because scripts will just start exploding in various and sundry ways. Eris help you if the syntax is all acceptable POSIX sh, but you relied on some bash-specific semantics, because it may not even explode until some specific runtime condition, and then in some ill-defined, misbehaving way.

In internally-consistent system is not the sole requirement in a world where the Internet exists and people want to use it and some of the content on it. It's an unfortunate truth that, in modern Linux, there's a de facto standard than /bin/sh is really bash, and it needs to be dealt with in much the same way that web browsers don't tend to really support web standards---they support web sites, and the many curious perversions that people apply to the various and sundry technologies involved. Nobody would use a Firefox build which really did fire flaming weasels out of your nose when encountering an invalid page, and I don't want a /bin/sh which borks when I encounter a script which accidentally grew a bash-ism.

Unfortunately, it seems that a critical mass of Debian devs have jumped ship to Ubuntu, and started sinking it with the same misguided chase for perfection over actual usefulness.

Posted by: ((Anonymous))
Posted at: November 30th, 2006 09:27 am (UTC)
Re: Bingo.

Interesting comparison with Debian, who have resoundly rejected the idea of changing the sh symlink from bash for precicely these reasons.

One of the first useful lessons I learned when I started looking at Linux was that running j-random-shellscript found on the interweb almost never fixed the problem, often introduced other problems, and didn't outfit me with a better understanding of what was going on.

Posted by: LionsPhil (lionsphil)
Posted at: November 30th, 2006 02:37 pm (UTC)
Re: Bingo.

In that case, Anonymous, congratulations to the Debian developers. They have just notched up one point in my opinion of them, for a total of one point.

“Random” shellscripts oft appear as part of configure or install processes for perfectly sane software. Hell, Fragglet gave an example in the top post. The linked bug cites Cedega as another.

Posted by: fragglet (fragglet)
Posted at: November 29th, 2006 09:18 am (UTC)

Quite possibly. A google search suggests that this will probably work, but I've only tested the remove method. If you're going to switch everything back to bash, you might as well remove dash anyway :-)

Posted by: ((Anonymous))
Posted at: January 10th, 2007 11:03 am (UTC)
Thank you, thank you, thank you!

I discovered this post after searching for fixes to why Oracle's SQLDeveloper tool doesn't start properly.

After updating the sh link in /bin to point to bash rather than dash, everything started working again.


Andrew Beacock

Posted by: fragglet (fragglet)
Posted at: January 10th, 2007 01:39 pm (UTC)
Re: Thank you, thank you, thank you!

Glad to hear that people are finding this helpful. You can help get this fixed by posting about your concerns on the Launchpad bug linked in my main post. If enough people complain, perhaps the Ubuntu devs will rethink their position.

Posted by: ((Anonymous))
Posted at: September 8th, 2007 03:49 pm (UTC)
Another fix


sudo dpkg-reconfigure dash

and then answering "no" to the question will set the /bin/sh redirect back to dash. This is something no user should have to do to get his/her software to work.

9 Read Comments