14

What is the purpose of bash-static compared to regular bash? Is it good as a rescue shell or what is it good for?

23

You are probably referring to the .deb package bash-static which is a statically linked version of bash, which means that it is a stand-alone program that does not depend on anything else (especially libraries) on your disk.

I have used it on two different occasions:

  • Installed on servers so that I always have a working bash, even in catastrophic situations when ld.so or libc are not functioning (absent, corrupt, ill-configured, ...)
  • Delivered to customers along with my own shell scripts, so that I'm sure they have the proper version of bash, since I was using some advanced features that were introduced with bash v4.3.
  • 4
    The typical scenario is that / mounts ok, but /usr fails to mount for whatever reason. Therefore, BSD systems generally avoid dynamically linked executables in /bin and /sbin. – Kusalananda Aug 20 '17 at 15:33
  • 2
    @Kusalananda Not sure this is actually a typical scenario. /usr is not supposed to be available in the first booting stages. According to the FHS, you don't want anything in /bin (especially /bin/*sh) to depend on anything in /usr/lib. – xhienne Aug 20 '17 at 15:57
  • 4
    Ah, so that's why Linux has a /lib directory (not present on BSD systems) rather than /usr/lib... – Kusalananda Aug 20 '17 at 16:01
  • 5
    @Kusalananda Right, in addition to, not rather than. The FHS states that "The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin. (footnote) Shared libraries that are only necessary for binaries in /usr (such as any X Window binaries) must not be in /lib." – xhienne Aug 20 '17 at 16:04

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.