Apt错误:系统中由您或脚本创建的文件

8

我有一个简单的Bash脚本,用于连接一系列服务器并更新特定的软件包,使用here-string来回答提示:

sudo /usr/bin/apt-get install package-name <<< Y

提示信息如下:

Configuration file /etc/package-name/package-name.conf
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
  What would you like to do about it? Your options are:
  Y or I : install the package maintainer's version
  N or O : keep your currently-installed version
    D    : show the differences between the versions
    Z    : background this process to examine the situation
 The default action is to keep your current version.
*** package-name.conf (Y/I/N/O/D/Z [default=N] ?

这是当它无法工作时的错误:
dpkg: error processing package-name (--configure):
EOF on stdin a conffile prompt
Errors were encountered while processing:
package-name

我无法在服务器上安装expect或其他程序。希望能得到帮助。

2个回答

18

您应该传入一个 dpkg 选项来指定在此情况下所需的行为,这样就不会提示。

sudo apt-get -o DPkg::Options::="--force-confnew" -y install package-name

(未经测试;通过谷歌搜索获得。)


2
这个可行,tripleee - 谢谢。我修改了命令为:sudo apt-get -o DPkg::Options::="--force-confnew" install package-name - fja
3
使用 --force-confold 选项来获得相反的效果。 - kenorb
请参见:https://askubuntu.com/questions/104899/make-apt-get-or-aptitude-run-with-y-but-not-prompt-for-replacement-of-configu - Daniel777

2
如果您查看apt-get手册页面,您可以找到一个选项(-y)来为您回答“是”。为什么不尝试一下呢?

抱歉 - 我应该提到我尝试过了。在这种情况下它不起作用。 - fja
dpkg:处理 package-name 包时出错 (--configure): 在标准输入上的 EOF conffile 提示 处理过程中遇到了错误: package-name - fja
你只需要执行 sudo /usr/bin/apt-get install -y package-name 命令(未经测试),不需要使用 <<< - ghostdog74
作为替代方案,如果你需要用大写字母Y或其他字符串来回答,你可以使用“yes”。以yes调用时,它将在所有提示中打印出“y”;如果是yes <string>,则将打印出<string> - carlpett
“-y”标志是我尝试的第一件事情之一;但在这种情况下,即使在命令行中也无法使用。谢谢你,不过我知道我提供的信息有限。 - fja
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接