Ubuntu apt获取更新非交互式
我正在尝试一个完全非交互式的更新。(在ubuntu 14.04.3 LTS上) 我认为使用这种命令很容易:Ubuntu apt获取更新非交互式,ubuntu,apt-get,Ubuntu,Apt Get,我正在尝试一个完全非交互式的更新。(在ubuntu 14.04.3 LTS上) 我认为使用这种命令很容易: export DEBIAN_FRONTEND=noninteractive apt-get update && apt-get upgrade -q -y --force-yes && apt-get dist-upgrade -q -y --force-yes 但是没有。。。我总是有这样一个问题: Configuration file '/etc/clo
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -q -y --force-yes && apt-get dist-upgrade -q -y --force-yes
但是没有。。。我总是有这样一个问题:
Configuration file '/etc/cloud/cloud.cfg'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
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 : start a shell to examine the situation
The default action is to keep your current version.
*** cloud.cfg (Y/I/N/O/D/Z) [default=N] ?
那么您知道如何自动接受默认值吗?您需要向您的命令传递一些
dpkg
选项,例如:
export DEBIAN_FRONTEND=noninteractive
apt-get update &&
apt-get -o Dpkg::Options::="--force-confold" upgrade -q -y --force-yes &&
apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -q -y --force-yes
另一方面,我建议只使用dist-upgrade
,如果使用upgrade
=Apt 1.1,最终会导致依赖关系中断
如果您使用的是Apt 1.1或更高版本,那么您必须使用以--允许开头的选项,例如--允许降级
,--允许删除基本的
,--允许更改保留的包
因此,命令是:
DEBIAN_FRONTEND=noninteractive \
apt-get \
-o Dpkg::Options::=--force-confold \
-o Dpkg::Options::=--force-confdef \
-y --allow-downgrades --allow-remove-essential --allow-change-held-packages
注意:使用--force confold
保留旧配置,使用--force confnew
保留新配置
来源:
相关的:
此网站用于解答编程问题。我们不是一般的操作系统/软件技术支持。我认为,询问如何使apt非交互式是一个有效的问题,我们应该最终确定是否仍然需要superuser.com。对于任何其他发现这一点的同行,引用周围的Dpkg::Options
是错误的。它应该是:apt get-o“Dpkg::Options::=--force confold”dist-upgrade-y--force yes
要在sudo中使用,请确保将环境变量放在命令前面,而不是希望sudo不会剥离您的环境,例如:sudo DEBIAN_FRONTEND=非交互式apt get-o“Dpkg::Options:=--force confold”dist upgrade-y--force yes
@Irving,那句话对我有用,也许最近有什么变化?W:--force yes不推荐使用,请使用以--allow开头的选项之一。
(apt v1.1及更新版本)。看起来新的等价物是--允许降级--允许删除必要的--允许更改保留的包
我想您在某个地方的命令中缺少了“更新”这个词?