无法执行新的预安装脚本 (/var/lib/dpkg/tmp.ci/preinst)

Jav*_*rza 5 dpkg deb vagrant

我尝试在使用generic/ubuntu1604映像的 vagrant box 中安装 .deb 文件,但出现以下错误:

Reading package lists... Done
Building dependency tree

Reading state information... Done
Reading state information... Done

A queue based service for watching directories for files to process as per its configuration.
Do you want to install the software package? [y/N]:y
(Reading database ... 108439 files and directories currently installed.)
Preparing to unpack wtbuild.deb ...
dpkg (subprocess): unable to execute new pre-installation script (/var/lib/dpkg/tmp.ci/preinst): No such file or directory
dpkg: error processing archive wtbuild.deb (--install):
 subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
 wtbuild.deb
Run Code Online (Sandbox Code Playgroud)

错误

这种情况只发生在该图像上。如果我尝试在我的 Linux 机器( xenial )或具有不同 Linux 映像的另一个 vagrant box 中安装相同的 .deb 文件,则 .deb 文件会正确安装。

Zen*_*xer 4

您缺少出现在 preinst 脚本的 shebang 行中的可执行文件。

  1. 将包元数据提取到临时目录:dpkg -e wtbuild.deb tmp
  2. tmp/preinst在文本编辑器中打开。
  3. 第一行应以字符 开头#!。之后出现的文本是将用于运行该文件的程序。你错过了那个程序。
  4. 确定提供缺失程序的软件包。例如,如果程序是/usr/bin/python,您应该安装该python软件包:sudo apt-get install python

如果您维护 wtbuild.deb,则应该花时间将缺少的依赖项添加到包的control文件中。如果其他人维护 wtbuild.deb,您应该提交错误报告并包含缺少的依赖包的名称。

  • 谢谢@Zenexer。这为我指明了正确的方向。我的 shebang 关闭了,但不是因为文件不存在,而是因为我有 CrLf 行结尾而不是 Lf。 (3认同)