1

I'm trying to provision a machine using Vagrant and plain bash scripts.

The two lines are:

DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq

However, it doesn't work as expected:

default: Configuration file '/etc/update-manager/release-upgrades'
default:  ==> Modified (by you or by a script) since installation.
default:  ==> Package distributor has shipped an updated version.
default:    What would you like to do about it ?  Your options are:
default:     Y or I  : install the package maintainer's version
default:     N or O  : keep your currently-installed version
default:       D     : show the differences between the versions
default:       Z     : start a shell to examine the situation
default:  The default action is to keep your current version.
default: 
default: *** release-upgrades (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package ubuntu-release-upgrader-core (--configure):
default: 
default:  end of file on stdin at conffile prompt

Is there any other option I could use to provide a Y answer to that?

0

< Apt 1.1

Try the following command to force upgrade for non-interactive sessions:

DEBIAN_FRONTEND=noninteractive \
        apt-get \
                -o Dpkg::Options::="--force-confnew" \
                --force-yes \
                -fuy \
                dist-upgrade

Note: Use --force-confold to keep old, and --force-confnew to keep new configs.

Source: apt-get -y upgrade for non-interactive sessions - and replacing conf files in /etc.

>= Apt 1.1

If you're using Apt 1.1 or above, --force-yes has been deprecated, so you've to use the options starting with --allow instead, e.g. --allow-downgrades, --allow-remove-essential, --allow-change-held-packages.

So the command is:

DEBIAN_FRONTEND=noninteractive \
  apt-get \
  -o Dpkg::Options::=--force-confold \
  -o Dpkg::Options::=--force-confdef \
  -y --allow-downgrades --allow-remove-essential --allow-change-held-packages

Source: CFE-2360: Make apt_get package module version aware.

Related:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.