我喜欢用“刀云栈服务器创build…”来构build一个新的虚拟机。 我的引导程序模板以“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] ?
所以真的有两个问题:
首先,我可以使用apt-get来默认做些什么吗? 显然没有办法提供答案。
其次,我甚至不知道这个问题的正确答案是什么。 它正在replace的configuration文件来自一个模板。 我还没有查找什么“nscd”甚至没有。 (据推测“Y”是正确的答案,但在问题时涉及的研究是令人生畏的。)
如果您绝对不想回答任何交互式问题,请将DEBIAN_FRONTEND前端variables设置DEBIAN_FRONTEND noninteractive 。
这可以像DEBIAN_FRONTEND=noninteractive apt-get upgrade一样简单。
您将不会收到消息,并会select默认值。 在大多数情况下,这意味着您的configuration文件将不会被更改,并且您将留下名为*.dpkg-new的所有configuration文件未被更改的位置的文件。 然后,您可以手动解决更改,或使用configurationpipe理系统或其他任何方法将本地configuration推送到系统。
其次,我甚至不知道这个问题的正确答案是什么
按D键将显示差异,然后您可以检查。 如果您确定您从未手动更改该文件,则selectY来replace它可能是安全的(您已经validation了您的备份升级RIGHT !! )。 selectN只是保留了95%的时间也是安全的旧文件,除非软件包有重大变化,通常在运行upgrade / dist-upgrade命令之前您已经读过的变更日志/
过去,只需在您的testing环境中首先尝试命令。 看看事情不行。 如果你真的不知道得到的差异,并阅读包和研究文件。
你可以传递参数来避免提示。 这适用于我;
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
--force-confold (我的select)将使这些“你想做什么修改configuration文件”的问题默认为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).
警告 – 一些修改后的configuration文件可能会损坏您的系统,如果保留在后面并且与更新的软件包版本不兼 请在部署自动化解决scheme之前进行testing 。