使用 Packer 在 Azure 中创建 Ubuntu VM 时,安装过程在配置时停止并挂起openssh-server
。命令行提示您选择一个选项,由于这是一个自动构建,它会挂起直到过程超时。我该如何防止这种情况发生?
azure-arm.ubuntu: Configuring openssh-server
azure-arm.ubuntu: --------------------------
azure-arm.ubuntu:
azure-arm.ubuntu: A new version (/tmp/fileu2AVnQ) of configuration file /etc/ssh/sshd_config is
azure-arm.ubuntu: available, but the version installed currently has been locally modified.
azure-arm.ubuntu:
azure-arm.ubuntu: 1. install the package maintainer's version
azure-arm.ubuntu: 2. keep the local version currently installed
azure-arm.ubuntu: 3. show the differences between the versions
azure-arm.ubuntu: 4. show a side-by-side difference between the versions
azure-arm.ubuntu: 5. show a 3-way difference between available versions
azure-arm.ubuntu: 6. do a 3-way merge between available versions
azure-arm.ubuntu: 7. start a new shell to examine the situation
azure-arm.ubuntu:
azure-arm.ubuntu: What do you want to do about modified configuration file sshd_config?
答案1
当您升级 openssh 服务器实例时,此错误似乎是由应用程序的 apt/apt-get 更新生成的。
看看这篇文章:https://www.mail-archive.com/[电子邮件保护]/msg249363.html
答案似乎是使用与下面类似的内容:
DEBIAN_FRONTEND=noninteractive \
apt-get \
-o Dpkg::Options::="--force-confnew" \
--force-yes \
-fuy \
dist-upgrade
另外,这篇文章:自动确认 Linux 更新/升级 建议尝试:
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq upgrade