系统相关
首页 > 系统相关> > linux-在apt-get upgrade或apt-get dist-upgrade中不强制提示

linux-在apt-get upgrade或apt-get dist-upgrade中不强制提示

作者:互联网

我正在使用AWS EC2 14.04 LTS,并且正在尝试运行命令
apt-get -y upgrade或apt-get -y dist-upgrade,但是,我总是这样提示:

我尝试了以下命令,但没有一个起作用,但仍然出现以上提示:

apt-get更新&& apt-get -y -o Dpkg :: Options :: =“-force-confmiss” -o Dpkg :: Options :: =“ =”-force-confdef“ -o Dpkg :: Options :: =” =“-force -confnew” dist-upgrade

apt-get更新&& apt-get -o Dpkg :: Options :: =’-force-confold’–force-yes -fuy dist-upgrade

我一直在寻找解决方案,但找不到实际可行的方法.有人有什么想法吗?

谢谢

解决方法:

花了我一段时间找出简单的解决方案.我可以通过添加DEBIAN_FRONTEND =’noninteractive’apt-get -y -o Dpkg :: Options :: =’-force-confdef’-o Dpkg :: Options :: =’-force-confold’来避免提示

因此,这是我用来升级所有Ubuntu计算机的常用功能:

function runAptGetUpgrade()
{
    DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade
    DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade

    apt-get autoremove -y
    apt-get clean
    apt-get autoclean
}

REF My Lib:https://github.com/gdbtek/ubuntu-cookbooks/blob/master/libraries/util.bash

参考答案:https://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo

标签:ubuntu,ubuntu-14-04,package,apt-get,linux
来源: https://codeday.me/bug/20191029/1959050.html