Is there a way to do an apt-get dist-upgrade in Debian that not only automatically answers "yes" to all questions asked, but also uses reasonable defaults as answers to questions that are sophisticated enough to require various interactive dialog boxes to pop up? I'm thinking here of the keymap stuff that shows up when you upgrade libc6, and kernel image choices.

The goal is to be able to remotely initiate a rather large dist-upgrade - even for a machine that is severely behind the times - and not have to babysit it at all, unless something is just horribly, disastrously wrong.

Surely this is possible?

Thanks in advance!

  • For those that only want to upgrade (rather than dist-upgrade) on Ubuntu, try the unattended-upgrade package.
    – Jo Liss
    Jul 8, 2011 at 14:24

5 Answers 5


If you set DEBIAN_FRONTEND=noninteractive (to stop debconf prompts from appearing) and add force-confold and force-confdef to your /etc/dpkg/dpkg.cfg file, you should have a completely noninteractive package installation experience. Any package that still prompts you for information has a release critical bug (and I say that as both an automation junkie and as a Debian developer).

  • this did not work for me. apt-listchanges was opened by less.
    – magnetar
    Sep 12, 2012 at 17:28
  • @magnetar: That's a problem with apt-listchanges, not apt. Uninstall apt-listchanges, or configure it appropriately.
    – womble
    Sep 20, 2012 at 1:16
  • 1
    Try: env APT_LISTCHANGES_FRONTEND=none apt-get dist-upgrade -u -y Feb 2, 2013 at 17:28

Florian Lohoff posted a way to get what womble suggested into a single command:

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

Of course you might also use -o Dpkg::Options::="--force-confnew --force-confdef" (search the the dpkg man page for confnew). I'm not sure in what cases this would make a difference though. I personally need the non-interactive upgrade to bring vanilla images up-to-date, in which case I suppose always picking the new config file (without --force-confdef) is a reasonable thing.

  • 1
    W: --force-yes is deprecated, use one of the options starting with --allow instead.
    – Alex
    Mar 12, 2018 at 17:49
  • 1
    --force-yes can be replaced with --allow-downgrades --allow-remove-essential --allow-change-held-packages today for the same effect.
    – Mahn
    Feb 14, 2020 at 15:44

Even though womble's answer above is generally good, it did not work for me and I had to do some additional research to go 100% unattended. I thought I'll share the result in a concise manner to make things simpler for future visitors.

The following is a script that will run according to the debian 8 release notes upgrade recommendations (mostly) along with flags and environment variables that will make it unattended. (the echos are just for debugging and could be removed - though I recommend keeping them so if the script gets stuck you will know where)


apt-get remove apt-listchanges --assume-yes --force-yes &&

#using export is important since some of the commands in the script will fire in a subshell
export DEBIAN_FRONTEND=noninteractive &&

#lib6c was an issue for me as it ignored the DEBIAN_FRONTEND environment variable and fired a prompt anyway. This should fix it
echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections &&

echo "executing wheezy to jessie" &&
find /etc/apt -name "*.list" | xargs sed -i '/^deb/s/wheezy/jessie/g' &&

echo "executing autoremove" &&
apt-get -fuy --force-yes autoremove &&

echo "executing clean" &&
apt-get --force-yes clean &&

echo "executing update" &&
apt-get update &&

echo "executing upgrade" &&
apt-get --force-yes -o Dpkg::Options::="--force-confold" --force-yes -o Dpkg::Options::="--force-confdef" -fuy upgrade &&

echo "executing dist-upgrade" &&
apt-get --force-yes -o Dpkg::Options::="--force-confold" --force-yes -o Dpkg::Options::="--force-confdef" -fuy dist-upgrade
  • 3
    Note: "--force-yes Force yes; this is a dangerous option that will cause apt to continue without prompting if it is doing something potentially harmful. It should not be used except in very special situations. Using force-yes can potentially destroy your system! Configuration Item: APT::Get::force-yes. This is deprecated and replaced by --allow-downgrades, --allow-remove-essential, --allow-change-held-packages in 1.1."
    – Alex
    Dec 3, 2018 at 21:28

>= 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 \

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

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



From the apt-get(8) man page:

   -y, --yes, --assume-yes
       Automatic yes to prompts; assume "yes" as answer to all prompts
       run non-interactively. If an undesirable situation, such as
       changing a held package, trying to install a unauthenticated
       package or removing an essential package occurs then apt-get will
       abort. Configuration Item: APT::Get::Assume-Yes.

For reference, the -y option works on yum(8) as well.

  • 5
    I know about that. I use that flag and it successfully answers 'yes' to standard APT Y/N questions about keeping overwriting existing configs, etc., etc. Those aren't the questions I'm referring to. When I do an apt-get -y dist-upgrade it still gave me some 'dialog' prompts for what it considers big-ticket stuff, i.e. keymap changes, libc6-related service restart, etc. I was looking for an additional flag to turn that off as well. Aug 1, 2009 at 2:29

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.