I want to build a docker image from ubuntu image. It is required to change the default sh from dash to bash manually. (Because it require to install many rpm packages which contains bash scripts)

dpkg-reconfigure dash

Is there any method to let this action automatically without human behavior?

In my Dockerfile it maybe written as(Method 1)

RUN dpkg-reconfigure dash

I've tried another method(Method 2)

RUN ln -sf bash /bin/sh

But, both method can not work.

4 Answers 4


You can make debconf only ask for high or critical questions[1].


dpkg-reconfigure -p critical dash

dpkg-reconfigure will use default answer defined in debconf script. You can also use debconf-get-selections to pick up different answer for noninteractive installation[2].

  1. https://wiki.debian.org/debconf
  2. http://blog.nutsfactory.net/2008/03/06/noninteractive-dpkg-installation-on-debian-system/
  • If you want to see what's going on when runing dpkg-reconfigure DEBCONF_DEBUG=developer dpkg-reconfigure -p critical dash
    – Rex Tsai
    Feb 12, 2014 at 11:06
  • debconf-get-selections is missing. I can not found in packages.debian.org/wheezy/all/debconf/filelist. Feb 12, 2014 at 11:13
  • 16
    I use debconf-show dash to get options. echo "dash dash/sh boolean false" | debconf-set-selections and DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash to do non-interactive configuring. Feb 12, 2014 at 11:38
  • 2
    @DanielYCLin if you added that as its own answer, I would upvote it.
    – gazarsgo
    Apr 28, 2014 at 20:09

Pasting Daniel's comment as an answer here since it doesn't rely on default settings from dpkg-reconfigure.

To get options:

debconf-show dash

To set this particular option to false:

echo "dash dash/sh boolean false" | debconf-set-selections

and to actually reconfigure the package:

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

This worked for me from a Dockerfile:

# make /bin/sh symlink to bash instead of dash:
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

Through some trial & error and much assistance from others, this ansible statement does the same thing:

# See "/var/cache/debconf/config.dat" for name of config item after changing manually
- name: aws-ssm ansible plugin fails if dash is the default shell
    name: dash/sh
    question: dash/sh
    value: false
    vtype: boolean

You should instead patch those scripts to use #!/bin/bash instead of #!/bin/sh. Newer versions of Debian and Ubuntu no longer support using anything other than dash for /bin/sh.

  • 2
    Sure I will just patch this obscure extremely expensive commercial EDA tool that I didn't write...
    – Timmmm
    May 25, 2023 at 12:09

You must log in to answer this question.

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