我使用 Docker 设置了一个 Ubuntu 18.04 容器,然后尝试安装.deb 文件,但出现如下所示的错误。
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
输出sudo apt install ./adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb
:
dpkg:错误处理存档 /sc5xx_dev/lib/toolchain/adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb (--unpack):新的 adi-cces-2.7.0:i386 软件包预安装脚本子进程返回错误退出状态 2 处理时遇到错误:/sc5xx_dev/lib/toolchain/adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb E:子进程 /usr/bin/dpkg 返回错误代码 (1)
答案1
我找到了如何解决这个问题。这是由ENV DEBIAN_FRONTEND=noninteractive
中的“ ”引起的Dockerfile
。
要安装 ubuntu-18.04,我们应该以非交互模式设置包。要安装包,adi_xxx.deb
我们应该以交互模式设置事件。
因此正确的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
错误的 Dockerfile:
ENV 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
ENV DEBIAN_FRONTEND=noninteractive
注意:不要在配置中使用命令“ ” Dockerfile
,这绝对不是一个合理的默认值,并且ENV
应该积极阻止通过它进行设置,请参阅https://github.com/moby/moby/issues/4032
答案2
对我来说,这似乎是下载问题。
我已经下载了您的文件:
wget http://download.analog.com/tools/CrossCoreEmbeddedStudio/Releases/Release_2.8.0/adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb
并检查其尺寸
$ ls -al adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb
-rw-rw-r-- 1 用户 用户 580754562 十一月 25 12:33 adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb
我还检查了 MD5 总数:
$ md5sum adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb
2814b42b1fdefa254701b2c802e35c1d adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb
可以正常安装:
$ sudo apt-get install ./adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'adi-cces-2.8.0:i386' instead of './adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb' The following NEW packages will be installed: adi-cces-2.8.0:i386 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/581 MB of archives. After this operation, 1 644 MB of additional disk space will be used. Get:1 /home/user/adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb adi-cces-2.8.0 i386 2.8.0 [581 MB] Selecting previously unselected package adi-cces-2.8.0:i386. (Reading database ... 215776 files and directories currently installed.) Preparing to unpack .../adi-CrossCoreEmbeddedStudio-linux-x86-2.8.0.deb ... Unpacking adi-cces-2.8.0:i386 (2.8.0) ... Setting up adi-cces-2.8.0:i386 (2.8.0) ... Processing triggers for mime-support (3.60ubuntu1) ... Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.1) ... Processing triggers for bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index...
您还需要安装 32 位库:
sudo apt-get install libc6:i386 libgtk-3-0:i386 libxtst6:i386
考虑重新下载该文件。