Moj*_*ojo 18 chef apt ubuntu-12.04
我喜欢使用“knife cloudstack server create ...”来构建一个新的VM。我的引导模板以“apt-get update”和“apt-get -y upgrade”开始。
升级然后停止:
10.190.113.11 Configuration file `/etc/nscd.conf'
10.190.113.11 ==> Modified (by you or by a script) since installation.
10.190.113.11 ==> Package distributor has shipped an updated version.
10.190.113.11 What would you like to do about it ? Your options are:
10.190.113.11 Y or I : install the package maintainer's version
10.190.113.11 N or O : keep your currently-installed version
10.190.113.11 D : show the differences between the versions
10.190.113.11 Z : start a shell to examine the situation
10.190.113.11 The default action is to keep your current version.
10.190.113.11 *** nscd.conf (Y/I/N/O/D/Z) [default=N] ?
Run Code Online (Sandbox Code Playgroud)
所以实际上有两个问题:
首先,我可以让 apt-get 默认做一些事情吗?显然没有办法提供答案。
其次,我什至不知道这个问题的正确答案应该是什么。它替换的配置文件来自模板。我还没有查过“nscd”到底是做什么的。(想必“Y”是正确答案,但问题当时所涉及的研究令人生畏。)
Jos*_*ush 22
您可以传递参数以避免收到提示。这对我有用;
apt-get update
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
Run Code Online (Sandbox Code Playgroud)
--force-confold(我的选择)将使这些“您想对修改后的配置文件做什么”问题默认为N(保留您当前安装的版本)
--force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration files that you have not modified are left untouched. You need to combine it with --force-confdef to let dpkg overwrite configuration files that you have not modified.
--force-confnew: always install the new version of the configuration file, the current version is kept in a file with the .dpkg-old suffix.
--force-confdef: ask dpkg to decide alone when it can and prompt otherwise. This is the default behavior of dpkg and this option is mainly useful in combination with --force-confold.
--force-confmiss: ask dpkg to install the configuration file if it’s currently missing (for example because you have removed the file by mistake).
Run Code Online (Sandbox Code Playgroud)
警告- 如果保留一些修改过的配置文件并且与更新的软件包版本不兼容,则可能会破坏您的系统。请在部署自动化解决方案之前对其进行测试。
如果您绝对不想回答任何交互式问题,请将DEBIAN_FRONTEND前端变量设置为noninteractive.
这很简单DEBIAN_FRONTEND=noninteractive apt-get upgrade。
您将不会收到任何消息,并且将选择默认值。在大多数情况下,这意味着您的配置文件不会被更改,并且您将保留*.dpkg-new所有未更改配置文件的位置的名称为 like的文件。然后,您可以手动解决更改,或使用配置管理系统或其他方式将本地配置推送到系统。
其次,我什至不知道这个问题的正确答案应该是什么
按D键将显示差异,然后您可以检查该差异。如果您确定您从未手动更改过该文件,则选择Y来替换它可能是安全的(您已验证您的备份升级正确!!)。选择N只会保留旧文件,这在 95% 的情况下也是安全的,除非包有重大更改,这些更改通常包含在更改日志/发行说明中,您在运行 upgrade/dist-upgrade 命令之前也已阅读这些说明。
在那之后,只需在您的测试环境中首先尝试该命令。看看事情是否不起作用。如果您真的不确定获取差异,请阅读包和研究的文档。
| 归档时间: |
|
| 查看次数: |
16344 次 |
| 最近记录: |