I’m using AWS EC2 14.04 LTS and I’m trying to run command
apt-get -y upgrade
or apt-get -y dist-upgrade
, however, I always get prompt like this:
I tried following commands and none of them work and I still get above prompt:
apt-get update && apt-get -y -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade
apt-get update && apt-get -o Dpkg::Options::='--force-confold' --force-yes -fuy dist-upgrade
I have been been googling for solutions but could not find that actually works. Anyone has any thought?
Thanks
Advertisement
Answer
Took me a while to figure out the simple solution. I could avoid the prompt by adding DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold'
So here is my common function that I use to upgrade all my Ubuntu machines:
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
REF Answer: https://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo