Ubuntu – dpkg package pre-installation script subprocess returned error exit status 2 on 18.04

18.04dockersoftware installation

I used Docker to set up an Ubuntu 18.04 container, and then tried to install the .deb file with an error as shown below.

root@hashirama:/sc5xx_dev/lib/toolchain# dpkg -i  adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb 
(Reading database ... 52942 files and directories currently installed.)
Preparing to unpack adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb ...
dpkg: error processing archive adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb (--install):
 new adi-cces-2.7.0:i386 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb

Output of sudo apt install ./adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb:

dpkg: error processing archive /sc5xx_dev/lib/toolchain/adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb (–unpack):
new adi-cces-2.7.0:i386 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing: /sc5xx_dev/lib/toolchain/adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

Best Answer

I find how to solve this question. It's caused by the "ENV DEBIAN_FRONTEND=noninteractive" in Dockerfile.

To install the ubuntu-18.04 we should set the package in the mode of noninteractive To install the adi_xxx.deb package we should set the event in the mode of interactive.

So The correct Dockerfile:

RUN apt-get -y update RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install net-tools build-essential minicom tftpd-hpa git-all subversion openssh-server ncurses-dev php gawk g++ m4 libncurses5-dev texinfo flex bison php-cli vim php-xml python-setuptools python-dev unzip rsync cpio bc lib32z1 lib32stdc++6 lib32ncurses5

The wrong Dockerfile:

EVN DEBIAN_FRONTEND=noninteractive RUN apt-get -y update RUN apt-get -y -q install net-tools build-essential minicom tftpd-hpa git-all subversion openssh-server ncurses-dev php gawk g++ m4 libncurses5-dev texinfo flex bison php-cli vim php-xml python-setuptools python-dev unzip rsync cpio bc lib32z1 lib32stdc++6 lib32ncurses5

Note: Do not use the command "ENV DEBIAN_FRONTEND=noninteractive" in configuring the Dockerfile this is definitely not a reasonable default, and setting it via ENV should be actively discouraged, Refer to https://github.com/moby/moby/issues/4032

Related Question